feat(oas): declare x-codegen on Store routes (#3074)
### What Declare `x-codegen` in OAS for Store routes. ### Why We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators. In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value. We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` ### How Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths. Match method and queryParams values with equivalent ones from our current JS client package. ### Test * Ran OAS validator. * Ran docs build script. Expect no visible changes to the documentation.
This commit is contained in:
@@ -10,9 +10,13 @@ import { validator } from "../../../../utils/validator"
|
||||
* operationId: "PostAuth"
|
||||
* summary: "Customer Login"
|
||||
* description: "Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser."
|
||||
* parameters:
|
||||
* - (body) email=* {string} The Customer's email.
|
||||
* - (body) password=* {string} The Customer's password.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostAuthReq"
|
||||
* x-codegen:
|
||||
* method: authenticate
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -93,6 +97,20 @@ export default async (req, res) => {
|
||||
res.json({ customer })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostAuthReq
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The Customer's email.
|
||||
* password:
|
||||
* type: string
|
||||
* description: The Customer's password.
|
||||
*/
|
||||
export class StorePostAuthReq {
|
||||
@IsEmail()
|
||||
email: string
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* summary: "Customer Log out"
|
||||
* description: "Destroys a Customer's authenticated session."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: deleteSession
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -13,6 +13,8 @@ import CustomerService from "../../../../services/customer"
|
||||
* format: email
|
||||
* required: true
|
||||
* description: The email to check if exists.
|
||||
* x-codegen:
|
||||
* method: exists
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@ import CustomerService from "../../../../services/customer"
|
||||
* summary: "Get Current Customer"
|
||||
* description: "Gets the currently logged in Customer."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: getSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,8 +12,13 @@ import { validator } from "../../../../utils/validator"
|
||||
* summary: "Add a Shipping Method"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The cart ID.
|
||||
* - (body) option_id=* {string} ID of the shipping option to create the method from
|
||||
* - (body) data {Object} Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartsCartShippingMethodReq"
|
||||
* x-codegen:
|
||||
* method: addShippingMethod
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -91,6 +96,19 @@ export default async (req, res) => {
|
||||
res.status(200).json({ cart: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartsCartShippingMethodReq
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: ID of the shipping option to create the method from
|
||||
* data:
|
||||
* type: object
|
||||
* description: Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send.
|
||||
*/
|
||||
export class StorePostCartsCartShippingMethodReq {
|
||||
@IsString()
|
||||
option_id: string
|
||||
|
||||
@@ -11,6 +11,8 @@ import { IdempotencyKey } from "../../../../models/idempotency-key"
|
||||
* this may involve making 3rd party API calls to a Tax Provider service."
|
||||
* parameters:
|
||||
* - (path) id=* {String} The Cart ID.
|
||||
* x-codegen:
|
||||
* method: calculateTaxes
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -15,6 +15,8 @@ import { IdempotencyKeyService } from "../../../../services"
|
||||
* will generate one for the request."
|
||||
* parameters:
|
||||
* - (path) id=* {String} The Cart id.
|
||||
* x-codegen:
|
||||
* method: complete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,8 @@ import PublishableAPIKeysFeatureFlag from "../../../../loaders/feature-flags/pub
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,9 +20,13 @@ import {
|
||||
* to the Cart"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart to add the Line Item to.
|
||||
* - (body) variant_id=* {string} The id of the Product Variant to generate the Line Item from.
|
||||
* - (body) quantity=* {integer} The quantity of the Product Variant to add to the Line Item.
|
||||
* - (body) metadata {object} An optional key-value map with additional details about the Line Item.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartsCartLineItemsReq"
|
||||
* x-codegen:
|
||||
* method: createLineItem
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -129,6 +133,23 @@ export default async (req, res) => {
|
||||
res.status(idempotencyKey.response_code).json(idempotencyKey.response_body)
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartsCartLineItemsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* type: string
|
||||
* description: The id of the Product Variant to generate the Line Item from.
|
||||
* quantity:
|
||||
* type: number
|
||||
* description: The quantity of the Product Variant to add to the Line Item.
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details about the Line Item.
|
||||
*/
|
||||
export class StorePostCartsCartLineItemsReq {
|
||||
@IsString()
|
||||
variant_id: string
|
||||
|
||||
@@ -10,6 +10,8 @@ import IdempotencyKeyService from "../../../../services/idempotency-key"
|
||||
* description: "Creates Payment Sessions for each of the available Payment Providers in the Cart's Region."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* x-codegen:
|
||||
* method: createPaymentSessions
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -10,6 +10,8 @@ import { CartService } from "../../../../services"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* - (path) code=* {string} The unique Discount code.
|
||||
* x-codegen:
|
||||
* method: deleteDiscount
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -10,6 +10,8 @@ import { CartService } from "../../../../services"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* - (path) line_id=* {string} The id of the Line Item.
|
||||
* x-codegen:
|
||||
* method: deleteLineItem
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -10,6 +10,8 @@ import { EntityManager } from "typeorm"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* - (path) provider_id=* {string} The id of the Payment Provider used to create the Payment Session to be deleted.
|
||||
* x-codegen:
|
||||
* method: deletePaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -7,6 +7,8 @@ import { CartService } from "../../../../services"
|
||||
* description: "Retrieves a Cart."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { EntityManager } from "typeorm"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* - (path) provider_id=* {string} The id of the Payment Provider that created the Payment Session to be refreshed.
|
||||
* x-codegen:
|
||||
* method: refreshPaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,7 +12,13 @@ import { validator } from "../../../../utils/validator"
|
||||
* description: "Selects a Payment Session as the session intended to be used towards the completion of the Cart."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Cart.
|
||||
* - (body) provider_id=* {string} The ID of the Payment Provider.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartsCartPaymentSessionReq"
|
||||
* x-codegen:
|
||||
* method: setPaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -78,6 +84,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ cart: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartsCartPaymentSessionReq
|
||||
* type: object
|
||||
* required:
|
||||
* - provider_id
|
||||
* properties:
|
||||
* provider_id:
|
||||
* type: string
|
||||
* description: The ID of the Payment Provider.
|
||||
*/
|
||||
export class StorePostCartsCartPaymentSessionReq {
|
||||
@IsString()
|
||||
provider_id: string
|
||||
|
||||
@@ -27,6 +27,8 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartsCartReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -13,7 +13,13 @@ import { validator } from "../../../../utils/validator"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* - (path) line_id=* {string} The id of the Line Item.
|
||||
* - (body) quantity=* {integer} The quantity to set the Line Item to.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartsCartLineItemsItemReq"
|
||||
* x-codegen:
|
||||
* method: updateLineItem
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -112,6 +118,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ cart: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartsCartLineItemsItemReq
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* quantity:
|
||||
* type: number
|
||||
* description: The quantity to set the Line Item to.
|
||||
*/
|
||||
export class StorePostCartsCartLineItemsItemReq {
|
||||
@IsInt()
|
||||
quantity: number
|
||||
|
||||
@@ -12,7 +12,13 @@ import { EntityManager } from "typeorm"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Cart.
|
||||
* - (path) provider_id=* {string} The id of the payment provider.
|
||||
* - (body) data=* {object} The data to update the payment session with.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCartsCartPaymentSessionUpdateReq"
|
||||
* x-codegen:
|
||||
* method: updatePaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -83,6 +89,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ cart: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartsCartPaymentSessionUpdateReq
|
||||
* type: object
|
||||
* required:
|
||||
* - data
|
||||
* properties:
|
||||
* data:
|
||||
* type: object
|
||||
* description: The data to update the payment session with.
|
||||
*/
|
||||
export class StorePostCartsCartPaymentSessionUpdateReq {
|
||||
@IsObject()
|
||||
data: Record<string, unknown>
|
||||
|
||||
@@ -7,6 +7,8 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* description: "Retrieves a Product Collection."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Product Collection
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -56,6 +56,9 @@ import { Type } from "class-transformer"
|
||||
* type: string
|
||||
* description: filter by dates greater than or equal to this date
|
||||
* format: date
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetCollectionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerAddressesReq"
|
||||
* x-codegen:
|
||||
* method: addAddress
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,8 @@ import CustomerService from "../../../../services/customer"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) address_id=* {string} The id of the Address to remove.
|
||||
* x-codegen:
|
||||
* method: deleteAddress
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -7,6 +7,8 @@ import CustomerService from "../../../../services/customer"
|
||||
* summary: Get a Customer
|
||||
* description: "Retrieves a Customer - the Customer must be logged in to retrieve their details."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { PaymentProvider } from "../../../../models"
|
||||
* summary: Get Payment Methods
|
||||
* description: "Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: listPaymentMethods
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -137,6 +137,9 @@ import { DateComparisonOperator } from "../../../../types/common"
|
||||
* - (query) offset=0 {integer} The offset in the resulting orders.
|
||||
* - (query) fields {string} (Comma separated string) Which fields should be included in the resulting orders.
|
||||
* - (query) expand {string} (Comma separated string) Which relations should be expanded in the resulting orders.
|
||||
* x-codegen:
|
||||
* method: listOrders
|
||||
* queryParams: StoreGetCustomersCustomerOrdersParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -13,6 +13,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerPasswordTokenReq"
|
||||
* x-codegen:
|
||||
* method: generatePasswordToken
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersResetPasswordReq"
|
||||
* x-codegen:
|
||||
* method: resetPassword
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerAddressesAddressReq"
|
||||
* x-codegen:
|
||||
* method: updateAddress
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,8 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import GiftCardService from "../../../../services/gift-card"
|
||||
* description: "Retrieves a Gift Card by its associated unqiue code."
|
||||
* parameters:
|
||||
* - (path) code=* {string} The unique Gift Card code.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,8 @@ import {
|
||||
* description: "Completes an OrderEdit."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Order Edit.
|
||||
* x-codegen:
|
||||
* method: complete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -19,6 +19,8 @@ import {
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostOrderEditsOrderEditDecline"
|
||||
* x-codegen:
|
||||
* method: decline
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -8,6 +8,8 @@ import { OrderEditService } from "../../../../services"
|
||||
* description: "Retrieves a OrderEdit."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the OrderEdit.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,8 @@ import {
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerAcceptClaimReq"
|
||||
* x-codegen:
|
||||
* method: confirmRequest
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { OrderService } from "../../../../services"
|
||||
* description: "Retrieves an Order by the id of the Cart that was used to create the Order."
|
||||
* parameters:
|
||||
* - (path) cart_id=* {string} The ID of Cart.
|
||||
* x-codegen:
|
||||
* method: retrieveByCartId
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { OrderService } from "../../../../services"
|
||||
* description: "Retrieves an Order"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Order.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -38,6 +38,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* postal_code:
|
||||
* type: string
|
||||
* description: The postal code of the shipping address
|
||||
* x-codegen:
|
||||
* method: lookupOrder
|
||||
* queryParams: StoreGetOrdersParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,8 @@ import { TokenEvents } from "../../../../types/token"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerOrderClaimReq"
|
||||
* x-codegen:
|
||||
* method: requestCustomerOrders
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostPaymentCollectionsBatchSessionsAuthorizeReq"
|
||||
* x-codegen:
|
||||
* method: authorizePaymentSessionsBatch
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,8 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Payment Collections.
|
||||
* - (path) session_id=* {string} The ID of the Payment Session.
|
||||
* x-codegen:
|
||||
* method: authorizePaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) id=* {string} The ID of the PaymentCollection.
|
||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||
* - (query) fields {string} Comma separated list of fields to include in the results.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: GetPaymentCollectionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
+2
@@ -17,6 +17,8 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostPaymentCollectionsBatchSessionsReq"
|
||||
* x-codegen:
|
||||
* method: managePaymentSessionsBatch
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,8 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePaymentCollectionSessionsReq"
|
||||
* x-codegen:
|
||||
* method: managePaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -10,6 +10,8 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the PaymentCollection.
|
||||
* - (path) session_id=* {string} The id of the Payment Session to be refreshed.
|
||||
* x-codegen:
|
||||
* method: refreshPaymentSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,9 @@ import { defaultStoreScope } from "."
|
||||
* - (path) id=* {string} The ID of the Product Category
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each product category.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be retrieved in each product category.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: StoreGetProductCategoryParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IsNumber, IsOptional, IsString } from "class-validator"
|
||||
import { IsOptional, IsString } from "class-validator"
|
||||
import { Request, Response } from "express"
|
||||
import { Type, Transform } from "class-transformer"
|
||||
import { Transform } from "class-transformer"
|
||||
|
||||
import { ProductCategoryService } from "../../../../services"
|
||||
import { extendedFindParamsMixin } from "../../../../types/common"
|
||||
@@ -17,6 +17,9 @@ import { defaultStoreScope } from "."
|
||||
* - (query) parent_category_id {string} Returns categories scoped by parent
|
||||
* - (query) offset=0 {integer} How many product categories to skip in the result.
|
||||
* - (query) limit=100 {integer} Limit the number of product categories returned.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetProductCategoriesParams
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
@@ -67,7 +70,10 @@ export default async (req: Request, res: Response) => {
|
||||
"productCategoryService"
|
||||
)
|
||||
|
||||
const selectors = Object.assign({ ...defaultStoreScope }, req.filterableFields)
|
||||
const selectors = Object.assign(
|
||||
{ ...defaultStoreScope },
|
||||
req.filterableFields
|
||||
)
|
||||
|
||||
const [data, count] = await productCategoryService.listAndCount(
|
||||
selectors,
|
||||
|
||||
@@ -82,6 +82,9 @@ import ProductTypeService from "../../../../services/product-type"
|
||||
* type: string
|
||||
* description: filter by dates greater than or equal to this date
|
||||
* format: date
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetProductTypesParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -27,6 +27,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: StoreGetProductsProductParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -64,7 +67,7 @@ import { validator } from "../../../../utils/validator"
|
||||
export default async (req, res) => {
|
||||
const { id } = req.params
|
||||
|
||||
const validated = await validator(PriceSelectionParams, req.query)
|
||||
const validated = await validator(StoreGetProductsProductParams, req.query)
|
||||
|
||||
const customer_id = req.user?.customer_id
|
||||
|
||||
@@ -99,3 +102,5 @@ export default async (req, res) => {
|
||||
|
||||
res.json({ product })
|
||||
}
|
||||
|
||||
export class StoreGetProductsProductParams extends PriceSelectionParams {}
|
||||
|
||||
@@ -129,6 +129,12 @@ import PublishableAPIKeysFeatureFlag from "../../../../loaders/feature-flags/pub
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each order of the result.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be included in each order of the result.
|
||||
* - (query) order {string} the field used to order the products.
|
||||
* - (query) cart_id {string} The id of the Cart to set prices based on.
|
||||
* - (query) region_id {string} The id of the Region to set prices based on.
|
||||
* - (query) currency_code {string} The currency code to use for price selection.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetProductsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,6 +15,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* - (query) offset {integer} How many products to skip in the result.
|
||||
* - (query) limit {integer} Limit the number of products returned.
|
||||
* - (query) filter {} Filter based on the search engine.
|
||||
* x-codegen:
|
||||
* method: search
|
||||
* queryParams: StorePostSearchReq
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -7,6 +7,8 @@ import RegionService from "../../../../services/region"
|
||||
* description: "Retrieves a Region."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Region.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -58,6 +58,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* type: string
|
||||
* description: filter by dates greater than or equal to this date
|
||||
* format: date
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetRegionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,8 @@ import ReturnReasonService from "../../../../services/return-reason"
|
||||
* description: "Retrieves a Return Reason."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Return Reason.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import ReturnReasonService from "../../../../services/return-reason"
|
||||
* operationId: "GetReturnReasons"
|
||||
* summary: "List Return Reasons"
|
||||
* description: "Retrieves a list of Return Reasons."
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -26,6 +26,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostReturnsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,6 +12,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* - (query) is_return {boolean} Whether return Shipping Options should be included. By default all Shipping Options are returned.
|
||||
* - (query) product_ids {string} A comma separated list of Product ids to filter Shipping Options by.
|
||||
* - (query) region_id {string} the Region to retrieve Shipping Options from.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetShippingOptionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -8,6 +8,8 @@ import ShippingProfileService from "../../../../services/shipping-profile"
|
||||
* description: "Retrieves a list of Shipping Options available to a cart."
|
||||
* parameters:
|
||||
* - (path) cart_id {string} The id of the Cart.
|
||||
* x-codegen:
|
||||
* method: listCartOptions
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -28,6 +28,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/StorePostSwapsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -7,6 +7,8 @@ import SwapService from "../../../../services/swap"
|
||||
* description: "Retrieves a Swap by the id of the Cart used to confirm the Swap."
|
||||
* parameters:
|
||||
* - (path) cart_id {string} The id of the Cart
|
||||
* x-codegen:
|
||||
* method: retrieveByCartId
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -28,6 +28,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: StoreGetVariantsVariantParams
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
@@ -56,7 +59,7 @@ import { validator } from "../../../../utils/validator"
|
||||
export default async (req, res) => {
|
||||
const { id } = req.params
|
||||
|
||||
const validated = await validator(PriceSelectionParams, req.query)
|
||||
const validated = await validator(StoreGetVariantsVariantParams, req.query)
|
||||
|
||||
const variantService: ProductVariantService = req.scope.resolve(
|
||||
"productVariantService"
|
||||
@@ -94,3 +97,5 @@ export default async (req, res) => {
|
||||
|
||||
res.json({ variant })
|
||||
}
|
||||
|
||||
export class StoreGetVariantsVariantParams extends PriceSelectionParams {}
|
||||
|
||||
@@ -25,6 +25,9 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* - (query) expand {string} A comma separated list of Product Variant relations to load.
|
||||
* - (query) offset=0 {number} How many product variants to skip in the result.
|
||||
* - (query) limit=100 {number} Maximum number of Product Variants to return.
|
||||
* - (query) cart_id {string} The id of the Cart to set prices based on.
|
||||
* - (query) region_id {string} The id of the Region to set prices based on.
|
||||
* - (query) currency_code {string} The currency code to use for price selection.
|
||||
* - in: query
|
||||
* name: title
|
||||
* style: form
|
||||
@@ -60,6 +63,9 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* gte:
|
||||
* type: number
|
||||
* description: filter by inventory quantity greater than or equal to this number
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: StoreGetVariantsParams
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
Reference in New Issue
Block a user