feat(oas): declare x-codegen on Admin routes - A to D (#3090)
### What Declare `x-codegen` in OAS for Admin routes - A to D. ### 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:
5
.changeset/good-rabbits-pay.md
Normal file
5
.changeset/good-rabbits-pay.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
feat(oas): declare x-codegen on Admin routes - A to D
|
||||
@@ -14,6 +14,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostAppsReq"
|
||||
* x-codegen:
|
||||
* method: authorize
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -6,6 +6,8 @@ import { OauthService } from "../../../../services"
|
||||
* summary: "List Applications"
|
||||
* description: "Retrieve a list of applications."
|
||||
* x-authenticated: true
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -21,6 +21,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostAuthReq"
|
||||
* x-codegen:
|
||||
* method: createSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* summary: "User Logout"
|
||||
* x-authenticated: true
|
||||
* description: "Deletes the current session for the logged in user."
|
||||
* x-codegen:
|
||||
* method: deleteSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -7,6 +7,8 @@ import _ from "lodash"
|
||||
* summary: "Get Current User"
|
||||
* x-authenticated: true
|
||||
* description: "Gets the currently logged in User."
|
||||
* x-codegen:
|
||||
* method: getSession
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the batch job.
|
||||
* x-codegen:
|
||||
* method: cancel
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the batch job.
|
||||
* x-codegen:
|
||||
* method: confirm
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostBatchesReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Batch Job
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -210,6 +210,9 @@ import { isDefined } from "medusa-core-utils"
|
||||
* type: string
|
||||
* description: filter by dates greater than or equal to this date
|
||||
* format: date
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetBatchParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostProductsToCollectionReq"
|
||||
* x-codegen:
|
||||
* method: addProducts
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -14,6 +14,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCollectionsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,8 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Collection.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,6 +11,8 @@ import { defaultAdminCollectionsRelations } from "."
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Product Collection
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -84,6 +84,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: AdminGetCollectionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -17,6 +17,8 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteProductsFromCollectionReq"
|
||||
* x-codegen:
|
||||
* method: removeProducts
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -16,6 +16,8 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCollectionsCollectionReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,9 @@ import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators
|
||||
* - (query) order {string} order to retrieve products in.
|
||||
* - (query) offset=0 {number} How many products to skip in the result.
|
||||
* - (query) limit=20 {number} Limit the number of products returned.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetCurrenciesParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,8 @@ import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/ta
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCurrenciesCurrencyReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,6 +20,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq"
|
||||
* x-codegen:
|
||||
* method: addCustomers
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -11,9 +11,13 @@ import { validator } from "../../../../utils/validator"
|
||||
* summary: "Create a Customer Group"
|
||||
* description: "Creates a CustomerGroup."
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (body) name=* {string} Name of the customer group
|
||||
* - (body) metadata {object} Metadata for the customer.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCustomerGroupsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -81,6 +85,19 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ customer_group: customerGroup })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCustomerGroupsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: Name of the customer group
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: Metadata for the customer.
|
||||
*/
|
||||
export class AdminPostCustomerGroupsReq {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@@ -11,6 +11,8 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Customer Group
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,6 +20,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq"
|
||||
* x-codegen:
|
||||
* method: removeCustomers
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Request, Response } from "express"
|
||||
|
||||
import CustomerController from "../../../../controllers/customers"
|
||||
import { IsNumber, IsOptional, IsString } from "class-validator"
|
||||
import { Type } from "class-transformer"
|
||||
|
||||
/**
|
||||
* @oas [get] /customer-groups/{id}/customers
|
||||
@@ -10,6 +12,13 @@ import CustomerController from "../../../../controllers/customers"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the customer group.
|
||||
* - (query) limit=50 {integer} The number of items to return.
|
||||
* - (query) offset=0 {integer} The items to skip before result.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer.
|
||||
* - (query) q {string} a search term to search email, first_name, and last_name.
|
||||
* x-codegen:
|
||||
* method: listCustomers
|
||||
* queryParams: AdminGetGroupsGroupCustomersParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -64,3 +73,25 @@ export default async (req: Request, res: Response) => {
|
||||
|
||||
res.json(result)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
export class AdminGetGroupsGroupCustomersParams {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
q?: string
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
limit = 50
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
offset = 0
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
expand?: string
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) id=* {string} The ID of the Customer Group.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in the customer group.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be included in the customer group.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* queryParams: AdminGetCustomerGroupsGroupParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -100,6 +100,9 @@ import { Type } from "class-transformer"
|
||||
* format: date
|
||||
* - (query) limit=10 {integer} Limit the number of customer groups returned.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer groups of the result.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetCustomerGroupsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -20,6 +20,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCustomerGroupsGroupReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -15,8 +15,8 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCustomersReq"
|
||||
* tags:
|
||||
* - Customer
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -48,6 +48,8 @@ import { EntityManager } from "typeorm"
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
* tags:
|
||||
* - Customer
|
||||
* responses:
|
||||
* 201:
|
||||
* description: OK
|
||||
|
||||
@@ -13,6 +13,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* - (path) id=* {string} The ID of the Customer.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in the customer.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be included in the customer.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,9 @@ import customerController from "../../../../controllers/customers"
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer.
|
||||
* - (query) q {string} a search term to search email, first_name, and last_name.
|
||||
* - (query) groups[] {string} group IDs to search customers by.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetCustomersParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -30,6 +30,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostCustomersCustomerReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -13,6 +13,8 @@ import { EntityManager } from "typeorm"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Discount.
|
||||
* - (path) region_id=* {string} The ID of the Region.
|
||||
* x-codegen:
|
||||
* method: addRegion
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -25,6 +25,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq"
|
||||
* x-codegen:
|
||||
* method: addConditionResourceBatch
|
||||
* queryParams: AdminPostDiscountsDiscountConditionsConditionBatchParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -23,6 +23,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountConditions"
|
||||
* x-codegen:
|
||||
* method: createCondition
|
||||
* queryParams: AdminPostDiscountsDiscountConditionsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -32,13 +32,16 @@ import { FindParams } from "../../../../types/common"
|
||||
* x-authenticated: true
|
||||
* description: "Creates a Discount with a given set of rules that define how the Discount behaves."
|
||||
* parameters:
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be retrieved in each customer.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in the results.
|
||||
* - (query) fields {string} (Comma separated) Which fields should be retrieved in the results.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* queryParams: AdminPostDiscountsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -19,9 +19,13 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Discount to create the dynamic code from."
|
||||
* - (body) code=* {string} The unique code that will be used to redeem the Discount.
|
||||
* - (body) usage_limit=1 {number} amount of times the discount can be applied.
|
||||
* - (body) metadata {object} An optional set of key-value paris to hold additional information.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountDynamicCodesReq"
|
||||
* x-codegen:
|
||||
* method: createDynamicCode
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -92,6 +96,23 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDiscountsDiscountDynamicCodesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: A unique code that will be used to redeem the Discount
|
||||
* usage_limit:
|
||||
* type: number
|
||||
* description: Maximum times the discount can be used
|
||||
* default: 1
|
||||
* metadata:
|
||||
* type: object
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
*/
|
||||
export class AdminPostDiscountsDiscountDynamicCodesReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -15,6 +15,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) condition_id=* {string} The ID of the DiscountCondition
|
||||
* - (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: deleteCondition
|
||||
* queryParams: AdminDeleteDiscountsDiscountConditionsConditionParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Discount
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,6 +12,8 @@ import { EntityManager } from "typeorm"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Discount
|
||||
* - (path) code=* {string} The ID of the Discount
|
||||
* x-codegen:
|
||||
* method: deleteDynamicCode
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -24,6 +24,8 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq"
|
||||
* x-codegen:
|
||||
* method: deleteConditionResourceBatch
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -13,6 +13,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) condition_id=* {string} The ID of the DiscountCondition.
|
||||
* - (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: getCondition
|
||||
* queryParams: AdminGetDiscountsDiscountConditionsConditionParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,6 +12,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) code=* {string} The code of the Discount
|
||||
* - (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: retrieveByCode
|
||||
* queryParams: AdminGetDiscountsDiscountCodeParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,6 +12,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* - (path) id=* {string} The ID of the Discount
|
||||
* - (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: AdminGetDiscountParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -39,6 +39,9 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean"
|
||||
* - (query) limit=20 {number} The number of items in the response
|
||||
* - (query) offset=0 {number} The offset of items in response
|
||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetDiscountsParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -12,6 +12,8 @@ import { EntityManager } from "typeorm"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Discount.
|
||||
* - (path) region_id=* {string} The ID of the Region.
|
||||
* x-codegen:
|
||||
* method: removeRegion
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -21,6 +21,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountConditionsCondition"
|
||||
* x-codegen:
|
||||
* method: updateCondition
|
||||
* queryParams: AdminPostDiscountsDiscountConditionsConditionParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,9 @@ import { FindParams } from "../../../../types/common"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* queryParams: AdminPostDiscountsDiscountParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -37,6 +37,8 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersReq"
|
||||
* x-codegen:
|
||||
* method: create
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -27,6 +27,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsReq"
|
||||
* x-codegen:
|
||||
* method: addLineItem
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -9,6 +9,8 @@ import { EntityManager } from "typeorm"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Draft Order.
|
||||
* x-codegen:
|
||||
* method: delete
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,6 +18,8 @@ import { MedusaError } from "medusa-core-utils"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Draft Order.
|
||||
* - (path) line_id=* {string} The ID of the Draft Order.
|
||||
* x-codegen:
|
||||
* method: removeLineItem
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -16,6 +16,8 @@ import { DraftOrder } from "../../../.."
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Draft Order.
|
||||
* x-codegen:
|
||||
* method: retrieve
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -21,6 +21,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* - (query) offset=0 {number} The number of items to skip before the results.
|
||||
* - (query) limit=50 {number} Limit the number of items returned.
|
||||
* - (query) q {string} a search term to search emails in carts associated with draft orders and display IDs of draft orders
|
||||
* x-codegen:
|
||||
* method: list
|
||||
* queryParams: AdminGetDraftOrdersParams
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -22,6 +22,8 @@ import { MedusaError } from "medusa-core-utils"
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {String} The Draft Order id.
|
||||
* x-codegen:
|
||||
* method: markPaid
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -33,6 +33,8 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersDraftOrderReq"
|
||||
* x-codegen:
|
||||
* method: update
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -26,6 +26,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsItemReq"
|
||||
* x-codegen:
|
||||
* method: updateLineItem
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
Reference in New Issue
Block a user