chore(oas): replace requestBody with $ref to req class JSDoc OAS (#2867)
### What Move inline OAS requestBody schema declaration under their respective class-validator classes in order to expose them through `#/components/schemas`. Replace inline OAS requestBody schema with a `$ref` reference pointing to the newly declared schema. ### Why Having requestBody declared as its own "named" schema will allow OAS code generators to output typed entities/DTO that can be manipulate without having to reference the route/operation. ### How Declare a new @schema JSDoc for each class-validator used to parse and validate request body. Move the current inline requestBody to the new @schema. ### Test - Ran OAS validator. - Ran docs build script. Expect no visible changes to the documentation. ### Out-of-scope requestBody of type `multipart/form-data` used for file uploads. These will be address as part of CORE-934 - [create-upload.ts](https://github.com/medusajs/medusa/blob/58d23a7b45b6dde8bdeed0bb268139a0017f1649/packages/medusa/src/api/routes/admin/uploads/create-upload.ts#L87-L90) - [create-protected-upload.ts](https://github.com/medusajs/medusa/blob/58d23a7b45b6dde8bdeed0bb268139a0017f1649/packages/medusa/src/api/routes/admin/uploads/create-protected-upload.ts#L87-L90) Path Parameter and Query Parameter. These will need more research and experimentation, part of CORE-931 --- Resolves CORE-853
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
chore(oas): replace requestBody with $ref to req class JSDoc OAS
|
||||
@@ -13,21 +13,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - application_name
|
||||
* - state
|
||||
* - code
|
||||
* properties:
|
||||
* application_name:
|
||||
* type: string
|
||||
* description: Name of the application for the token to be generated for.
|
||||
* state:
|
||||
* type: string
|
||||
* description: State of the application.
|
||||
* code:
|
||||
* type: string
|
||||
* description: The code for the generated token.
|
||||
* $ref: "#/components/schemas/AdminPostAppsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
@@ -79,6 +65,24 @@ export default async (req, res) => {
|
||||
res.status(200).json({ apps: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostAppsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - application_name
|
||||
* - state
|
||||
* - code
|
||||
* properties:
|
||||
* application_name:
|
||||
* type: string
|
||||
* description: Name of the application for the token to be generated for.
|
||||
* state:
|
||||
* type: string
|
||||
* description: State of the application.
|
||||
* code:
|
||||
* type: string
|
||||
* description: The code for the generated token.
|
||||
*/
|
||||
export class AdminPostAppsReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -20,19 +20,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The User's email.
|
||||
* format: email
|
||||
* password:
|
||||
* type: string
|
||||
* description: The User's password.
|
||||
* format: password
|
||||
* $ref: "#/components/schemas/AdminPostAuthReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -113,6 +101,22 @@ export default async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostAuthReq
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The User's email.
|
||||
* format: email
|
||||
* password:
|
||||
* type: string
|
||||
* description: The User's password.
|
||||
* format: password
|
||||
*/
|
||||
export class AdminPostAuthReq {
|
||||
@IsEmail()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -15,38 +15,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - context
|
||||
* properties:
|
||||
* type:
|
||||
* type: string
|
||||
* description: The type of batch job to start.
|
||||
* example: product-export
|
||||
* context:
|
||||
* type: object
|
||||
* description: Additional infomration regarding the batch to be used for processing.
|
||||
* example:
|
||||
* shape:
|
||||
* prices:
|
||||
* - region: null
|
||||
* currency_code: "eur"
|
||||
* dynamicImageColumnCount: 4
|
||||
* dynamicOptionColumnCount: 2
|
||||
* list_config:
|
||||
* skip: 0
|
||||
* take: 50
|
||||
* order:
|
||||
* created_at: "DESC"
|
||||
* relations:
|
||||
* - variants
|
||||
* - variant.prices
|
||||
* - images
|
||||
* dry_run:
|
||||
* type: boolean
|
||||
* description: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications.
|
||||
* default: false
|
||||
* $ref: "#/components/schemas/AdminPostBatchesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -120,6 +89,41 @@ export default async (req, res) => {
|
||||
res.status(201).json({ batch_job })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostBatchesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - context
|
||||
* properties:
|
||||
* type:
|
||||
* type: string
|
||||
* description: The type of batch job to start.
|
||||
* example: product-export
|
||||
* context:
|
||||
* type: object
|
||||
* description: Additional infomration regarding the batch to be used for processing.
|
||||
* example:
|
||||
* shape:
|
||||
* prices:
|
||||
* - region: null
|
||||
* currency_code: "eur"
|
||||
* dynamicImageColumnCount: 4
|
||||
* dynamicOptionColumnCount: 2
|
||||
* list_config:
|
||||
* skip: 0
|
||||
* take: 50
|
||||
* order:
|
||||
* created_at: "DESC"
|
||||
* relations:
|
||||
* - variants
|
||||
* - variant.prices
|
||||
* - images
|
||||
* dry_run:
|
||||
* type: boolean
|
||||
* description: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications.
|
||||
* default: false
|
||||
*/
|
||||
export class AdminPostBatchesReq {
|
||||
@IsString()
|
||||
type: string
|
||||
|
||||
@@ -16,16 +16,7 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: "An array of Product IDs to add to the Product Collection."
|
||||
* type: array
|
||||
* items:
|
||||
* description: "The ID of a Product to add to the Product Collection."
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostProductsToCollectionReq"
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
@@ -86,6 +77,19 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ collection })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsToCollectionReq
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: "An array of Product IDs to add to the Product Collection."
|
||||
* type: array
|
||||
* items:
|
||||
* description: "The ID of a Product to add to the Product Collection."
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostProductsToCollectionReq {
|
||||
@ArrayNotEmpty()
|
||||
@IsString({ each: true })
|
||||
|
||||
@@ -13,19 +13,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* type: string
|
||||
* description: The title to identify the Collection by.
|
||||
* handle:
|
||||
* type: string
|
||||
* description: An optional handle to be used in slugs, if none is provided we will kebab-case the title.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostCollectionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -95,6 +83,22 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ collection })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCollectionsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* type: string
|
||||
* description: The title to identify the Collection by.
|
||||
* handle:
|
||||
* type: string
|
||||
* description: An optional handle to be used in slugs, if none is provided we will kebab-case the title.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostCollectionsReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -16,16 +16,7 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: "An array of Product IDs to remove from the Product Collection."
|
||||
* type: array
|
||||
* items:
|
||||
* description: "The ID of a Product to add to the Product Collection."
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteProductsFromCollectionReq"
|
||||
* x-codeSamples:
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
@@ -101,6 +92,19 @@ export default async (req: Request, res: Response) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteProductsFromCollectionReq
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: "An array of Product IDs to remove from the Product Collection."
|
||||
* type: array
|
||||
* items:
|
||||
* description: "The ID of a Product to add to the Product Collection."
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteProductsFromCollectionReq {
|
||||
@ArrayNotEmpty()
|
||||
@IsString({ each: true })
|
||||
|
||||
@@ -15,17 +15,7 @@ import ProductCollectionService from "../../../../services/product-collection"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* title:
|
||||
* type: string
|
||||
* description: The title to identify the Collection by.
|
||||
* handle:
|
||||
* type: string
|
||||
* description: An optional handle to be used in slugs, if none is provided we will kebab-case the title.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostCollectionsCollectionReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -98,6 +88,20 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ collection })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCollectionsCollectionReq
|
||||
* type: object
|
||||
* properties:
|
||||
* title:
|
||||
* type: string
|
||||
* description: The title to identify the Collection by.
|
||||
* handle:
|
||||
* type: string
|
||||
* description: An optional handle to be used in slugs, if none is provided we will kebab-case the title.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostCollectionsCollectionReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -17,11 +17,7 @@ import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/ta
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* includes_tax:
|
||||
* type: boolean
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of currency."
|
||||
* $ref: "#/components/schemas/AdminPostCurrenciesCurrencyReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -67,6 +63,14 @@ export default async (req: ExtendedRequest<Currency>, res) => {
|
||||
res.json({ currency })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCurrenciesCurrencyReq
|
||||
* type: object
|
||||
* properties:
|
||||
* includes_tax:
|
||||
* type: boolean
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of currency."
|
||||
*/
|
||||
export class AdminPostCurrenciesCurrencyReq {
|
||||
@FeatureFlagDecorators(TaxInclusivePricingFeatureFlag.key, [
|
||||
IsOptional(),
|
||||
|
||||
@@ -19,20 +19,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - customer_ids
|
||||
* properties:
|
||||
* customer_ids:
|
||||
* description: "The ids of the customers to add"
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: ID of the customer
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -118,6 +105,23 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ customer_group })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCustomerGroupsGroupCustomersBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - customer_ids
|
||||
* properties:
|
||||
* customer_ids:
|
||||
* description: "The ids of the customers to add"
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: ID of the customer
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostCustomerGroupsGroupCustomersBatchReq {
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CustomerGroupsBatchCustomer)
|
||||
|
||||
@@ -19,20 +19,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - customer_ids
|
||||
* properties:
|
||||
* customer_ids:
|
||||
* description: "The ids of the customers to remove"
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: ID of the customer
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -118,6 +105,23 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ customer_group })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteCustomerGroupsGroupCustomerBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - customer_ids
|
||||
* properties:
|
||||
* customer_ids:
|
||||
* description: "The ids of the customers to remove"
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: ID of the customer
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteCustomerGroupsGroupCustomerBatchReq {
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CustomerGroupsBatchCustomer)
|
||||
|
||||
@@ -19,14 +19,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "Name of the customer group"
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: "Metadata for the customer."
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostCustomerGroupsGroupReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -114,6 +107,17 @@ export default async (req: Request, res: Response) => {
|
||||
res.json({ customer_group: customerGroup })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCustomerGroupsGroupReq
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "Name of the customer group"
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: "Metadata for the customer."
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostCustomerGroupsGroupReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -14,33 +14,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The customer's email.
|
||||
* format: email
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: The customer's first name.
|
||||
* last_name:
|
||||
* type: string
|
||||
* description: The customer's last name.
|
||||
* password:
|
||||
* type: string
|
||||
* description: The customer's password.
|
||||
* format: password
|
||||
* phone:
|
||||
* type: string
|
||||
* description: The customer's phone number.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostCustomersReq"
|
||||
* tags:
|
||||
* - Customer
|
||||
* x-codeSamples:
|
||||
@@ -110,6 +84,36 @@ export default async (req, res) => {
|
||||
res.status(201).json({ customer })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCustomersReq
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The customer's email.
|
||||
* format: email
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: The customer's first name.
|
||||
* last_name:
|
||||
* type: string
|
||||
* description: The customer's last name.
|
||||
* password:
|
||||
* type: string
|
||||
* description: The customer's password.
|
||||
* format: password
|
||||
* phone:
|
||||
* type: string
|
||||
* description: The customer's phone number.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostCustomersReq {
|
||||
@IsEmail()
|
||||
email: string
|
||||
|
||||
@@ -29,38 +29,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The Customer's email.
|
||||
* format: email
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: The Customer's first name.
|
||||
* last_name:
|
||||
* type: string
|
||||
* description: The Customer's last name.
|
||||
* phone:
|
||||
* type: string
|
||||
* description: The Customer's phone number.
|
||||
* password:
|
||||
* type: string
|
||||
* description: The Customer's password.
|
||||
* format: password
|
||||
* groups:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a customer group
|
||||
* type: string
|
||||
* description: A list of customer groups to which the customer belongs.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostCustomersCustomerReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -156,6 +125,41 @@ class Group {
|
||||
id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostCustomersCustomerReq
|
||||
* type: object
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The Customer's email.
|
||||
* format: email
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: The Customer's first name.
|
||||
* last_name:
|
||||
* type: string
|
||||
* description: The Customer's last name.
|
||||
* phone:
|
||||
* type: string
|
||||
* description: The Customer's phone number.
|
||||
* password:
|
||||
* type: string
|
||||
* description: The Customer's password.
|
||||
* format: password
|
||||
* groups:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a customer group
|
||||
* type: string
|
||||
* description: A list of customer groups to which the customer belongs.
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostCustomersCustomerReq {
|
||||
@IsEmail()
|
||||
@IsOptional()
|
||||
|
||||
+19
-14
@@ -24,20 +24,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - resources
|
||||
* properties:
|
||||
* resources:
|
||||
* description: The resources to be added to the discount condition
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The id of the item
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -124,9 +111,27 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDiscountsDiscountConditionsConditionBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - resources
|
||||
* properties:
|
||||
* resources:
|
||||
* description: The resources to be added to the discount condition
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The id of the item
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostDiscountsDiscountConditionsConditionBatchReq {
|
||||
@IsArray()
|
||||
resources: { id: string }[]
|
||||
}
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
export class AdminPostDiscountsDiscountConditionsConditionBatchParams extends FindParams {}
|
||||
|
||||
@@ -22,39 +22,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - operator
|
||||
* properties:
|
||||
* operator:
|
||||
* description: Operator of the condition
|
||||
* type: string
|
||||
* enum: [in, not_in]
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountConditions"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -130,6 +98,42 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDiscountsDiscountConditions
|
||||
* type: object
|
||||
* required:
|
||||
* - operator
|
||||
* properties:
|
||||
* operator:
|
||||
* description: Operator of the condition
|
||||
* type: string
|
||||
* enum: [in, not_in]
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
// eslint-disable-next-line max-len
|
||||
export class AdminPostDiscountsDiscountConditions extends AdminUpsertConditionsReq {
|
||||
@IsString()
|
||||
|
||||
@@ -38,105 +38,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* - rule
|
||||
* - regions
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: A unique code that will be used to redeem the Discount
|
||||
* is_dynamic:
|
||||
* type: boolean
|
||||
* description: Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules.
|
||||
* default: false
|
||||
* rule:
|
||||
* description: The Discount Rule that defines how Discounts are calculated
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - value
|
||||
* - allocation
|
||||
* properties:
|
||||
* description:
|
||||
* type: string
|
||||
* description: "A short description of the discount"
|
||||
* type:
|
||||
* type: string
|
||||
* description: "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers."
|
||||
* enum: [fixed, percentage, free_shipping]
|
||||
* value:
|
||||
* type: number
|
||||
* description: "The value that the discount represents; this will depend on the type of the discount"
|
||||
* allocation:
|
||||
* type: string
|
||||
* description: "The scope that the discount should apply to."
|
||||
* enum: [total, item]
|
||||
* conditions:
|
||||
* type: array
|
||||
* description: "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided."
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - operator
|
||||
* properties:
|
||||
* operator:
|
||||
* type: string
|
||||
* description: Operator of the condition
|
||||
* enum: [in, not_in]
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* default: false
|
||||
* starts_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should be available.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should no longer be available.
|
||||
* valid_duration:
|
||||
* type: string
|
||||
* description: Duration the discount runs between
|
||||
* example: P3Y6M4DT12H30M5S
|
||||
* regions:
|
||||
* description: A list of Region ids representing the Regions in which the Discount can be used.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* usage_limit:
|
||||
* type: number
|
||||
* description: Maximum times the discount can be used
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -221,6 +123,108 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDiscountsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* - rule
|
||||
* - regions
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: A unique code that will be used to redeem the Discount
|
||||
* is_dynamic:
|
||||
* type: boolean
|
||||
* description: Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules.
|
||||
* default: false
|
||||
* rule:
|
||||
* description: The Discount Rule that defines how Discounts are calculated
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - value
|
||||
* - allocation
|
||||
* properties:
|
||||
* description:
|
||||
* type: string
|
||||
* description: "A short description of the discount"
|
||||
* type:
|
||||
* type: string
|
||||
* description: "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers."
|
||||
* enum: [fixed, percentage, free_shipping]
|
||||
* value:
|
||||
* type: number
|
||||
* description: "The value that the discount represents; this will depend on the type of the discount"
|
||||
* allocation:
|
||||
* type: string
|
||||
* description: "The scope that the discount should apply to."
|
||||
* enum: [total, item]
|
||||
* conditions:
|
||||
* type: array
|
||||
* description: "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided."
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - operator
|
||||
* properties:
|
||||
* operator:
|
||||
* type: string
|
||||
* description: Operator of the condition
|
||||
* enum: [in, not_in]
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* default: false
|
||||
* starts_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should be available.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should no longer be available.
|
||||
* valid_duration:
|
||||
* type: string
|
||||
* description: Duration the discount runs between
|
||||
* example: P3Y6M4DT12H30M5S
|
||||
* regions:
|
||||
* description: A list of Region ids representing the Regions in which the Discount can be used.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* usage_limit:
|
||||
* type: number
|
||||
* description: Maximum times the discount can be used
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostDiscountsReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
+19
-14
@@ -23,20 +23,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - resources
|
||||
* properties:
|
||||
* resources:
|
||||
* description: The resources to be deleted from the discount condition
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The id of the item
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -123,8 +110,26 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
export class AdminDeleteDiscountsDiscountConditionsConditionBatchParams extends FindParams {}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteDiscountsDiscountConditionsConditionBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - resources
|
||||
* properties:
|
||||
* resources:
|
||||
* description: The resources to be deleted from the discount condition
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The id of the item
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteDiscountsDiscountConditionsConditionBatchReq {
|
||||
@IsArray()
|
||||
resources: { id: string }[]
|
||||
|
||||
@@ -20,33 +20,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountConditionsCondition"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -133,7 +107,38 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDiscountsDiscountConditionsCondition
|
||||
* type: object
|
||||
* properties:
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
// eslint-disable-next-line max-len
|
||||
export class AdminPostDiscountsDiscountConditionsCondition extends AdminUpsertConditionsReq {}
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
export class AdminPostDiscountsDiscountConditionsConditionParams extends FindParams {}
|
||||
|
||||
@@ -36,96 +36,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: A unique code that will be used to redeem the Discount
|
||||
* rule:
|
||||
* description: The Discount Rule that defines how Discounts are calculated
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: "The ID of the Rule"
|
||||
* description:
|
||||
* type: string
|
||||
* description: "A short description of the discount"
|
||||
* value:
|
||||
* type: number
|
||||
* description: "The value that the discount represents; this will depend on the type of the discount"
|
||||
* allocation:
|
||||
* type: string
|
||||
* description: "The scope that the discount should apply to."
|
||||
* enum: [total, item]
|
||||
* conditions:
|
||||
* type: array
|
||||
* description: "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided."
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - operator
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: "The ID of the Rule"
|
||||
* operator:
|
||||
* type: string
|
||||
* description: Operator of the condition
|
||||
* enum: [in, not_in]
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* starts_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should be available.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should no longer be available.
|
||||
* valid_duration:
|
||||
* type: string
|
||||
* description: Duration the discount runs between
|
||||
* example: P3Y6M4DT12H30M5S
|
||||
* usage_limit:
|
||||
* type: number
|
||||
* description: Maximum times the discount can be used
|
||||
* regions:
|
||||
* description: A list of Region ids representing the Regions in which the Discount can be used.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An object containing metadata of the discount
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostDiscountsDiscountReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -196,6 +107,99 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ discount })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDiscountsDiscountReq
|
||||
* type: object
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: A unique code that will be used to redeem the Discount
|
||||
* rule:
|
||||
* description: The Discount Rule that defines how Discounts are calculated
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: "The ID of the Rule"
|
||||
* description:
|
||||
* type: string
|
||||
* description: "A short description of the discount"
|
||||
* value:
|
||||
* type: number
|
||||
* description: "The value that the discount represents; this will depend on the type of the discount"
|
||||
* allocation:
|
||||
* type: string
|
||||
* description: "The scope that the discount should apply to."
|
||||
* enum: [total, item]
|
||||
* conditions:
|
||||
* type: array
|
||||
* description: "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided."
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - operator
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: "The ID of the Rule"
|
||||
* operator:
|
||||
* type: string
|
||||
* description: Operator of the condition
|
||||
* enum: [in, not_in]
|
||||
* products:
|
||||
* type: array
|
||||
* description: list of product IDs if the condition is applied on products.
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: list of product type IDs if the condition is applied on product types.
|
||||
* items:
|
||||
* type: string
|
||||
* product_collections:
|
||||
* type: array
|
||||
* description: list of product collection IDs if the condition is applied on product collections.
|
||||
* items:
|
||||
* type: string
|
||||
* product_tags:
|
||||
* type: array
|
||||
* description: list of product tag IDs if the condition is applied on product tags.
|
||||
* items:
|
||||
* type: string
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||
* items:
|
||||
* type: string
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* starts_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should be available.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Discount should no longer be available.
|
||||
* valid_duration:
|
||||
* type: string
|
||||
* description: Duration the discount runs between
|
||||
* example: P3Y6M4DT12H30M5S
|
||||
* usage_limit:
|
||||
* type: number
|
||||
* description: Maximum times the discount can be used
|
||||
* regions:
|
||||
* description: A list of Region ids representing the Regions in which the Discount can be used.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An object containing metadata of the discount
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostDiscountsDiscountReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -36,93 +36,7 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - region_id
|
||||
* - shipping_methods
|
||||
* properties:
|
||||
* status:
|
||||
* description: "The status of the draft order"
|
||||
* type: string
|
||||
* enum: [open, completed]
|
||||
* email:
|
||||
* description: "The email of the customer of the draft order"
|
||||
* type: string
|
||||
* format: email
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* items:
|
||||
* description: The Line Items that have been received.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to generate the Line Item from.
|
||||
* type: string
|
||||
* unit_price:
|
||||
* description: The potential custom price of the item.
|
||||
* type: integer
|
||||
* title:
|
||||
* description: The potential custom title of the item.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Line Item.
|
||||
* type: object
|
||||
* region_id:
|
||||
* description: The ID of the region for the draft order
|
||||
* type: string
|
||||
* discounts:
|
||||
* description: The discounts to add on the draft order
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: The code of the discount to apply
|
||||
* type: string
|
||||
* customer_id:
|
||||
* description: The ID of the customer to add on the draft order
|
||||
* type: string
|
||||
* no_notification_order:
|
||||
* description: An optional flag passed to the resulting order to determine use of notifications.
|
||||
* type: boolean
|
||||
* shipping_methods:
|
||||
* description: The shipping methods for the draft order
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the shipping option in use
|
||||
* type: string
|
||||
* data:
|
||||
* description: The optional additional data needed for the shipping method
|
||||
* type: object
|
||||
* price:
|
||||
* description: The potential custom price of the shipping
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Draft Order.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -249,6 +163,96 @@ enum Status {
|
||||
completed = "completed",
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDraftOrdersReq
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - region_id
|
||||
* - shipping_methods
|
||||
* properties:
|
||||
* status:
|
||||
* description: "The status of the draft order"
|
||||
* type: string
|
||||
* enum: [open, completed]
|
||||
* email:
|
||||
* description: "The email of the customer of the draft order"
|
||||
* type: string
|
||||
* format: email
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* items:
|
||||
* description: The Line Items that have been received.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to generate the Line Item from.
|
||||
* type: string
|
||||
* unit_price:
|
||||
* description: The potential custom price of the item.
|
||||
* type: integer
|
||||
* title:
|
||||
* description: The potential custom title of the item.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Line Item.
|
||||
* type: object
|
||||
* region_id:
|
||||
* description: The ID of the region for the draft order
|
||||
* type: string
|
||||
* discounts:
|
||||
* description: The discounts to add on the draft order
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: The code of the discount to apply
|
||||
* type: string
|
||||
* customer_id:
|
||||
* description: The ID of the customer to add on the draft order
|
||||
* type: string
|
||||
* no_notification_order:
|
||||
* description: An optional flag passed to the resulting order to determine use of notifications.
|
||||
* type: boolean
|
||||
* shipping_methods:
|
||||
* description: The shipping methods for the draft order
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the shipping option in use
|
||||
* type: string
|
||||
* data:
|
||||
* description: The optional additional data needed for the shipping method
|
||||
* type: object
|
||||
* price:
|
||||
* description: The potential custom price of the shipping
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Draft Order.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostDraftOrdersReq {
|
||||
@IsEnum(Status)
|
||||
@IsOptional()
|
||||
|
||||
@@ -26,26 +26,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to generate the Line Item from.
|
||||
* type: string
|
||||
* unit_price:
|
||||
* description: The potential custom price of the item.
|
||||
* type: integer
|
||||
* title:
|
||||
* description: The potential custom title of the item.
|
||||
* type: string
|
||||
* default: "Custom item"
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Line Item.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -162,6 +143,29 @@ export default async (req, res) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDraftOrdersDraftOrderLineItemsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to generate the Line Item from.
|
||||
* type: string
|
||||
* unit_price:
|
||||
* description: The potential custom price of the item.
|
||||
* type: integer
|
||||
* title:
|
||||
* description: The potential custom title of the item.
|
||||
* type: string
|
||||
* default: "Custom item"
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Line Item.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostDraftOrdersDraftOrderLineItemsReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -32,48 +32,7 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: The ID of the Region to create the Draft Order in.
|
||||
* country_code:
|
||||
* type: string
|
||||
* description: "The 2 character ISO code for the Country."
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* email:
|
||||
* type: string
|
||||
* description: "An email to be used on the Draft Order."
|
||||
* format: email
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* discounts:
|
||||
* description: "An array of Discount codes to add to the Draft Order."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: "The code that a Discount is identifed by."
|
||||
* type: string
|
||||
* no_notification_order:
|
||||
* description: "An optional flag passed to the resulting order to determine use of notifications."
|
||||
* type: boolean
|
||||
* customer_id:
|
||||
* description: "The ID of the Customer to associate the Draft Order with."
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersDraftOrderReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -182,6 +141,51 @@ export default async (req, res) => {
|
||||
res.status(200).json({ draft_order: draftOrder })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDraftOrdersDraftOrderReq
|
||||
* type: object
|
||||
* properties:
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: The ID of the Region to create the Draft Order in.
|
||||
* country_code:
|
||||
* type: string
|
||||
* description: "The 2 character ISO code for the Country."
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* email:
|
||||
* type: string
|
||||
* description: "An email to be used on the Draft Order."
|
||||
* format: email
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: string
|
||||
* discounts:
|
||||
* description: "An array of Discount codes to add to the Draft Order."
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: "The code that a Discount is identifed by."
|
||||
* type: string
|
||||
* no_notification_order:
|
||||
* description: "An optional flag passed to the resulting order to determine use of notifications."
|
||||
* type: boolean
|
||||
* customer_id:
|
||||
* description: "The ID of the Customer to associate the Draft Order with."
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostDraftOrdersDraftOrderReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -25,20 +25,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* unit_price:
|
||||
* description: The potential custom price of the item.
|
||||
* type: integer
|
||||
* title:
|
||||
* description: The potential custom title of the item.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Line Item.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsItemReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -157,6 +144,23 @@ export default async (req, res) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostDraftOrdersDraftOrderLineItemsItemReq
|
||||
* type: object
|
||||
* properties:
|
||||
* unit_price:
|
||||
* description: The potential custom price of the item.
|
||||
* type: integer
|
||||
* title:
|
||||
* description: The potential custom title of the item.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* metadata:
|
||||
* description: The optional key-value map with additional details about the Line Item.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostDraftOrdersDraftOrderLineItemsItemReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -15,26 +15,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - region_id
|
||||
* properties:
|
||||
* value:
|
||||
* type: integer
|
||||
* description: The value (excluding VAT) that the Gift Card should represent.
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Gift Card is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Gift Card should no longer be available.
|
||||
* region_id:
|
||||
* description: The ID of the Region in which the Gift Card can be used.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostGiftCardsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -103,6 +84,29 @@ export default async (req, res) => {
|
||||
res.status(200).json({ gift_card: giftCard })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostGiftCardsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - region_id
|
||||
* properties:
|
||||
* value:
|
||||
* type: integer
|
||||
* description: The value (excluding VAT) that the Gift Card should represent.
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Gift Card is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Gift Card should no longer be available.
|
||||
* region_id:
|
||||
* description: The ID of the Region in which the Gift Card can be used.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostGiftCardsReq {
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
|
||||
@@ -18,24 +18,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* balance:
|
||||
* type: integer
|
||||
* description: The value (excluding VAT) that the Gift Card should represent.
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Gift Card is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Gift Card should no longer be available.
|
||||
* region_id:
|
||||
* description: The ID of the Region in which the Gift Card can be used.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostGiftCardsGiftCardReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -108,6 +91,27 @@ export default async (req, res) => {
|
||||
res.status(200).json({ gift_card: giftCard })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostGiftCardsGiftCardReq
|
||||
* type: object
|
||||
* properties:
|
||||
* balance:
|
||||
* type: integer
|
||||
* description: The value (excluding VAT) that the Gift Card should represent.
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Whether the Gift Card is disabled on creation. You will have to enable it later to make it available to Customers.
|
||||
* ends_at:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: The time at which the Gift Card should no longer be available.
|
||||
* region_id:
|
||||
* description: The ID of the Region in which the Gift Card can be used.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostGiftCardsGiftCardReq {
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
|
||||
@@ -14,32 +14,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - token
|
||||
* - user
|
||||
* properties:
|
||||
* token:
|
||||
* description: "The invite token provided by the admin."
|
||||
* type: string
|
||||
* user:
|
||||
* description: "The User to create."
|
||||
* type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - password
|
||||
* properties:
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: the first name of the User
|
||||
* last_name:
|
||||
* type: string
|
||||
* description: the last name of the User
|
||||
* password:
|
||||
* description: The desired password for the User
|
||||
* type: string
|
||||
* format: password
|
||||
* $ref: "#/components/schemas/AdminPostInvitesInviteAcceptReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -122,6 +97,35 @@ export class AdminPostInvitesInviteAcceptUserReq {
|
||||
password: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostInvitesInviteAcceptReq
|
||||
* type: object
|
||||
* required:
|
||||
* - token
|
||||
* - user
|
||||
* properties:
|
||||
* token:
|
||||
* description: "The invite token provided by the admin."
|
||||
* type: string
|
||||
* user:
|
||||
* description: "The User to create."
|
||||
* type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - password
|
||||
* properties:
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: the first name of the User
|
||||
* last_name:
|
||||
* type: string
|
||||
* description: the last name of the User
|
||||
* password:
|
||||
* description: The desired password for the User
|
||||
* type: string
|
||||
* format: password
|
||||
*/
|
||||
export class AdminPostInvitesInviteAcceptReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -15,19 +15,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - user
|
||||
* - role
|
||||
* properties:
|
||||
* user:
|
||||
* description: "The email for the user to be created."
|
||||
* type: string
|
||||
* format: email
|
||||
* role:
|
||||
* description: "The role of the user to be created."
|
||||
* type: string
|
||||
* enum: [admin, member, developer]
|
||||
* $ref: "#/components/schemas/AdminPostInvitesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -90,6 +78,23 @@ export default async (req, res) => {
|
||||
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostInvitesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - user
|
||||
* - role
|
||||
* properties:
|
||||
* user:
|
||||
* description: "The email for the user to be created."
|
||||
* type: string
|
||||
* format: email
|
||||
* role:
|
||||
* description: "The role of the user to be created."
|
||||
* type: string
|
||||
* enum: [admin, member, developer]
|
||||
*/
|
||||
export class AdminPostInvitesReq {
|
||||
@IsEmail()
|
||||
user: string
|
||||
|
||||
@@ -14,21 +14,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - resource_id
|
||||
* - resource_type
|
||||
* - value
|
||||
* properties:
|
||||
* resource_id:
|
||||
* type: string
|
||||
* description: The ID of the resource which the Note relates to.
|
||||
* resource_type:
|
||||
* type: string
|
||||
* description: The type of resource which the Note relates to.
|
||||
* value:
|
||||
* type: string
|
||||
* description: The content of the Note to create.
|
||||
* $ref: "#/components/schemas/AdminPostNotesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -104,6 +90,24 @@ export default async (req, res) => {
|
||||
res.status(200).json({ note: result })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostNotesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - resource_id
|
||||
* - resource_type
|
||||
* - value
|
||||
* properties:
|
||||
* resource_id:
|
||||
* type: string
|
||||
* description: The ID of the resource which the Note relates to.
|
||||
* resource_type:
|
||||
* type: string
|
||||
* description: The type of resource which the Note relates to.
|
||||
* value:
|
||||
* type: string
|
||||
* description: The content of the Note to create.
|
||||
*/
|
||||
export class AdminPostNotesReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -15,13 +15,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* value:
|
||||
* type: string
|
||||
* description: The updated description of the Note.
|
||||
* $ref: "#/components/schemas/AdminPostNotesNoteReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -88,6 +82,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ note })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostNotesNoteReq
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* value:
|
||||
* type: string
|
||||
* description: The updated description of the Note.
|
||||
*/
|
||||
export class AdminPostNotesNoteReq {
|
||||
@IsString()
|
||||
value: string
|
||||
|
||||
@@ -21,11 +21,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* to:
|
||||
* description: "A new address or user identifier that the Notification should be sent to"
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostNotificationsNotificationResendReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -103,6 +99,14 @@ export default async (req, res) => {
|
||||
res.json({ notification })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostNotificationsNotificationResendReq
|
||||
* type: object
|
||||
* properties:
|
||||
* to:
|
||||
* description: "A new address or user identifier that the Notification should be sent to"
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostNotificationsNotificationResendReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -19,20 +19,7 @@ import {
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the variant ID to add
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity to add
|
||||
* type: number
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostOrderEditsEditLineItemsReq"
|
||||
* x-authenticated: true
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
@@ -112,6 +99,23 @@ export default async (req: Request, res: Response) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrderEditsEditLineItemsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the variant ID to add
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity to add
|
||||
* type: number
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostOrderEditsEditLineItemsReq {
|
||||
@IsString()
|
||||
variant_id: string
|
||||
|
||||
@@ -16,16 +16,7 @@ import {
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - order_id
|
||||
* properties:
|
||||
* order_id:
|
||||
* description: The ID of the order to create the edit for.
|
||||
* type: string
|
||||
* internal_note:
|
||||
* description: An optional note to create for the order edit.
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostOrderEditsReq"
|
||||
* x-authenticated: true
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
@@ -99,6 +90,19 @@ export default async (req: Request, res: Response) => {
|
||||
return res.json({ order_edit: orderEdit })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrderEditsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - order_id
|
||||
* properties:
|
||||
* order_id:
|
||||
* description: The ID of the order to create the edit for.
|
||||
* type: string
|
||||
* internal_note:
|
||||
* description: An optional note to create for the order edit.
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostOrderEditsReq {
|
||||
@IsString()
|
||||
order_id: string
|
||||
|
||||
@@ -20,13 +20,7 @@ import {
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* quantity:
|
||||
* description: The quantity to update
|
||||
* type: number
|
||||
* $ref: "#/components/schemas/AdminPostOrderEditsEditLineItemsLineItemReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -103,6 +97,16 @@ export default async (req: Request, res: Response) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrderEditsEditLineItemsLineItemReq
|
||||
* type: object
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* quantity:
|
||||
* description: The quantity to update
|
||||
* type: number
|
||||
*/
|
||||
export class AdminPostOrderEditsEditLineItemsLineItemReq {
|
||||
@IsNumber()
|
||||
quantity: number
|
||||
|
||||
@@ -20,11 +20,7 @@ import {
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* internal_note:
|
||||
* description: An optional note to create or update for the order edit.
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostOrderEditsOrderEditReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -103,6 +99,14 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ order_edit: orderEdit })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrderEditsOrderEditReq
|
||||
* type: object
|
||||
* properties:
|
||||
* internal_note:
|
||||
* description: An optional note to create or update for the order edit.
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostOrderEditsOrderEditReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -18,18 +18,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - fulfillment_id
|
||||
* properties:
|
||||
* fulfillment_id:
|
||||
* description: The ID of the Fulfillment.
|
||||
* type: string
|
||||
* tracking_numbers:
|
||||
* description: The tracking numbers for the shipment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderClaimsClaimShipmentsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -110,6 +99,21 @@ export default async (req, res) => {
|
||||
res.json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderClaimsClaimShipmentsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - fulfillment_id
|
||||
* properties:
|
||||
* fulfillment_id:
|
||||
* description: The ID of the Fulfillment.
|
||||
* type: string
|
||||
* tracking_numbers:
|
||||
* description: The tracking numbers for the shipment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostOrdersOrderClaimsClaimShipmentsReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -31,102 +31,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - claim_items
|
||||
* properties:
|
||||
* type:
|
||||
* description: "The type of the Claim. This will determine how the Claim is treated: `replace` Claims will result in a Fulfillment with new items being created, while a `refund` Claim will refund the amount paid for the claimed items."
|
||||
* type: string
|
||||
* enum:
|
||||
* - replace
|
||||
* - refund
|
||||
* claim_items:
|
||||
* description: The Claim Items that the Claim will consist of.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item that will be claimed.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The number of items that will be returned
|
||||
* type: integer
|
||||
* note:
|
||||
* description: Short text describing the Claim Item in further detail.
|
||||
* type: string
|
||||
* reason:
|
||||
* description: The reason for the Claim
|
||||
* type: string
|
||||
* enum:
|
||||
* - missing_item
|
||||
* - wrong_item
|
||||
* - production_failure
|
||||
* - other
|
||||
* tags:
|
||||
* description: A list o tags to add to the Claim Item
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* images:
|
||||
* description: A list of image URL's that will be associated with the Claim
|
||||
* items:
|
||||
* type: string
|
||||
* return_shipping:
|
||||
* description: Optional details for the Return Shipping Method, if the items are to be sent back.
|
||||
* type: object
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: The ID of the Shipping Option to create the Shipping Method from.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price to charge for the Shipping Method.
|
||||
* additional_items:
|
||||
* description: The new items to send to the Customer when the Claim type is Replace.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to ship.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Product Variant to ship.
|
||||
* type: integer
|
||||
* shipping_methods:
|
||||
* description: The Shipping Methods to send the additional Line Items with.
|
||||
* type: array
|
||||
* items:
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Shipping Method
|
||||
* type: string
|
||||
* option_id:
|
||||
* description: The ID of the Shipping Option to create a Shipping Method from
|
||||
* type: string
|
||||
* price:
|
||||
* description: The price to charge for the Shipping Method
|
||||
* type: integer
|
||||
* shipping_address:
|
||||
* type: object
|
||||
* description: "An optional shipping address to send the claim to. Defaults to the parent order's shipping address"
|
||||
* $ref: "#/components/schemas/Address"
|
||||
* refund_amount:
|
||||
* description: The amount to refund the Customer when the Claim type is `refund`.
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Claim.
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderClaimsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -394,6 +299,105 @@ export default async (req, res) => {
|
||||
res.status(idempotencyKey.response_code).json(idempotencyKey.response_body)
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderClaimsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - type
|
||||
* - claim_items
|
||||
* properties:
|
||||
* type:
|
||||
* description: "The type of the Claim. This will determine how the Claim is treated: `replace` Claims will result in a Fulfillment with new items being created, while a `refund` Claim will refund the amount paid for the claimed items."
|
||||
* type: string
|
||||
* enum:
|
||||
* - replace
|
||||
* - refund
|
||||
* claim_items:
|
||||
* description: The Claim Items that the Claim will consist of.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item that will be claimed.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The number of items that will be returned
|
||||
* type: integer
|
||||
* note:
|
||||
* description: Short text describing the Claim Item in further detail.
|
||||
* type: string
|
||||
* reason:
|
||||
* description: The reason for the Claim
|
||||
* type: string
|
||||
* enum:
|
||||
* - missing_item
|
||||
* - wrong_item
|
||||
* - production_failure
|
||||
* - other
|
||||
* tags:
|
||||
* description: A list o tags to add to the Claim Item
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* images:
|
||||
* description: A list of image URL's that will be associated with the Claim
|
||||
* items:
|
||||
* type: string
|
||||
* return_shipping:
|
||||
* description: Optional details for the Return Shipping Method, if the items are to be sent back.
|
||||
* type: object
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: The ID of the Shipping Option to create the Shipping Method from.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price to charge for the Shipping Method.
|
||||
* additional_items:
|
||||
* description: The new items to send to the Customer when the Claim type is Replace.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to ship.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Product Variant to ship.
|
||||
* type: integer
|
||||
* shipping_methods:
|
||||
* description: The Shipping Methods to send the additional Line Items with.
|
||||
* type: array
|
||||
* items:
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Shipping Method
|
||||
* type: string
|
||||
* option_id:
|
||||
* description: The ID of the Shipping Option to create a Shipping Method from
|
||||
* type: string
|
||||
* price:
|
||||
* description: The price to charge for the Shipping Method
|
||||
* type: integer
|
||||
* shipping_address:
|
||||
* type: object
|
||||
* description: "An optional shipping address to send the claim to. Defaults to the parent order's shipping address"
|
||||
* $ref: "#/components/schemas/Address"
|
||||
* refund_amount:
|
||||
* description: The amount to refund the Customer when the Claim type is `refund`.
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Claim.
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostOrdersOrderClaimsReq {
|
||||
@IsEnum(ClaimType)
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -28,30 +28,7 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - items
|
||||
* properties:
|
||||
* items:
|
||||
* description: The Line Items to include in the Fulfillment.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of Line Item to fulfill.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item to fulfill.
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Swap.
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderFulfillmentsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -140,6 +117,33 @@ export default async (req, res) => {
|
||||
res.json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderFulfillmentsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - items
|
||||
* properties:
|
||||
* items:
|
||||
* description: The Line Items to include in the Fulfillment.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of Line Item to fulfill.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item to fulfill.
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Swap.
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostOrdersOrderFulfillmentsReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
@@ -24,21 +24,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - fulfillment_id
|
||||
* properties:
|
||||
* fulfillment_id:
|
||||
* description: The ID of the Fulfillment.
|
||||
* type: string
|
||||
* tracking_numbers:
|
||||
* description: The tracking numbers for the shipment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Shipment.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderShipmentReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -121,6 +107,24 @@ export default async (req, res) => {
|
||||
res.json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderShipmentReq
|
||||
* type: object
|
||||
* required:
|
||||
* - fulfillment_id
|
||||
* properties:
|
||||
* fulfillment_id:
|
||||
* description: The ID of the Fulfillment.
|
||||
* type: string
|
||||
* tracking_numbers:
|
||||
* description: The tracking numbers for the shipment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Shipment.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostOrdersOrderShipmentReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -24,21 +24,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - fulfillment_id
|
||||
* properties:
|
||||
* fulfillment_id:
|
||||
* description: The ID of the Fulfillment.
|
||||
* type: string
|
||||
* tracking_numbers:
|
||||
* description: The tracking numbers for the shipment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be sent related to this Claim.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderSwapsSwapShipmentsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -118,6 +104,24 @@ export default async (req, res) => {
|
||||
res.json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderSwapsSwapShipmentsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - fulfillment_id
|
||||
* properties:
|
||||
* fulfillment_id:
|
||||
* description: The ID of the Fulfillment.
|
||||
* type: string
|
||||
* tracking_numbers:
|
||||
* description: The tracking numbers for the shipment.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be sent related to this Claim.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostOrdersOrderSwapsSwapShipmentsReq {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -35,77 +35,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - return_items
|
||||
* properties:
|
||||
* return_items:
|
||||
* description: The Line Items to return as part of the Swap.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item that will be claimed.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The number of items that will be returned
|
||||
* type: integer
|
||||
* reason_id:
|
||||
* description: The ID of the Return Reason to use.
|
||||
* type: string
|
||||
* note:
|
||||
* description: An optional note with information about the Return.
|
||||
* type: string
|
||||
* return_shipping:
|
||||
* description: How the Swap will be returned.
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: The ID of the Shipping Option to create the Shipping Method from.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price to charge for the Shipping Method.
|
||||
* additional_items:
|
||||
* description: The new items to send to the Customer.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to ship.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Product Variant to ship.
|
||||
* type: integer
|
||||
* custom_shipping_options:
|
||||
* description: The custom shipping options to potentially create a Shipping Method from.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - price
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Shipping Option to override with a custom price.
|
||||
* type: string
|
||||
* price:
|
||||
* description: The custom price of the Shipping Option.
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Swap.
|
||||
* type: boolean
|
||||
* allow_backorder:
|
||||
* description: If true, swaps can be completed with items out of stock
|
||||
* type: boolean
|
||||
* default: true
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderSwapsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -323,6 +253,80 @@ export default async (req, res) => {
|
||||
res.status(idempotencyKey.response_code).json(idempotencyKey.response_body)
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderSwapsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - return_items
|
||||
* properties:
|
||||
* return_items:
|
||||
* description: The Line Items to return as part of the Swap.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item that will be claimed.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The number of items that will be returned
|
||||
* type: integer
|
||||
* reason_id:
|
||||
* description: The ID of the Return Reason to use.
|
||||
* type: string
|
||||
* note:
|
||||
* description: An optional note with information about the Return.
|
||||
* type: string
|
||||
* return_shipping:
|
||||
* description: How the Swap will be returned.
|
||||
* type: object
|
||||
* required:
|
||||
* - option_id
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: The ID of the Shipping Option to create the Shipping Method from.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price to charge for the Shipping Method.
|
||||
* additional_items:
|
||||
* description: The new items to send to the Customer.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the Product Variant to ship.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Product Variant to ship.
|
||||
* type: integer
|
||||
* custom_shipping_options:
|
||||
* description: The custom shipping options to potentially create a Shipping Method from.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - price
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Shipping Option to override with a custom price.
|
||||
* type: string
|
||||
* price:
|
||||
* description: The custom price of the Shipping Option.
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Swap.
|
||||
* type: boolean
|
||||
* allow_backorder:
|
||||
* description: If true, swaps can be completed with items out of stock
|
||||
* type: boolean
|
||||
* default: true
|
||||
*/
|
||||
export class AdminPostOrdersOrderSwapsReq {
|
||||
@IsArray()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -18,14 +18,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Claim.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderClaimsClaimFulfillmentsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -97,6 +90,17 @@ export default async (req, res) => {
|
||||
res.status(200).json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderClaimsClaimFulfillmentsReq
|
||||
* type: object
|
||||
* properties:
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Claim.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostOrdersOrderClaimsClaimFulfillmentsReq {
|
||||
@IsObject()
|
||||
@IsOptional()
|
||||
|
||||
@@ -18,14 +18,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Claim.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderSwapsSwapFulfillmentsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -97,6 +90,17 @@ export default async (req, res) => {
|
||||
res.status(200).json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderSwapsSwapFulfillmentsReq
|
||||
* type: object
|
||||
* properties:
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Claim.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostOrdersOrderSwapsSwapFulfillmentsReq {
|
||||
@IsObject()
|
||||
@IsOptional()
|
||||
|
||||
@@ -23,23 +23,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - reason
|
||||
* properties:
|
||||
* amount:
|
||||
* description: The amount to refund.
|
||||
* type: integer
|
||||
* reason:
|
||||
* description: The reason for the Refund.
|
||||
* type: string
|
||||
* note:
|
||||
* description: A note with additional details about the Refund.
|
||||
* type: string
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Refund.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderRefundsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -116,6 +100,26 @@ export default async (req, res) => {
|
||||
res.status(200).json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderRefundsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - reason
|
||||
* properties:
|
||||
* amount:
|
||||
* description: The amount to refund.
|
||||
* type: integer
|
||||
* reason:
|
||||
* description: The reason for the Refund.
|
||||
* type: string
|
||||
* note:
|
||||
* description: A note with additional details about the Refund.
|
||||
* type: string
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Refund.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostOrdersOrderRefundsReq {
|
||||
@IsInt()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -32,53 +32,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - items
|
||||
* properties:
|
||||
* items:
|
||||
* description: The Line Items that will be returned.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item.
|
||||
* type: string
|
||||
* reason_id:
|
||||
* description: The ID of the Return Reason to use.
|
||||
* type: string
|
||||
* note:
|
||||
* description: An optional note with information about the Return.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* return_shipping:
|
||||
* description: The Shipping Method to be used to handle the return shipment.
|
||||
* type: object
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: The ID of the Shipping Option to create the Shipping Method from.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price to charge for the Shipping Method.
|
||||
* note:
|
||||
* description: An optional note with information about the Return.
|
||||
* type: string
|
||||
* receive_now:
|
||||
* description: A flag to indicate if the Return should be registerd as received immediately.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* no_notification:
|
||||
* description: A flag to indicate if no notifications should be emitted related to the requested Return.
|
||||
* type: boolean
|
||||
* refund:
|
||||
* description: The amount to refund.
|
||||
* type: integer
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderReturnsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -333,6 +287,56 @@ type ReturnObj = {
|
||||
no_notification?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderReturnsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - items
|
||||
* properties:
|
||||
* items:
|
||||
* description: The Line Items that will be returned.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item.
|
||||
* type: string
|
||||
* reason_id:
|
||||
* description: The ID of the Return Reason to use.
|
||||
* type: string
|
||||
* note:
|
||||
* description: An optional note with information about the Return.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* return_shipping:
|
||||
* description: The Shipping Method to be used to handle the return shipment.
|
||||
* type: object
|
||||
* properties:
|
||||
* option_id:
|
||||
* type: string
|
||||
* description: The ID of the Shipping Option to create the Shipping Method from.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price to charge for the Shipping Method.
|
||||
* note:
|
||||
* description: An optional note with information about the Return.
|
||||
* type: string
|
||||
* receive_now:
|
||||
* description: A flag to indicate if the Return should be registerd as received immediately.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* no_notification:
|
||||
* description: A flag to indicate if no notifications should be emitted related to the requested Return.
|
||||
* type: boolean
|
||||
* refund:
|
||||
* description: The amount to refund.
|
||||
* type: integer
|
||||
*/
|
||||
export class AdminPostOrdersOrderReturnsReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
@@ -28,84 +28,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* claim_items:
|
||||
* description: The Claim Items that the Claim will consist of.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* - images
|
||||
* - tags
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Claim Item.
|
||||
* type: string
|
||||
* item_id:
|
||||
* description: The ID of the Line Item that will be claimed.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The number of items that will be returned
|
||||
* type: integer
|
||||
* note:
|
||||
* description: Short text describing the Claim Item in further detail.
|
||||
* type: string
|
||||
* reason:
|
||||
* description: The reason for the Claim
|
||||
* type: string
|
||||
* enum:
|
||||
* - missing_item
|
||||
* - wrong_item
|
||||
* - production_failure
|
||||
* - other
|
||||
* tags:
|
||||
* description: A list o tags to add to the Claim Item
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: Tag ID
|
||||
* value:
|
||||
* type: string
|
||||
* description: Tag value
|
||||
* images:
|
||||
* description: A list of image URL's that will be associated with the Claim
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: Image ID
|
||||
* url:
|
||||
* type: string
|
||||
* description: Image URL
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* shipping_methods:
|
||||
* description: The Shipping Methods to send the additional Line Items with.
|
||||
* type: array
|
||||
* items:
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Shipping Method
|
||||
* type: string
|
||||
* option_id:
|
||||
* description: The ID of the Shipping Option to create a Shipping Method from
|
||||
* type: string
|
||||
* price:
|
||||
* description: The price to charge for the Shipping Method
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Swap.
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderClaimsClaimReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -182,6 +105,87 @@ export default async (req, res) => {
|
||||
res.json({ order: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderClaimsClaimReq
|
||||
* type: object
|
||||
* properties:
|
||||
* claim_items:
|
||||
* description: The Claim Items that the Claim will consist of.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* - images
|
||||
* - tags
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Claim Item.
|
||||
* type: string
|
||||
* item_id:
|
||||
* description: The ID of the Line Item that will be claimed.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The number of items that will be returned
|
||||
* type: integer
|
||||
* note:
|
||||
* description: Short text describing the Claim Item in further detail.
|
||||
* type: string
|
||||
* reason:
|
||||
* description: The reason for the Claim
|
||||
* type: string
|
||||
* enum:
|
||||
* - missing_item
|
||||
* - wrong_item
|
||||
* - production_failure
|
||||
* - other
|
||||
* tags:
|
||||
* description: A list o tags to add to the Claim Item
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: Tag ID
|
||||
* value:
|
||||
* type: string
|
||||
* description: Tag value
|
||||
* images:
|
||||
* description: A list of image URL's that will be associated with the Claim
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: Image ID
|
||||
* url:
|
||||
* type: string
|
||||
* description: Image URL
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* shipping_methods:
|
||||
* description: The Shipping Methods to send the additional Line Items with.
|
||||
* type: array
|
||||
* items:
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Shipping Method
|
||||
* type: string
|
||||
* option_id:
|
||||
* description: The ID of the Shipping Option to create a Shipping Method from
|
||||
* type: string
|
||||
* price:
|
||||
* description: The price to charge for the Shipping Method
|
||||
* type: integer
|
||||
* no_notification:
|
||||
* description: If set to true no notification will be send related to this Swap.
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostOrdersOrderClaimsClaimReq {
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
|
||||
@@ -28,69 +28,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* email:
|
||||
* description: the email for the order
|
||||
* type: string
|
||||
* billing_address:
|
||||
* description: Billing address
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* shipping_address:
|
||||
* description: Shipping address
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* items:
|
||||
* description: The Line Items for the order
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/LineItem"
|
||||
* region:
|
||||
* description: ID of the region where the order belongs
|
||||
* type: string
|
||||
* discounts:
|
||||
* description: Discounts applied to the order
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/Discount"
|
||||
* customer_id:
|
||||
* description: ID of the customer
|
||||
* type: string
|
||||
* payment_method:
|
||||
* description: payment method chosen for the order
|
||||
* type: object
|
||||
* properties:
|
||||
* provider_id:
|
||||
* type: string
|
||||
* description: ID of the payment provider
|
||||
* data:
|
||||
* description: Data relevant for the given payment method
|
||||
* type: object
|
||||
* shipping_method:
|
||||
* description: The Shipping Method used for shipping the order.
|
||||
* type: object
|
||||
* properties:
|
||||
* provider_id:
|
||||
* type: string
|
||||
* description: The ID of the shipping provider.
|
||||
* profile_id:
|
||||
* type: string
|
||||
* description: The ID of the shipping profile.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price of the shipping.
|
||||
* data:
|
||||
* type: object
|
||||
* description: Data relevant to the specific shipping method.
|
||||
* items:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/LineItem"
|
||||
* description: Items to ship
|
||||
* no_notification:
|
||||
* description: A flag to indicate if no notifications should be emitted related to the updated order.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostOrdersOrderReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -164,6 +102,72 @@ export default async (req, res) => {
|
||||
res.status(200).json({ order })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostOrdersOrderReq
|
||||
* type: object
|
||||
* properties:
|
||||
* email:
|
||||
* description: the email for the order
|
||||
* type: string
|
||||
* billing_address:
|
||||
* description: Billing address
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* shipping_address:
|
||||
* description: Shipping address
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* items:
|
||||
* description: The Line Items for the order
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/LineItem"
|
||||
* region:
|
||||
* description: ID of the region where the order belongs
|
||||
* type: string
|
||||
* discounts:
|
||||
* description: Discounts applied to the order
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/Discount"
|
||||
* customer_id:
|
||||
* description: ID of the customer
|
||||
* type: string
|
||||
* payment_method:
|
||||
* description: payment method chosen for the order
|
||||
* type: object
|
||||
* properties:
|
||||
* provider_id:
|
||||
* type: string
|
||||
* description: ID of the payment provider
|
||||
* data:
|
||||
* description: Data relevant for the given payment method
|
||||
* type: object
|
||||
* shipping_method:
|
||||
* description: The Shipping Method used for shipping the order.
|
||||
* type: object
|
||||
* properties:
|
||||
* provider_id:
|
||||
* type: string
|
||||
* description: The ID of the shipping provider.
|
||||
* profile_id:
|
||||
* type: string
|
||||
* description: The ID of the shipping profile.
|
||||
* price:
|
||||
* type: integer
|
||||
* description: The price of the shipping.
|
||||
* data:
|
||||
* type: object
|
||||
* description: Data relevant to the specific shipping method.
|
||||
* items:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/LineItem"
|
||||
* description: Items to ship
|
||||
* no_notification:
|
||||
* description: A flag to indicate if no notifications should be emitted related to the updated order.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostOrdersOrderReq {
|
||||
@IsEmail()
|
||||
@IsOptional()
|
||||
|
||||
+12
-8
@@ -15,14 +15,7 @@ import { PaymentCollectionService } from "../../../../services"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* description:
|
||||
* description: An optional description to create or update the payment collection.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminUpdatePaymentCollectionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -93,6 +86,17 @@ export default async (req, res) => {
|
||||
res.status(200).json({ payment_collection: paymentCollection })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminUpdatePaymentCollectionsReq
|
||||
* type: object
|
||||
* properties:
|
||||
* description:
|
||||
* description: An optional description to create or update the payment collection.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminUpdatePaymentCollectionsReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -21,20 +21,7 @@ import { PaymentService } from "../../../../services"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - reason
|
||||
* properties:
|
||||
* amount:
|
||||
* description: The amount to refund.
|
||||
* type: integer
|
||||
* reason:
|
||||
* description: The reason for the Refund.
|
||||
* type: string
|
||||
* note:
|
||||
* description: A note with additional details about the Refund.
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostPaymentRefundsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -106,6 +93,23 @@ export default async (req, res) => {
|
||||
res.status(200).json({ refund })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPaymentRefundsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - amount
|
||||
* - reason
|
||||
* properties:
|
||||
* amount:
|
||||
* description: The amount to refund.
|
||||
* type: integer
|
||||
* reason:
|
||||
* description: The reason for the Refund.
|
||||
* type: string
|
||||
* note:
|
||||
* description: A note with additional details about the Refund.
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostPaymentRefundsReq {
|
||||
@IsInt()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -20,43 +20,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* prices:
|
||||
* description: The prices to update or add.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currecny_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* variant_id:
|
||||
* description: The ID of the Variant for which the price is used.
|
||||
* type: string
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* override:
|
||||
* description: "If true the prices will replace all existing prices associated with the Price List."
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostPriceListPricesPricesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -142,6 +106,46 @@ export default async (req, res) => {
|
||||
res.json({ price_list: priceList })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPriceListPricesPricesReq
|
||||
* type: object
|
||||
* properties:
|
||||
* prices:
|
||||
* description: The prices to update or add.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currecny_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* variant_id:
|
||||
* description: The ID of the Variant for which the price is used.
|
||||
* type: string
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* override:
|
||||
* description: "If true the prices will replace all existing prices associated with the Price List."
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostPriceListPricesPricesReq {
|
||||
@IsArray()
|
||||
@Type(() => AdminPriceListPricesUpdateReq)
|
||||
|
||||
@@ -30,81 +30,7 @@ import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - description
|
||||
* - type
|
||||
* - prices
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Price List"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Price List."
|
||||
* type: string
|
||||
* starts_at:
|
||||
* description: "The date with timezone that the Price List starts being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* ends_at:
|
||||
* description: "The date with timezone that the Price List ends being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* type:
|
||||
* description: The type of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - sale
|
||||
* - override
|
||||
* status:
|
||||
* description: The status of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - active
|
||||
* - draft
|
||||
* prices:
|
||||
* description: The prices of the Price List.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
* properties:
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currecny_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* variant_id:
|
||||
* description: The ID of the Variant for which the price is used.
|
||||
* type: string
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: A list of customer groups that the Price List applies to.
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a customer group
|
||||
* type: string
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of price list"
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostPriceListsPriceListReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -193,6 +119,84 @@ class CustomerGroup {
|
||||
id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPriceListsPriceListReq
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - description
|
||||
* - type
|
||||
* - prices
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Price List"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Price List."
|
||||
* type: string
|
||||
* starts_at:
|
||||
* description: "The date with timezone that the Price List starts being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* ends_at:
|
||||
* description: "The date with timezone that the Price List ends being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* type:
|
||||
* description: The type of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - sale
|
||||
* - override
|
||||
* status:
|
||||
* description: The status of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - active
|
||||
* - draft
|
||||
* prices:
|
||||
* description: The prices of the Price List.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
* properties:
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currecny_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* variant_id:
|
||||
* description: The ID of the Variant for which the price is used.
|
||||
* type: string
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: A list of customer groups that the Price List applies to.
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a customer group
|
||||
* type: string
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of price list"
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostPriceListsPriceListReq {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@@ -16,13 +16,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* price_ids:
|
||||
* description: The price id's of the Money Amounts to delete.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeletePriceListPricesPricesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -109,6 +103,16 @@ export default async (req, res) => {
|
||||
res.json({ ids: validated.price_ids, object: "money-amount", deleted: true })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeletePriceListPricesPricesReq
|
||||
* type: object
|
||||
* properties:
|
||||
* price_ids:
|
||||
* description: The price id's of the Money Amounts to delete.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeletePriceListPricesPricesReq {
|
||||
@ArrayNotEmpty()
|
||||
@IsString({ each: true })
|
||||
|
||||
@@ -33,79 +33,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Price List"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Price List."
|
||||
* type: string
|
||||
* starts_at:
|
||||
* description: "The date with timezone that the Price List starts being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* ends_at:
|
||||
* description: "The date with timezone that the Price List ends being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* type:
|
||||
* description: The type of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - sale
|
||||
* - override
|
||||
* status:
|
||||
* description: The status of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - active
|
||||
* - draft
|
||||
* prices:
|
||||
* description: The prices of the Price List.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currecny_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* variant_id:
|
||||
* description: The ID of the Variant for which the price is used.
|
||||
* type: string
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: A list of customer groups that the Price List applies to.
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a customer group
|
||||
* type: string
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of price list"
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostPriceListsPriceListPriceListReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -187,6 +115,82 @@ class CustomerGroup {
|
||||
id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPriceListsPriceListPriceListReq
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Price List"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Price List."
|
||||
* type: string
|
||||
* starts_at:
|
||||
* description: "The date with timezone that the Price List starts being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* ends_at:
|
||||
* description: "The date with timezone that the Price List ends being valid."
|
||||
* type: string
|
||||
* format: date
|
||||
* type:
|
||||
* description: The type of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - sale
|
||||
* - override
|
||||
* status:
|
||||
* description: The status of the Price List.
|
||||
* type: string
|
||||
* enum:
|
||||
* - active
|
||||
* - draft
|
||||
* prices:
|
||||
* description: The prices of the Price List.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* - variant_id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currecny_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* variant_id:
|
||||
* description: The ID of the Variant for which the price is used.
|
||||
* type: string
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* customer_groups:
|
||||
* type: array
|
||||
* description: A list of customer groups that the Price List applies to.
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a customer group
|
||||
* type: string
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of price list"
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostPriceListsPriceListPriceListReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -17,13 +17,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title the Product Option will be identified by i.e. \"Size\""
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostProductsProductOptionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -102,6 +96,16 @@ export default async (req, res) => {
|
||||
res.json({ product })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsProductOptionsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title the Product Option will be identified by i.e. \"Size\""
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostProductsProductOptionsReq {
|
||||
@IsString()
|
||||
title: string
|
||||
|
||||
@@ -42,210 +42,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title of the Product"
|
||||
* type: string
|
||||
* subtitle:
|
||||
* description: "The subtitle of the Product"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Product."
|
||||
* type: string
|
||||
* is_giftcard:
|
||||
* description: A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to `true` will result in a Gift Card being created.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* discountable:
|
||||
* description: A flag to indicate if discounts can be applied to the LineItems generated from this Product
|
||||
* type: boolean
|
||||
* default: true
|
||||
* images:
|
||||
* description: Images of the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* thumbnail:
|
||||
* description: The thumbnail to use for the Product.
|
||||
* type: string
|
||||
* handle:
|
||||
* description: A unique handle to identify the Product by.
|
||||
* type: string
|
||||
* status:
|
||||
* description: The status of the product.
|
||||
* type: string
|
||||
* enum: [draft, proposed, published, rejected]
|
||||
* default: draft
|
||||
* type:
|
||||
* description: The Product Type to associate the Product with.
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Type.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Product Type.
|
||||
* type: string
|
||||
* collection_id:
|
||||
* description: The ID of the Collection the Product should belong to.
|
||||
* type: string
|
||||
* tags:
|
||||
* description: Tags to associate the Product with.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Tag.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Tag, these will be upserted.
|
||||
* type: string
|
||||
* sales_channels:
|
||||
* description: "[EXPERIMENTAL] Sales channels to associate the Product with."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Sales channel.
|
||||
* type: string
|
||||
* options:
|
||||
* description: The Options that the Product should have. These define on which properties the Product's Product Variants will differ.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Option by.
|
||||
* type: string
|
||||
* variants:
|
||||
* description: A list of Product Variants to create with the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* default: 0
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The wieght of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* value:
|
||||
* description: The value to give for the Product Option at the same index in the Product's `options` field.
|
||||
* type: string
|
||||
* weight:
|
||||
* description: The weight of the Product.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product.
|
||||
* type: number
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostProductsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -467,6 +264,213 @@ class ProductVariantReq {
|
||||
options?: ProductVariantOptionReq[] = []
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title of the Product"
|
||||
* type: string
|
||||
* subtitle:
|
||||
* description: "The subtitle of the Product"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Product."
|
||||
* type: string
|
||||
* is_giftcard:
|
||||
* description: A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to `true` will result in a Gift Card being created.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* discountable:
|
||||
* description: A flag to indicate if discounts can be applied to the LineItems generated from this Product
|
||||
* type: boolean
|
||||
* default: true
|
||||
* images:
|
||||
* description: Images of the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* thumbnail:
|
||||
* description: The thumbnail to use for the Product.
|
||||
* type: string
|
||||
* handle:
|
||||
* description: A unique handle to identify the Product by.
|
||||
* type: string
|
||||
* status:
|
||||
* description: The status of the product.
|
||||
* type: string
|
||||
* enum: [draft, proposed, published, rejected]
|
||||
* default: draft
|
||||
* type:
|
||||
* description: The Product Type to associate the Product with.
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Type.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Product Type.
|
||||
* type: string
|
||||
* collection_id:
|
||||
* description: The ID of the Collection the Product should belong to.
|
||||
* type: string
|
||||
* tags:
|
||||
* description: Tags to associate the Product with.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Tag.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Tag, these will be upserted.
|
||||
* type: string
|
||||
* sales_channels:
|
||||
* description: "[EXPERIMENTAL] Sales channels to associate the Product with."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Sales channel.
|
||||
* type: string
|
||||
* options:
|
||||
* description: The Options that the Product should have. These define on which properties the Product's Product Variants will differ.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Option by.
|
||||
* type: string
|
||||
* variants:
|
||||
* description: A list of Product Variants to create with the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* default: 0
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The wieght of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* value:
|
||||
* description: The value to give for the Product Option at the same index in the Product's `options` field.
|
||||
* type: string
|
||||
* weight:
|
||||
* description: The weight of the Product.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product.
|
||||
* type: number
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostProductsReq {
|
||||
@IsString()
|
||||
title: string
|
||||
|
||||
@@ -30,104 +30,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* - prices
|
||||
* - options
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* default: 0
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The wieght of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Product Option to set the value for.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value to give for the Product Option.
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostProductsProductVariantsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -239,6 +142,107 @@ class ProductVariantOptionReq {
|
||||
option_id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsProductVariantsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* - prices
|
||||
* - options
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* default: 0
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The wieght of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Product Option to set the value for.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value to give for the Product Option.
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostProductsProductVariantsReq {
|
||||
@IsString()
|
||||
title: string
|
||||
|
||||
@@ -16,17 +16,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - key
|
||||
* - value
|
||||
* properties:
|
||||
* key:
|
||||
* description: The metadata key
|
||||
* type: string
|
||||
* value:
|
||||
* description: The metadata value
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostProductsProductMetadataReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -103,6 +93,20 @@ export default async (req, res) => {
|
||||
res.status(200).json({ product })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsProductMetadataReq
|
||||
* type: object
|
||||
* required:
|
||||
* - key
|
||||
* - value
|
||||
* properties:
|
||||
* key:
|
||||
* description: The metadata key
|
||||
* type: string
|
||||
* value:
|
||||
* description: The metadata value
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostProductsProductMetadataReq {
|
||||
@IsString()
|
||||
key: string
|
||||
|
||||
@@ -18,13 +18,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title of the Product Option"
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostProductsProductOptionsOption"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -100,6 +94,16 @@ export default async (req, res) => {
|
||||
res.json({ product })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsProductOptionsOption
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title of the Product Option"
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostProductsProductOptionsOption {
|
||||
@IsString()
|
||||
title: string
|
||||
|
||||
@@ -39,196 +39,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title of the Product"
|
||||
* type: string
|
||||
* subtitle:
|
||||
* description: "The subtitle of the Product"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Product."
|
||||
* type: string
|
||||
* discountable:
|
||||
* description: A flag to indicate if discounts can be applied to the LineItems generated from this Product
|
||||
* type: boolean
|
||||
* images:
|
||||
* description: Images of the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* thumbnail:
|
||||
* description: The thumbnail to use for the Product.
|
||||
* type: string
|
||||
* handle:
|
||||
* description: A unique handle to identify the Product by.
|
||||
* type: string
|
||||
* status:
|
||||
* description: The status of the product.
|
||||
* type: string
|
||||
* enum: [draft, proposed, published, rejected]
|
||||
* type:
|
||||
* description: The Product Type to associate the Product with.
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Type.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Product Type.
|
||||
* type: string
|
||||
* collection_id:
|
||||
* description: The ID of the Collection the Product should belong to.
|
||||
* type: string
|
||||
* tags:
|
||||
* description: Tags to associate the Product with.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Tag.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Tag, these will be upserted.
|
||||
* type: string
|
||||
* sales_channels:
|
||||
* description: "[EXPERIMENTAL] Sales channels to associate the Product with."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Sales channel.
|
||||
* type: string
|
||||
* variants:
|
||||
* description: A list of Product Variants to create with the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Variant.
|
||||
* type: string
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The wieght of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Option.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value to give for the Product Option at the same index in the Product's `options` field.
|
||||
* type: string
|
||||
* weight:
|
||||
* description: The wieght of the Product.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostProductsProductReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -399,6 +210,199 @@ class ProductVariantReq {
|
||||
options?: ProductVariantOptionReq[] = []
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsProductReq
|
||||
* type: object
|
||||
* properties:
|
||||
* title:
|
||||
* description: "The title of the Product"
|
||||
* type: string
|
||||
* subtitle:
|
||||
* description: "The subtitle of the Product"
|
||||
* type: string
|
||||
* description:
|
||||
* description: "A description of the Product."
|
||||
* type: string
|
||||
* discountable:
|
||||
* description: A flag to indicate if discounts can be applied to the LineItems generated from this Product
|
||||
* type: boolean
|
||||
* images:
|
||||
* description: Images of the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* thumbnail:
|
||||
* description: The thumbnail to use for the Product.
|
||||
* type: string
|
||||
* handle:
|
||||
* description: A unique handle to identify the Product by.
|
||||
* type: string
|
||||
* status:
|
||||
* description: The status of the product.
|
||||
* type: string
|
||||
* enum: [draft, proposed, published, rejected]
|
||||
* type:
|
||||
* description: The Product Type to associate the Product with.
|
||||
* type: object
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Type.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Product Type.
|
||||
* type: string
|
||||
* collection_id:
|
||||
* description: The ID of the Collection the Product should belong to.
|
||||
* type: string
|
||||
* tags:
|
||||
* description: Tags to associate the Product with.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - value
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Tag.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value of the Tag, these will be upserted.
|
||||
* type: string
|
||||
* sales_channels:
|
||||
* description: "[EXPERIMENTAL] Sales channels to associate the Product with."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of an existing Sales channel.
|
||||
* type: string
|
||||
* variants:
|
||||
* description: A list of Product Variants to create with the Product.
|
||||
* type: array
|
||||
* items:
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Product Variant.
|
||||
* type: string
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The wieght of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the Price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Option.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value to give for the Product Option at the same index in the Product's `options` field.
|
||||
* type: string
|
||||
* weight:
|
||||
* description: The wieght of the Product.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostProductsProductReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -33,101 +33,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - prices
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The weight of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Product Option to set the value for.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value to give for the Product Option.
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostProductsProductVariantsVariantReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -242,6 +148,104 @@ class ProductVariantOptionReq {
|
||||
option_id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostProductsProductVariantsVariantReq
|
||||
* type: object
|
||||
* required:
|
||||
* - prices
|
||||
* properties:
|
||||
* title:
|
||||
* description: The title to identify the Product Variant by.
|
||||
* type: string
|
||||
* sku:
|
||||
* description: The unique SKU for the Product Variant.
|
||||
* type: string
|
||||
* ean:
|
||||
* description: The EAN number of the item.
|
||||
* type: string
|
||||
* upc:
|
||||
* description: The UPC number of the item.
|
||||
* type: string
|
||||
* barcode:
|
||||
* description: A generic GTIN field for the Product Variant.
|
||||
* type: string
|
||||
* hs_code:
|
||||
* description: The Harmonized System code for the Product Variant.
|
||||
* type: string
|
||||
* inventory_quantity:
|
||||
* description: The amount of stock kept for the Product Variant.
|
||||
* type: integer
|
||||
* allow_backorder:
|
||||
* description: Whether the Product Variant can be purchased when out of stock.
|
||||
* type: boolean
|
||||
* manage_inventory:
|
||||
* description: Whether Medusa should keep track of the inventory for this Product Variant.
|
||||
* type: boolean
|
||||
* weight:
|
||||
* description: The weight of the Product Variant.
|
||||
* type: number
|
||||
* length:
|
||||
* description: The length of the Product Variant.
|
||||
* type: number
|
||||
* height:
|
||||
* description: The height of the Product Variant.
|
||||
* type: number
|
||||
* width:
|
||||
* description: The width of the Product Variant.
|
||||
* type: number
|
||||
* origin_country:
|
||||
* description: The country of origin of the Product Variant.
|
||||
* type: string
|
||||
* mid_code:
|
||||
* description: The Manufacturer Identification code for the Product Variant.
|
||||
* type: string
|
||||
* material:
|
||||
* description: The material composition of the Product Variant.
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* prices:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the price.
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: The ID of the Region for which the price is used. Only required if currency_code is not provided.
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* amount:
|
||||
* description: The amount to charge for the Product Variant.
|
||||
* type: integer
|
||||
* min_quantity:
|
||||
* description: The minimum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* max_quantity:
|
||||
* description: The maximum quantity for which the price will be used.
|
||||
* type: integer
|
||||
* options:
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - option_id
|
||||
* - value
|
||||
* properties:
|
||||
* option_id:
|
||||
* description: The ID of the Product Option to set the value for.
|
||||
* type: string
|
||||
* value:
|
||||
* description: The value to give for the Product Option.
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostProductsProductVariantsVariantReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -18,20 +18,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* required:
|
||||
* - sales_channel_ids
|
||||
* properties:
|
||||
* sales_channel_ids:
|
||||
* description: The IDs of the sales channels to add to the publishable api key
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The ID of the sales channel
|
||||
* $ref: "#/components/schemas/AdminPostPublishableApiKeySalesChannelsBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -116,6 +103,24 @@ export default async (req: Request, res: Response): Promise<void> => {
|
||||
res.status(200).json({ publishable_api_key: publishableApiKey })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPublishableApiKeySalesChannelsBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - sales_channel_ids
|
||||
* properties:
|
||||
* sales_channel_ids:
|
||||
* description: The IDs of the sales channels to add to the publishable api key
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The ID of the sales channel
|
||||
*/
|
||||
export class AdminPostPublishableApiKeySalesChannelsBatchReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
+11
-7
@@ -13,13 +13,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: A title for the publishable api key
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostPublishableApiKeysReq"
|
||||
* x-authenticated: true
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
@@ -85,6 +79,16 @@ export default async (req: Request, res: Response) => {
|
||||
return res.status(200).json({ publishable_api_key: pubKey })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPublishableApiKeysReq
|
||||
* type: object
|
||||
* required:
|
||||
* - title
|
||||
* properties:
|
||||
* title:
|
||||
* description: A title for the publishable api key
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostPublishableApiKeysReq {
|
||||
@IsString()
|
||||
title: string
|
||||
|
||||
+19
-14
@@ -18,20 +18,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* required:
|
||||
* - sales_channel_ids
|
||||
* properties:
|
||||
* sales_channel_ids:
|
||||
* description: The IDs of the sales channels to delete from the publishable api key
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The ID of the sales channel
|
||||
* $ref: "#/components/schemas/AdminDeletePublishableApiKeySalesChannelsBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -116,6 +103,24 @@ export default async (req: Request, res: Response): Promise<void> => {
|
||||
res.status(200).json({ publishable_api_key: publishableApiKey })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeletePublishableApiKeySalesChannelsBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - sales_channel_ids
|
||||
* properties:
|
||||
* sales_channel_ids:
|
||||
* description: The IDs of the sales channels to delete from the publishable api key
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The ID of the sales channel
|
||||
*/
|
||||
export class AdminDeletePublishableApiKeySalesChannelsBatchReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
+9
-5
@@ -16,11 +16,7 @@ import PublishableApiKeyService from "../../../../services/publishable-api-key"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* title:
|
||||
* description: A title to update for the key.
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostPublishableApiKeysPublishableApiKeyReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -92,6 +88,14 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ publishable_api_key: updatedKey })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostPublishableApiKeysPublishableApiKeyReq
|
||||
* type: object
|
||||
* properties:
|
||||
* title:
|
||||
* description: A title to update for the key.
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostPublishableApiKeysPublishableApiKeyReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -18,16 +18,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - country_code
|
||||
* properties:
|
||||
* country_code:
|
||||
* description: "The 2 character ISO code for the Country."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* $ref: "#/components/schemas/AdminPostRegionsRegionCountriesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -101,6 +92,19 @@ export default async (req, res) => {
|
||||
res.status(200).json({ region })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostRegionsRegionCountriesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - country_code
|
||||
* properties:
|
||||
* country_code:
|
||||
* description: "The 2 character ISO code for the Country."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
*/
|
||||
export class AdminPostRegionsRegionCountriesReq {
|
||||
@IsString()
|
||||
country_code: string
|
||||
|
||||
@@ -18,13 +18,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - provider_id
|
||||
* properties:
|
||||
* provider_id:
|
||||
* description: "The ID of the Fulfillment Provider to add."
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostRegionsRegionFulfillmentProvidersReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -97,6 +91,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ region })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostRegionsRegionFulfillmentProvidersReq
|
||||
* type: object
|
||||
* required:
|
||||
* - provider_id
|
||||
* properties:
|
||||
* provider_id:
|
||||
* description: "The ID of the Fulfillment Provider to add."
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostRegionsRegionFulfillmentProvidersReq {
|
||||
@IsString()
|
||||
provider_id: string
|
||||
|
||||
@@ -18,13 +18,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - provider_id
|
||||
* properties:
|
||||
* provider_id:
|
||||
* description: "The ID of the Payment Provider to add."
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostRegionsRegionPaymentProvidersReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -97,6 +91,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ region })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostRegionsRegionPaymentProvidersReq
|
||||
* type: object
|
||||
* required:
|
||||
* - provider_id
|
||||
* properties:
|
||||
* provider_id:
|
||||
* description: "The ID of the Payment Provider to add."
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostRegionsRegionPaymentProvidersReq {
|
||||
@IsString()
|
||||
provider_id: string
|
||||
|
||||
@@ -24,49 +24,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - currency_code
|
||||
* - tax_rate
|
||||
* - payment_providers
|
||||
* - fulfillment_providers
|
||||
* - countries
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Region"
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: "The 3 character ISO currency code to use for the Region."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* tax_code:
|
||||
* description: "An optional tax code the Region."
|
||||
* type: string
|
||||
* tax_rate:
|
||||
* description: "The tax rate to use on Orders in the Region."
|
||||
* type: number
|
||||
* payment_providers:
|
||||
* description: "A list of Payment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* fulfillment_providers:
|
||||
* description: "A list of Fulfillment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* countries:
|
||||
* description: "A list of countries' 2 ISO Characters that should be included in the Region."
|
||||
* example: ["US"]
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of region"
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostRegionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -160,6 +118,52 @@ export default async (req, res) => {
|
||||
res.status(200).json({ region })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostRegionsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - currency_code
|
||||
* - tax_rate
|
||||
* - payment_providers
|
||||
* - fulfillment_providers
|
||||
* - countries
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Region"
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: "The 3 character ISO currency code to use for the Region."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* tax_code:
|
||||
* description: "An optional tax code the Region."
|
||||
* type: string
|
||||
* tax_rate:
|
||||
* description: "The tax rate to use on Orders in the Region."
|
||||
* type: number
|
||||
* payment_providers:
|
||||
* description: "A list of Payment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* fulfillment_providers:
|
||||
* description: "A list of Fulfillment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* countries:
|
||||
* description: "A list of countries' 2 ISO Characters that should be included in the Region."
|
||||
* example: ["US"]
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of region"
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostRegionsReq {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@@ -26,50 +26,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Region"
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: "The 3 character ISO currency code to use for the Region."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* automatic_taxes:
|
||||
* description: "If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes."
|
||||
* type: boolean
|
||||
* gift_cards_taxable:
|
||||
* description: "Whether gift cards in this region should be applied sales tax when purchasing a gift card"
|
||||
* type: boolean
|
||||
* tax_provider_id:
|
||||
* description: "The ID of the tax provider to use; if null the system tax provider is used"
|
||||
* type: string
|
||||
* tax_code:
|
||||
* description: "An optional tax code the Region."
|
||||
* type: string
|
||||
* tax_rate:
|
||||
* description: "The tax rate to use on Orders in the Region."
|
||||
* type: number
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of region"
|
||||
* type: boolean
|
||||
* payment_providers:
|
||||
* description: "A list of Payment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* fulfillment_providers:
|
||||
* description: "A list of Fulfillment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* countries:
|
||||
* description: "A list of countries' 2 ISO Characters that should be included in the Region."
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostRegionsRegionReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -140,6 +97,53 @@ export default async (req, res) => {
|
||||
res.status(200).json({ region })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostRegionsRegionReq
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Region"
|
||||
* type: string
|
||||
* currency_code:
|
||||
* description: "The 3 character ISO currency code to use for the Region."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* automatic_taxes:
|
||||
* description: "If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes."
|
||||
* type: boolean
|
||||
* gift_cards_taxable:
|
||||
* description: "Whether gift cards in this region should be applied sales tax when purchasing a gift card"
|
||||
* type: boolean
|
||||
* tax_provider_id:
|
||||
* description: "The ID of the tax provider to use; if null the system tax provider is used"
|
||||
* type: string
|
||||
* tax_code:
|
||||
* description: "An optional tax code the Region."
|
||||
* type: string
|
||||
* tax_rate:
|
||||
* description: "The tax rate to use on Orders in the Region."
|
||||
* type: number
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of region"
|
||||
* type: boolean
|
||||
* payment_providers:
|
||||
* description: "A list of Payment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* fulfillment_providers:
|
||||
* description: "A list of Fulfillment Provider IDs that should be enabled for the Region"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* countries:
|
||||
* description: "A list of countries' 2 ISO Characters that should be included in the Region."
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostRegionsRegionReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -18,26 +18,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - label
|
||||
* - value
|
||||
* properties:
|
||||
* label:
|
||||
* description: "The label to display to the Customer."
|
||||
* type: string
|
||||
* value:
|
||||
* description: "The value that the Return Reason will be identified by. Must be unique."
|
||||
* type: string
|
||||
* parent_return_reason_id:
|
||||
* description: "The ID of the parent return reason."
|
||||
* type: string
|
||||
* description:
|
||||
* description: "An optional description to for the Reason."
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostReturnReasonsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -111,6 +92,29 @@ export default async (req, res) => {
|
||||
res.status(200).json({ return_reason: reason })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostReturnReasonsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - label
|
||||
* - value
|
||||
* properties:
|
||||
* label:
|
||||
* description: "The label to display to the Customer."
|
||||
* type: string
|
||||
* value:
|
||||
* description: "The value that the Return Reason will be identified by. Must be unique."
|
||||
* type: string
|
||||
* parent_return_reason_id:
|
||||
* description: "The ID of the parent return reason."
|
||||
* type: string
|
||||
* description:
|
||||
* description: "An optional description to for the Reason."
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostReturnReasonsReq {
|
||||
@IsString()
|
||||
value: string
|
||||
|
||||
@@ -20,20 +20,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* label:
|
||||
* description: "The label to display to the Customer."
|
||||
* type: string
|
||||
* value:
|
||||
* description: "The value that the Return Reason will be identified by. Must be unique."
|
||||
* type: string
|
||||
* description:
|
||||
* description: "An optional description to for the Reason."
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostReturnReasonsReasonReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -108,6 +95,23 @@ export default async (req, res) => {
|
||||
res.status(200).json({ return_reason: reason })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostReturnReasonsReasonReq
|
||||
* type: object
|
||||
* properties:
|
||||
* label:
|
||||
* description: "The label to display to the Customer."
|
||||
* type: string
|
||||
* value:
|
||||
* description: "The value that the Return Reason will be identified by. Must be unique."
|
||||
* type: string
|
||||
* description:
|
||||
* description: "An optional description to for the Reason."
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostReturnReasonsReasonReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -23,27 +23,7 @@ import { isDefined } from "medusa-core-utils"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - items
|
||||
* properties:
|
||||
* items:
|
||||
* description: The Line Items that have been received.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* refund:
|
||||
* description: The amount to refund.
|
||||
* type: number
|
||||
* $ref: "#/components/schemas/AdminPostReturnsReturnReceiveReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -156,6 +136,30 @@ class Item {
|
||||
quantity: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostReturnsReturnReceiveReq
|
||||
* type: object
|
||||
* required:
|
||||
* - items
|
||||
* properties:
|
||||
* items:
|
||||
* description: The Line Items that have been received.
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - item_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* item_id:
|
||||
* description: The ID of the Line Item.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Line Item.
|
||||
* type: integer
|
||||
* refund:
|
||||
* description: The amount to refund.
|
||||
* type: number
|
||||
*/
|
||||
export class AdminPostReturnsReturnReceiveReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
@@ -18,21 +18,7 @@ import { Type } from "class-transformer"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: The IDs of the products to add to the Sales Channel
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The ID of the product
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsChannelProductsBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -114,6 +100,24 @@ export default async (req: Request, res: Response): Promise<void> => {
|
||||
res.status(200).json({ sales_channel: salesChannel })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostSalesChannelsChannelProductsBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: The IDs of the products to add to the Sales Channel
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The ID of the product
|
||||
*/
|
||||
export class AdminPostSalesChannelsChannelProductsBatchReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
@@ -15,19 +15,7 @@ import SalesChannelService from "../../../../services/sales-channel"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* description: The name of the Sales Channel
|
||||
* type: string
|
||||
* description:
|
||||
* description: The description of the Sales Channel
|
||||
* type: string
|
||||
* is_disabled:
|
||||
* description: Whether the Sales Channel is disabled or not.
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -96,6 +84,22 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ sales_channel: salesChannel })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostSalesChannelsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* description: The name of the Sales Channel
|
||||
* type: string
|
||||
* description:
|
||||
* description: The description of the Sales Channel
|
||||
* type: string
|
||||
* is_disabled:
|
||||
* description: Whether the Sales Channel is disabled or not.
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostSalesChannelsReq {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@@ -18,21 +18,7 @@ import { Type } from "class-transformer"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: The IDs of the products to delete from the Sales Channel.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a product
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteSalesChannelsChannelProductsBatchReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -114,6 +100,24 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ sales_channel: salesChannel })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteSalesChannelsChannelProductsBatchReq
|
||||
* type: object
|
||||
* required:
|
||||
* - product_ids
|
||||
* properties:
|
||||
* product_ids:
|
||||
* description: The IDs of the products to delete from the Sales Channel.
|
||||
* type: array
|
||||
* items:
|
||||
* type: object
|
||||
* required:
|
||||
* - id
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of a product
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteSalesChannelsChannelProductsBatchReq {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
|
||||
@@ -16,17 +16,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: Name of the sales channel.
|
||||
* description:
|
||||
* type: string
|
||||
* description: Sales Channel description.
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Indication of if the sales channel is active.
|
||||
* $ref: "#/components/schemas/AdminPostSalesChannelsSalesChannelReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -98,6 +88,20 @@ export default async (req: Request, res: Response) => {
|
||||
res.status(200).json({ sales_channel })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostSalesChannelsSalesChannelReq
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* description: Name of the sales channel.
|
||||
* description:
|
||||
* type: string
|
||||
* description: Sales Channel description.
|
||||
* is_disabled:
|
||||
* type: boolean
|
||||
* description: Indication of if the sales channel is active.
|
||||
*/
|
||||
export class AdminPostSalesChannelsSalesChannelReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -25,69 +25,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - region_id
|
||||
* - provider_id
|
||||
* - data
|
||||
* - price_type
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Option"
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: "The ID of the Region in which the Shipping Option will be available."
|
||||
* type: string
|
||||
* provider_id:
|
||||
* description: "The ID of the Fulfillment Provider that handles the Shipping Option."
|
||||
* type: string
|
||||
* profile_id:
|
||||
* description: "The ID of the Shipping Profile to add the Shipping Option to."
|
||||
* type: number
|
||||
* data:
|
||||
* description: "The data needed for the Fulfillment Provider to handle shipping with this Shipping Option."
|
||||
* type: object
|
||||
* price_type:
|
||||
* description: "The type of the Shipping Option price."
|
||||
* type: string
|
||||
* enum:
|
||||
* - flat_rate
|
||||
* - calculated
|
||||
* amount:
|
||||
* description: "The amount to charge for the Shipping Option."
|
||||
* type: integer
|
||||
* requirements:
|
||||
* description: "The requirements that must be satisfied for the Shipping Option to be available."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - type
|
||||
* - amount
|
||||
* properties:
|
||||
* type:
|
||||
* description: The type of the requirement
|
||||
* type: string
|
||||
* enum:
|
||||
* - max_subtotal
|
||||
* - min_subtotal
|
||||
* amount:
|
||||
* description: The amount to compare with.
|
||||
* type: integer
|
||||
* is_return:
|
||||
* description: Whether the Shipping Option defines a return shipment.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* admin_only:
|
||||
* description: If true, the option can be used for draft orders
|
||||
* type: boolean
|
||||
* default: false
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of shipping option"
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostShippingOptionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -181,6 +119,72 @@ class OptionRequirement {
|
||||
amount: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostShippingOptionsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* - region_id
|
||||
* - provider_id
|
||||
* - data
|
||||
* - price_type
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Option"
|
||||
* type: string
|
||||
* region_id:
|
||||
* description: "The ID of the Region in which the Shipping Option will be available."
|
||||
* type: string
|
||||
* provider_id:
|
||||
* description: "The ID of the Fulfillment Provider that handles the Shipping Option."
|
||||
* type: string
|
||||
* profile_id:
|
||||
* description: "The ID of the Shipping Profile to add the Shipping Option to."
|
||||
* type: number
|
||||
* data:
|
||||
* description: "The data needed for the Fulfillment Provider to handle shipping with this Shipping Option."
|
||||
* type: object
|
||||
* price_type:
|
||||
* description: "The type of the Shipping Option price."
|
||||
* type: string
|
||||
* enum:
|
||||
* - flat_rate
|
||||
* - calculated
|
||||
* amount:
|
||||
* description: "The amount to charge for the Shipping Option."
|
||||
* type: integer
|
||||
* requirements:
|
||||
* description: "The requirements that must be satisfied for the Shipping Option to be available."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - type
|
||||
* - amount
|
||||
* properties:
|
||||
* type:
|
||||
* description: The type of the requirement
|
||||
* type: string
|
||||
* enum:
|
||||
* - max_subtotal
|
||||
* - min_subtotal
|
||||
* amount:
|
||||
* description: The amount to compare with.
|
||||
* type: integer
|
||||
* is_return:
|
||||
* description: Whether the Shipping Option defines a return shipment.
|
||||
* type: boolean
|
||||
* default: false
|
||||
* admin_only:
|
||||
* description: If true, the option can be used for draft orders
|
||||
* type: boolean
|
||||
* default: false
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of shipping option"
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostShippingOptionsReq {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@@ -27,45 +27,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - requirements
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Option"
|
||||
* type: string
|
||||
* amount:
|
||||
* description: "The amount to charge for the Shipping Option."
|
||||
* type: integer
|
||||
* admin_only:
|
||||
* description: "If true, the option can be used for draft orders"
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: "An optional set of key-value pairs with additional information."
|
||||
* type: object
|
||||
* requirements:
|
||||
* description: "The requirements that must be satisfied for the Shipping Option to be available."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - type
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the requirement
|
||||
* type: string
|
||||
* type:
|
||||
* description: The type of the requirement
|
||||
* type: string
|
||||
* enum:
|
||||
* - max_subtotal
|
||||
* - min_subtotal
|
||||
* amount:
|
||||
* description: The amount to compare with.
|
||||
* type: integer
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of shipping option"
|
||||
* type: boolean
|
||||
* $ref: "#/components/schemas/AdminPostShippingOptionsOptionReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -160,6 +122,48 @@ class OptionRequirement {
|
||||
amount: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostShippingOptionsOptionReq
|
||||
* type: object
|
||||
* required:
|
||||
* - requirements
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Option"
|
||||
* type: string
|
||||
* amount:
|
||||
* description: "The amount to charge for the Shipping Option."
|
||||
* type: integer
|
||||
* admin_only:
|
||||
* description: "If true, the option can be used for draft orders"
|
||||
* type: boolean
|
||||
* metadata:
|
||||
* description: "An optional set of key-value pairs with additional information."
|
||||
* type: object
|
||||
* requirements:
|
||||
* description: "The requirements that must be satisfied for the Shipping Option to be available."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - type
|
||||
* - amount
|
||||
* properties:
|
||||
* id:
|
||||
* description: The ID of the requirement
|
||||
* type: string
|
||||
* type:
|
||||
* description: The type of the requirement
|
||||
* type: string
|
||||
* enum:
|
||||
* - max_subtotal
|
||||
* - min_subtotal
|
||||
* amount:
|
||||
* description: The amount to compare with.
|
||||
* type: integer
|
||||
* includes_tax:
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of shipping option"
|
||||
* type: boolean
|
||||
*/
|
||||
export class AdminPostShippingOptionsOptionReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -13,13 +13,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Profile"
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostShippingProfilesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -86,6 +80,16 @@ export default async (req, res) => {
|
||||
res.status(200).json({ shipping_profile: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostShippingProfilesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - name
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Profile"
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostShippingProfilesReq {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@@ -15,11 +15,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Profile"
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostShippingProfilesProfileReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -93,6 +89,14 @@ export default async (req, res) => {
|
||||
res.status(200).json({ shipping_profile: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostShippingProfilesProfileReq
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Shipping Profile"
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostShippingProfilesProfileReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -14,34 +14,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Store"
|
||||
* type: string
|
||||
* swap_link_template:
|
||||
* description: "A template for Swap links - use `{{cart_id}}` to insert the Swap Cart id"
|
||||
* type: string
|
||||
* payment_link_template:
|
||||
* description: "A template for payment links links - use `{{cart_id}}` to insert the Cart id"
|
||||
* type: string
|
||||
* invite_link_template:
|
||||
* description: "A template for invite links - use `{{invite_token}}` to insert the invite token"
|
||||
* type: string
|
||||
* default_currency_code:
|
||||
* description: "The default currency code for the Store."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* currencies:
|
||||
* description: "Array of currencies in 2 character ISO code format."
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: "An optional set of key-value pairs with additional information."
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminPostStoreReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -107,6 +80,37 @@ export default async (req, res) => {
|
||||
res.status(200).json({ store })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostStoreReq
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* description: "The name of the Store"
|
||||
* type: string
|
||||
* swap_link_template:
|
||||
* description: "A template for Swap links - use `{{cart_id}}` to insert the Swap Cart id"
|
||||
* type: string
|
||||
* payment_link_template:
|
||||
* description: "A template for payment links links - use `{{cart_id}}` to insert the Cart id"
|
||||
* type: string
|
||||
* invite_link_template:
|
||||
* description: "A template for invite links - use `{{invite_token}}` to insert the invite token"
|
||||
* type: string
|
||||
* default_currency_code:
|
||||
* description: "The default currency code for the Store."
|
||||
* type: string
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
|
||||
* description: See a list of codes.
|
||||
* currencies:
|
||||
* description: "Array of currencies in 2 character ISO code format."
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: "An optional set of key-value pairs with additional information."
|
||||
* type: object
|
||||
*/
|
||||
export class AdminPostStoreReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -36,15 +36,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - product_types
|
||||
* properties:
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products to associate with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateProductTypesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -129,6 +121,18 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostTaxRatesTaxRateProductTypesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - product_types
|
||||
* properties:
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products to associate with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostTaxRatesTaxRateProductTypesReq {
|
||||
@IsArray()
|
||||
product_types: string[]
|
||||
|
||||
@@ -36,15 +36,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - products
|
||||
* properties:
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products to associate with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateProductsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -126,6 +118,18 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostTaxRatesTaxRateProductsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - products
|
||||
* properties:
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products to associate with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostTaxRatesTaxRateProductsReq {
|
||||
@IsArray()
|
||||
products: string[]
|
||||
|
||||
@@ -36,15 +36,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - shipping_options
|
||||
* properties:
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options to associate with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateShippingOptionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -128,6 +120,18 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostTaxRatesTaxRateShippingOptionsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - shipping_options
|
||||
* properties:
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options to associate with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostTaxRatesTaxRateShippingOptionsReq {
|
||||
@IsArray()
|
||||
shipping_options: string[]
|
||||
|
||||
@@ -38,39 +38,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* - name
|
||||
* - region_id
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: "A code to identify the tax type by"
|
||||
* name:
|
||||
* type: string
|
||||
* description: "A human friendly name for the tax"
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: "The ID of the Region that the rate belongs to"
|
||||
* rate:
|
||||
* type: number
|
||||
* description: "The numeric rate to charge"
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -172,6 +140,42 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostTaxRatesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - code
|
||||
* - name
|
||||
* - region_id
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: "A code to identify the tax type by"
|
||||
* name:
|
||||
* type: string
|
||||
* description: "A human friendly name for the tax"
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: "The ID of the Region that the rate belongs to"
|
||||
* rate:
|
||||
* type: number
|
||||
* description: "The numeric rate to charge"
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostTaxRatesReq {
|
||||
@IsString()
|
||||
code: string
|
||||
|
||||
@@ -36,15 +36,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - product_types
|
||||
* properties:
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products to remove association with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteTaxRatesTaxRateProductTypesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -129,6 +121,18 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteTaxRatesTaxRateProductTypesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - product_types
|
||||
* properties:
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products to remove association with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteTaxRatesTaxRateProductTypesReq {
|
||||
@IsArray()
|
||||
product_types: string[]
|
||||
|
||||
@@ -36,15 +36,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - products
|
||||
* properties:
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products to remove association with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteTaxRatesTaxRateProductsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -126,6 +118,18 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteTaxRatesTaxRateProductsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - products
|
||||
* properties:
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products to remove association with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteTaxRatesTaxRateProductsReq {
|
||||
@IsArray()
|
||||
products: string[]
|
||||
|
||||
@@ -36,15 +36,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - shipping_options
|
||||
* properties:
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options to remove association with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteTaxRatesTaxRateShippingOptionsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -129,6 +121,18 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteTaxRatesTaxRateShippingOptionsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - shipping_options
|
||||
* properties:
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options to remove association with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteTaxRatesTaxRateShippingOptionsReq {
|
||||
@IsArray()
|
||||
shipping_options: string[]
|
||||
|
||||
@@ -39,35 +39,7 @@ import { isDefined } from "medusa-core-utils"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: "A code to identify the tax type by"
|
||||
* name:
|
||||
* type: string
|
||||
* description: "A human friendly name for the tax"
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: "The ID of the Region that the rate belongs to"
|
||||
* rate:
|
||||
* type: number
|
||||
* description: "The numeric rate to charge"
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostTaxRatesTaxRateReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -165,6 +137,38 @@ export default async (req, res) => {
|
||||
res.json({ tax_rate: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostTaxRatesTaxRateReq
|
||||
* type: object
|
||||
* properties:
|
||||
* code:
|
||||
* type: string
|
||||
* description: "A code to identify the tax type by"
|
||||
* name:
|
||||
* type: string
|
||||
* description: "A human friendly name for the tax"
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: "The ID of the Region that the rate belongs to"
|
||||
* rate:
|
||||
* type: number
|
||||
* description: "The numeric rate to charge"
|
||||
* products:
|
||||
* type: array
|
||||
* description: "The IDs of the products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* shipping_options:
|
||||
* type: array
|
||||
* description: "The IDs of the shipping options associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
* product_types:
|
||||
* type: array
|
||||
* description: "The IDs of the types of products associated with this tax rate"
|
||||
* items:
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostTaxRatesTaxRateReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -10,13 +10,7 @@ import { IsString } from "class-validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - file_key
|
||||
* properties:
|
||||
* file_key:
|
||||
* description: "key of the file to delete"
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminDeleteUploadsReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -88,6 +82,16 @@ export default async (req, res) => {
|
||||
.send({ id: validated.file_key, object: "file", deleted: true })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminDeleteUploadsReq
|
||||
* type: object
|
||||
* required:
|
||||
* - file_key
|
||||
* properties:
|
||||
* file_key:
|
||||
* description: "key of the file to delete"
|
||||
* type: string
|
||||
*/
|
||||
export class AdminDeleteUploadsReq {
|
||||
@IsString()
|
||||
file_key: string
|
||||
|
||||
@@ -11,13 +11,7 @@ import { IsString } from "class-validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - file_key
|
||||
* properties:
|
||||
* file_key:
|
||||
* description: "key of the file to obtain the download link for"
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/AdminPostUploadsDownloadUrlReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -79,6 +73,16 @@ export default async (req, res) => {
|
||||
res.status(200).send({ download_url: url })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminPostUploadsDownloadUrlReq
|
||||
* type: object
|
||||
* required:
|
||||
* - file_key
|
||||
* properties:
|
||||
* file_key:
|
||||
* description: "key of the file to obtain the download link for"
|
||||
* type: string
|
||||
*/
|
||||
export class AdminPostUploadsDownloadUrlReq {
|
||||
@IsString()
|
||||
file_key: string
|
||||
|
||||
@@ -16,29 +16,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The Users email."
|
||||
* type: string
|
||||
* format: email
|
||||
* first_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* last_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* role:
|
||||
* description: "Userrole assigned to the user."
|
||||
* type: string
|
||||
* enum: [admin, member, developer]
|
||||
* password:
|
||||
* description: "The Users password."
|
||||
* type: string
|
||||
* format: password
|
||||
* $ref: "#/components/schemas/AdminCreateUserRequest"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -107,6 +85,32 @@ export default async (req, res) => {
|
||||
res.status(200).json({ user: _.omit(user, ["password_hash"]) })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminCreateUserRequest
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The Users email."
|
||||
* type: string
|
||||
* format: email
|
||||
* first_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* last_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* role:
|
||||
* description: "Userrole assigned to the user."
|
||||
* type: string
|
||||
* enum: [admin, member, developer]
|
||||
* password:
|
||||
* description: "The Users password."
|
||||
* type: string
|
||||
* format: password
|
||||
*/
|
||||
export class AdminCreateUserRequest {
|
||||
@IsEmail()
|
||||
email: string
|
||||
|
||||
@@ -13,14 +13,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The Users email."
|
||||
* type: string
|
||||
* format: email
|
||||
* $ref: "#/components/schemas/AdminResetPasswordTokenRequest"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -84,6 +77,17 @@ export default async (req, res) => {
|
||||
res.sendStatus(204)
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminResetPasswordTokenRequest
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The Users email."
|
||||
* type: string
|
||||
* format: email
|
||||
*/
|
||||
export class AdminResetPasswordTokenRequest {
|
||||
@IsEmail()
|
||||
email: string
|
||||
|
||||
@@ -18,22 +18,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - token
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The Users email."
|
||||
* type: string
|
||||
* format: email
|
||||
* token:
|
||||
* description: "The token generated from the 'password-token' endpoint."
|
||||
* type: string
|
||||
* password:
|
||||
* description: "The Users new password."
|
||||
* type: string
|
||||
* format: password
|
||||
* $ref: "#/components/schemas/AdminResetPasswordRequest"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -137,6 +122,25 @@ export type payload = {
|
||||
password: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminResetPasswordRequest
|
||||
* type: object
|
||||
* required:
|
||||
* - token
|
||||
* - password
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The Users email."
|
||||
* type: string
|
||||
* format: email
|
||||
* token:
|
||||
* description: "The token generated from the 'password-token' endpoint."
|
||||
* type: string
|
||||
* password:
|
||||
* description: "The Users new password."
|
||||
* type: string
|
||||
* format: password
|
||||
*/
|
||||
export class AdminResetPasswordRequest {
|
||||
@IsEmail()
|
||||
@IsOptional()
|
||||
|
||||
@@ -17,24 +17,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* first_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* last_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* role:
|
||||
* description: "Userrole assigned to the user."
|
||||
* type: string
|
||||
* enum: [admin, member, developer]
|
||||
* api_token:
|
||||
* description: "The api token of the User."
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/AdminUpdateUserRequest"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -101,6 +84,27 @@ export default async (req, res) => {
|
||||
res.status(200).json({ user: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminUpdateUserRequest
|
||||
* type: object
|
||||
* properties:
|
||||
* first_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* last_name:
|
||||
* description: "The name of the User."
|
||||
* type: string
|
||||
* role:
|
||||
* description: "Userrole assigned to the user."
|
||||
* type: string
|
||||
* enum: [admin, member, developer]
|
||||
* api_token:
|
||||
* description: "The api token of the User."
|
||||
* type: string
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs with additional information.
|
||||
* type: object
|
||||
*/
|
||||
export class AdminUpdateUserRequest {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -36,40 +36,7 @@ import PublishableAPIKeysFeatureFlag from "../../../../loaders/feature-flags/pub
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: The ID of the Region to create the Cart in.
|
||||
* sales_channel_id:
|
||||
* type: string
|
||||
* description: "[EXPERIMENTAL] The ID of the Sales channel to create the Cart in."
|
||||
* country_code:
|
||||
* type: string
|
||||
* description: "The 2 character ISO country code to create the Cart in."
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* items:
|
||||
* description: "An optional array of `variant_id`, `quantity` pairs to generate Line Items from."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The id of the Product Variant to generate a Line Item from.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Product Variant to add
|
||||
* type: integer
|
||||
* context:
|
||||
* description: "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`"
|
||||
* type: object
|
||||
* example:
|
||||
* ip: "::1"
|
||||
* user_agent: "Chrome"
|
||||
* $ref: "#/components/schemas/StorePostCartReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -223,6 +190,43 @@ export class Item {
|
||||
quantity: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartReq
|
||||
* type: object
|
||||
* properties:
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: The ID of the Region to create the Cart in.
|
||||
* sales_channel_id:
|
||||
* type: string
|
||||
* description: "[EXPERIMENTAL] The ID of the Sales channel to create the Cart in."
|
||||
* country_code:
|
||||
* type: string
|
||||
* description: "The 2 character ISO country code to create the Cart in."
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* items:
|
||||
* description: "An optional array of `variant_id`, `quantity` pairs to generate Line Items from."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The id of the Product Variant to generate a Line Item from.
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity of the Product Variant to add
|
||||
* type: integer
|
||||
* context:
|
||||
* description: "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`"
|
||||
* type: object
|
||||
* example:
|
||||
* ip: "::1"
|
||||
* user_agent: "Chrome"
|
||||
*/
|
||||
export class StorePostCartReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -26,67 +26,7 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: The id of the Region to create the Cart in.
|
||||
* country_code:
|
||||
* type: string
|
||||
* description: "The 2 character ISO country code to create the Cart in."
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* email:
|
||||
* type: string
|
||||
* description: "An email to be used on the Cart."
|
||||
* format: email
|
||||
* sales_channel_id:
|
||||
* type: string
|
||||
* description: The ID of the Sales channel to update the Cart with.
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/Address"
|
||||
* description: A full billing address object.
|
||||
* - type: string
|
||||
* description: The billing address ID
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/Address"
|
||||
* description: A full shipping address object.
|
||||
* - type: string
|
||||
* description: The shipping address ID
|
||||
* gift_cards:
|
||||
* description: "An array of Gift Card codes to add to the Cart."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: "The code that a Gift Card is identified by."
|
||||
* type: string
|
||||
* discounts:
|
||||
* description: "An array of Discount codes to add to the Cart."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: "The code that a Discount is identifed by."
|
||||
* type: string
|
||||
* customer_id:
|
||||
* description: "The ID of the Customer to associate the Cart with."
|
||||
* type: string
|
||||
* context:
|
||||
* description: "An optional object to provide context to the Cart."
|
||||
* type: object
|
||||
* example:
|
||||
* ip: "::1"
|
||||
* user_agent: "Chrome"
|
||||
* $ref: "#/components/schemas/StorePostCartsCartReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -174,6 +114,70 @@ class Discount {
|
||||
code: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCartsCartReq
|
||||
* type: object
|
||||
* properties:
|
||||
* region_id:
|
||||
* type: string
|
||||
* description: The id of the Region to create the Cart in.
|
||||
* country_code:
|
||||
* type: string
|
||||
* description: "The 2 character ISO country code to create the Cart in."
|
||||
* externalDocs:
|
||||
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
* description: See a list of codes.
|
||||
* email:
|
||||
* type: string
|
||||
* description: "An email to be used on the Cart."
|
||||
* format: email
|
||||
* sales_channel_id:
|
||||
* type: string
|
||||
* description: The ID of the Sales channel to update the Cart with.
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/Address"
|
||||
* description: A full billing address object.
|
||||
* - type: string
|
||||
* description: The billing address ID
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/Address"
|
||||
* description: A full shipping address object.
|
||||
* - type: string
|
||||
* description: The shipping address ID
|
||||
* gift_cards:
|
||||
* description: "An array of Gift Card codes to add to the Cart."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: "The code that a Gift Card is identified by."
|
||||
* type: string
|
||||
* discounts:
|
||||
* description: "An array of Discount codes to add to the Cart."
|
||||
* type: array
|
||||
* items:
|
||||
* required:
|
||||
* - code
|
||||
* properties:
|
||||
* code:
|
||||
* description: "The code that a Discount is identifed by."
|
||||
* type: string
|
||||
* customer_id:
|
||||
* description: "The ID of the Customer to associate the Cart with."
|
||||
* type: string
|
||||
* context:
|
||||
* description: "An optional object to provide context to the Cart."
|
||||
* type: object
|
||||
* example:
|
||||
* ip: "::1"
|
||||
* user_agent: "Chrome"
|
||||
*/
|
||||
export class StorePostCartsCartReq {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -16,22 +16,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - address
|
||||
* properties:
|
||||
* address:
|
||||
* description: "The Address to add to the Customer."
|
||||
* allOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - address_1
|
||||
* - city
|
||||
* - country_code
|
||||
* - postal_code
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerAddressesReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -125,6 +110,25 @@ export default async (req, res) => {
|
||||
res.status(200).json({ customer })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCustomersCustomerAddressesReq
|
||||
* type: object
|
||||
* required:
|
||||
* - address
|
||||
* properties:
|
||||
* address:
|
||||
* description: "The Address to add to the Customer."
|
||||
* allOf:
|
||||
* - $ref: "#/components/schemas/AddressFields"
|
||||
* - type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - address_1
|
||||
* - city
|
||||
* - country_code
|
||||
* - postal_code
|
||||
*/
|
||||
export class StorePostCustomersCustomerAddressesReq {
|
||||
@ValidateNested()
|
||||
@Type(() => AddressCreatePayload)
|
||||
|
||||
@@ -16,30 +16,7 @@ import { validator } from "../../../../utils/validator"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* first_name:
|
||||
* description: "The Customer's first name."
|
||||
* type: string
|
||||
* last_name:
|
||||
* description: "The Customer's last name."
|
||||
* type: string
|
||||
* email:
|
||||
* description: "The email of the customer."
|
||||
* type: string
|
||||
* format: email
|
||||
* password:
|
||||
* description: "The Customer's password."
|
||||
* type: string
|
||||
* format: password
|
||||
* phone:
|
||||
* description: "The Customer's phone number."
|
||||
* type: string
|
||||
* $ref: "#/components/schemas/StorePostCustomersReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -136,6 +113,33 @@ export default async (req, res) => {
|
||||
res.status(200).json({ customer })
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCustomersReq
|
||||
* type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - email
|
||||
* - password
|
||||
* properties:
|
||||
* first_name:
|
||||
* description: "The Customer's first name."
|
||||
* type: string
|
||||
* last_name:
|
||||
* description: "The Customer's last name."
|
||||
* type: string
|
||||
* email:
|
||||
* description: "The email of the customer."
|
||||
* type: string
|
||||
* format: email
|
||||
* password:
|
||||
* description: "The Customer's password."
|
||||
* type: string
|
||||
* format: password
|
||||
* phone:
|
||||
* description: "The Customer's phone number."
|
||||
* type: string
|
||||
*/
|
||||
export class StorePostCustomersReq {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -12,14 +12,7 @@ import { EntityManager } from "typeorm"
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The email of the customer."
|
||||
* type: string
|
||||
* format: email
|
||||
* $ref: "#/components/schemas/StorePostCustomersCustomerPasswordTokenReq"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -86,6 +79,17 @@ export default async (req, res) => {
|
||||
res.sendStatus(204)
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema StorePostCustomersCustomerPasswordTokenReq
|
||||
* type: object
|
||||
* required:
|
||||
* - email
|
||||
* properties:
|
||||
* email:
|
||||
* description: "The email of the customer."
|
||||
* type: string
|
||||
* format: email
|
||||
*/
|
||||
export class StorePostCustomersCustomerPasswordTokenReq {
|
||||
@IsEmail()
|
||||
email: string
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user