diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index da98f41bb2354..9be209b094dcd 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -1605,6 +1605,305 @@ paths: application/json: schema: $ref: '#/components/schemas/AdminCurrenciesRes' + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersReq' + tags: + - Customer + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.create({ + email: 'user@example.com', + first_name: 'Caterina', + last_name: 'Yost', + password: 'supersecret' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/customers' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "first_name": "Caterina", + "last_name": "Yost", + "password": "supersecret" + }' + security: + - api_token: [] + - cookie_auth: [] + responses: + '201': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + get: + operationId: GetCustomers + summary: List Customers + description: Retrieves a list of Customers. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to return. + schema: + type: integer + default: 50 + - in: query + name: offset + description: The items to skip before result. + schema: + type: integer + default: 0 + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: q + description: 'a search term to search email, first_name, and last_name.' + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.list() + + .then(({ customers, limit, offset, count }) => { + console.log(customers.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/customers' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/customers/{id}': + get: + operationId: GetCustomersCustomer + summary: Get a Customer + description: Retrieves a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the customer. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.retrieve(customer_id) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/customers/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + post: + operationId: PostCustomersCustomer + summary: Update a Customer + description: Updates a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersCustomerReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.customers.update(customer_id, { + first_name: 'Dolly' + }) + + .then(({ customer }) => { + console.log(customer.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/customers/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "first_name": "Dolly" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/customer-groups/{id}/customers/batch': post: operationId: PostCustomerGroupsGroupCustomersBatch @@ -1959,146 +2258,13 @@ paths: name: limit description: Limit the number of customer groups returned. schema: - type: integer - default: 10 - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each customer - groups of the result. - schema: - type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customerGroups.list() - - .then(({ customer_groups, limit, offset, count }) => { - console.log(customer_groups.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/customer-groups' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer Group - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomerGroupsListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/customer-groups/{id}': - delete: - operationId: DeleteCustomerGroupsCustomerGroup - summary: Delete a Customer Group - description: Deletes a CustomerGroup. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Customer Group - schema: - type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customerGroups.delete(customer_group_id) - - .then(({ id, object, deleted }) => { - console.log(id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/customer-groups/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer Group - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomerGroupsDeleteRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetCustomerGroupsGroup - summary: Get a Customer Group - description: Retrieves a Customer Group. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Customer Group. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in the customer - group. - schema: - type: string + type: integer + default: 10 - in: query - name: fields + name: expand description: >- - (Comma separated) Which fields should be included in the customer - group. + (Comma separated) Which fields should be expanded in each customer + groups of the result. schema: type: string x-codeSamples: @@ -2112,16 +2278,16 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.retrieve(customer_group_id) + medusa.admin.customerGroups.list() - .then(({ customer_group }) => { - console.log(customer_group.id); + .then(({ customer_groups, limit, offset, count }) => { + console.log(customer_groups.length); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/customer-groups/{id}' \ + 'https://medusa-url.com/admin/customer-groups' \ --header 'Authorization: Bearer {api_token}' security: @@ -2135,7 +2301,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminCustomerGroupsListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2148,23 +2314,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - post: - operationId: PostCustomerGroupsGroup - summary: Update a Customer Group - description: Update a CustomerGroup. + '/customer-groups/{id}': + delete: + operationId: DeleteCustomerGroupsCustomerGroup + summary: Delete a Customer Group + description: Deletes a CustomerGroup. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the customer group. + description: The ID of the Customer Group schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomerGroupsGroupReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -2176,26 +2338,18 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.update(customer_group_id, { - name: 'VIP' - }) + medusa.admin.customerGroups.delete(customer_group_id) - .then(({ customer_group }) => { - console.log(customer_group.id); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request POST + curl --location --request DELETE 'https://medusa-url.com/admin/customer-groups/{id}' \ - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "name": "VIP" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] @@ -2207,7 +2361,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminCustomerGroupsDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2220,164 +2374,30 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/customer-groups/{id}/customers': get: - operationId: GetCustomerGroupsGroupCustomers - summary: List Customers - description: Retrieves a list of customers in a customer group + operationId: GetCustomerGroupsGroup + summary: Get a Customer Group + description: Retrieves a Customer Group. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the customer group. + description: The ID of the Customer Group. schema: type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customerGroups.listCustomers(customer_group_id) - - .then(({ customers }) => { - console.log(customers.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/admin/customer-groups/{id}/customers' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Customer Group - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersReq' - tags: - - Customer - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customers.create({ - email: 'user@example.com', - first_name: 'Caterina', - last_name: 'Yost', - password: 'supersecret' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/customers' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com", - "first_name": "Caterina", - "last_name": "Yost", - "password": "supersecret" - }' - security: - - api_token: [] - - cookie_auth: [] - responses: - '201': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetCustomers - summary: List Customers - description: Retrieves a list of Customers. - x-authenticated: true - parameters: - - in: query - name: limit - description: The number of items to return. - schema: - type: integer - default: 50 - - in: query - name: offset - description: The items to skip before result. - schema: - type: integer - default: 0 - in: query name: expand - description: (Comma separated) Which fields should be expanded in each customer. + description: >- + (Comma separated) Which fields should be expanded in the customer + group. schema: type: string - in: query - name: q - description: 'a search term to search email, first_name, and last_name.' + name: fields + description: >- + (Comma separated) Which fields should be included in the customer + group. schema: type: string x-codeSamples: @@ -2391,30 +2411,30 @@ paths: // must be previously logged in or use api token - medusa.admin.customers.list() + medusa.admin.customerGroups.retrieve(customer_group_id) - .then(({ customers, limit, offset, count }) => { - console.log(customers.length); + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/customers' \ + 'https://medusa-url.com/admin/customer-groups/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Customer + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomersListRes' + $ref: '#/components/schemas/AdminCustomerGroupsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2427,29 +2447,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/customers/{id}': - get: - operationId: GetCustomersCustomer - summary: Get a Customer - description: Retrieves a Customer. + post: + operationId: PostCustomerGroupsGroup + summary: Update a Customer Group + description: Update a CustomerGroup. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Customer. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in the customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be included in the customer. + description: The ID of the customer group. schema: type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomerGroupsGroupReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -2461,30 +2475,38 @@ paths: // must be previously logged in or use api token - medusa.admin.customers.retrieve(customer_id) - - .then(({ customer }) => { - console.log(customer.id); + medusa.admin.customerGroups.update(customer_group_id, { + name: 'VIP' + }) + + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/customers/{id}' \ + curl --location --request POST + 'https://medusa-url.com/admin/customer-groups/{id}' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "name": "VIP" + }' security: - api_token: [] - cookie_auth: [] tags: - - Customer + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomersRes' + $ref: '#/components/schemas/AdminCustomerGroupsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2497,33 +2519,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - post: - operationId: PostCustomersCustomer - summary: Update a Customer - description: Updates a Customer. + '/customer-groups/{id}/customers': + get: + operationId: GetCustomerGroupsGroupCustomers + summary: List Customers + description: Retrieves a list of customers in a customer group x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Customer. - schema: - type: string - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in each customer. + description: The ID of the customer group. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersCustomerReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -2535,38 +2543,30 @@ paths: // must be previously logged in or use api token - medusa.admin.customers.update(customer_id, { - first_name: 'Dolly' - }) + medusa.admin.customerGroups.listCustomers(customer_group_id) - .then(({ customer }) => { - console.log(customer.id); + .then(({ customers }) => { + console.log(customers.length); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/customers/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request GET + 'https://medusa-url.com/admin/customer-groups/{id}/customers' \ - --data-raw '{ - "first_name": "Dolly" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Customer + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomersRes' + $ref: '#/components/schemas/AdminCustomersListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -18667,7 +18667,7 @@ components: ```tsx @@ -24726,80 +24726,6 @@ components: includes_tax: type: boolean description: '[EXPERIMENTAL] Tax included in prices of currency.' - 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 - 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 - AdminCustomerGroupsRes: - type: object - properties: - customer_group: - $ref: '#/components/schemas/CustomerGroup' - AdminCustomerGroupsDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted customer group. - object: - type: string - description: The type of the object that was deleted. - default: customer_group - deleted: - type: boolean - description: Whether the customer group was deleted successfully or not. - default: true - AdminCustomerGroupsListRes: - type: object - properties: - customer_groups: - type: array - items: - $ref: '#/components/schemas/CustomerGroup' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - AdminPostCustomerGroupsGroupReq: - type: object - properties: - name: - description: Name of the customer group - type: string - metadata: - description: Metadata for the customer. - type: object AdminPostCustomersReq: type: object required: @@ -24872,6 +24798,7 @@ components: groups: type: array items: + type: object required: - id properties: @@ -24882,6 +24809,82 @@ components: metadata: description: An optional set of key-value pairs to hold additional information. type: object + AdminPostCustomerGroupsGroupCustomersBatchReq: + type: object + required: + - customer_ids + properties: + customer_ids: + description: The ids of the customers to add + type: array + items: + type: object + required: + - id + properties: + id: + description: ID of the customer + type: string + AdminDeleteCustomerGroupsGroupCustomerBatchReq: + type: object + required: + - customer_ids + properties: + customer_ids: + description: The ids of the customers to remove + type: array + items: + type: object + required: + - id + properties: + id: + description: ID of the customer + type: string + AdminCustomerGroupsRes: + type: object + properties: + customer_group: + $ref: '#/components/schemas/CustomerGroup' + AdminCustomerGroupsDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted customer group. + object: + type: string + description: The type of the object that was deleted. + default: customer_group + deleted: + type: boolean + description: Whether the customer group was deleted successfully or not. + default: true + AdminCustomerGroupsListRes: + type: object + properties: + customer_groups: + type: array + items: + $ref: '#/components/schemas/CustomerGroup' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + AdminPostCustomerGroupsGroupReq: + type: object + properties: + name: + description: Name of the customer group + type: string + metadata: + description: Metadata for the customer. + type: object AdminPostDiscountsDiscountConditionsConditionBatchReq: type: object required: @@ -24891,6 +24894,7 @@ components: description: The resources to be added to the discount condition type: array items: + type: object required: - id properties: @@ -25081,6 +25085,7 @@ components: description: The resources to be deleted from the discount condition type: array items: + type: object required: - id properties: @@ -25860,6 +25865,7 @@ components: description: The Claim Items that the Claim will consist of. type: array items: + type: object required: - item_id - quantity @@ -25910,6 +25916,7 @@ components: Replace. type: array items: + type: object required: - variant_id - quantity @@ -25924,6 +25931,7 @@ components: description: The Shipping Methods to send the additional Line Items with. type: array items: + type: object properties: id: description: The ID of an existing Shipping Method @@ -25958,6 +25966,7 @@ components: description: The Line Items to include in the Fulfillment. type: array items: + type: object required: - item_id - quantity @@ -26028,6 +26037,7 @@ components: description: The Line Items to return as part of the Swap. type: array items: + type: object required: - item_id - quantity @@ -26062,6 +26072,7 @@ components: description: The new items to send to the Customer. type: array items: + type: object required: - variant_id - quantity @@ -26078,6 +26089,7 @@ components: from. type: array items: + type: object required: - option_id - price @@ -26161,6 +26173,7 @@ components: description: The Line Items that will be returned. type: array items: + type: object required: - item_id - quantity @@ -26213,6 +26226,7 @@ components: description: The Claim Items that the Claim will consist of. type: array items: + type: object required: - id - images @@ -26271,6 +26285,7 @@ components: description: The Shipping Methods to send the additional Line Items with. type: array items: + type: object properties: id: description: The ID of an existing Shipping Method @@ -26413,6 +26428,7 @@ components: description: The prices to update or add. type: array items: + type: object required: - amount - variant_id @@ -26488,6 +26504,7 @@ components: description: The prices of the Price List. type: array items: + type: object required: - amount - variant_id @@ -26521,6 +26538,7 @@ components: type: array description: A list of customer groups that the Price List applies to. items: + type: object required: - id properties: @@ -26670,6 +26688,7 @@ components: description: The prices of the Price List. type: array items: + type: object required: - amount - variant_id @@ -26706,6 +26725,7 @@ components: type: array description: A list of customer groups that the Price List applies to. items: + type: object required: - id properties: @@ -26861,6 +26881,7 @@ components: description: Tags to associate the Product with. type: array items: + type: object required: - value properties: @@ -26874,6 +26895,7 @@ components: description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + type: object required: - id properties: @@ -26886,6 +26908,7 @@ components: properties the Product's Product Variants will differ. type: array items: + type: object required: - title properties: @@ -26896,6 +26919,7 @@ components: description: A list of Product Variants to create with the Product. type: array items: + type: object required: - title properties: @@ -26960,6 +26984,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -26989,6 +27014,7 @@ components: options: type: array items: + type: object required: - value properties: @@ -27089,6 +27115,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -27120,6 +27147,7 @@ components: options: type: array items: + type: object required: - option_id - value @@ -27223,6 +27251,7 @@ components: tags: type: array items: + type: object properties: id: description: The ID of the tag. @@ -27313,6 +27342,7 @@ components: description: Tags to associate the Product with. type: array items: + type: object required: - value properties: @@ -27326,6 +27356,7 @@ components: description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + type: object required: - id properties: @@ -27336,6 +27367,7 @@ components: description: A list of Product Variants to create with the Product. type: array items: + type: object properties: id: description: The ID of the Product Variant. @@ -27400,6 +27432,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -27432,6 +27465,7 @@ components: options: type: array items: + type: object required: - option_id - value @@ -27529,6 +27563,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -27560,6 +27595,7 @@ components: options: type: array items: + type: object required: - option_id - value @@ -27979,6 +28015,7 @@ components: description: The Line Items that have been received. type: array items: + type: object required: - item_id - quantity @@ -28156,6 +28193,7 @@ components: be available. type: array items: + type: object required: - type - amount @@ -28235,6 +28273,7 @@ components: be available. type: array items: + type: object required: - type - amount diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index da98f41bb2354..2ae8551387c0d 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -260,167 +260,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /auth: - post: - operationId: PostAuth - summary: User Login - x-authenticated: false - description: Logs a User in and authorizes them to manage Store settings. - parameters: [] - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - password - properties: - email: - type: string - description: The User's email. - password: - type: string - description: The User's password. - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.admin.auth.createSession({ - email: 'user@example.com', - password: 'supersecret' - }).then((({ user }) => { - console.log(user.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request POST 'https://medusa-url.com/admin/auth' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "email": "user@example.com", - "password": "supersecret" - }' - tags: - - Auth - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminAuthRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/incorrect_credentials' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - delete: - operationId: DeleteAuth - summary: User Logout - x-authenticated: true - description: Deletes the current session for the logged in user. - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.auth.deleteSession() - - lang: Shell - label: cURL - source: > - curl --location --request DELETE 'https://medusa-url.com/admin/auth' - \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Auth - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - get: - operationId: GetAuth - summary: Get Current User - x-authenticated: true - description: Gets the currently logged in User. - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.auth.getSession() - - .then(({ user }) => { - console.log(user.id); - }); - - lang: Shell - label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/auth' \ - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Auth - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminAuthRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' '/batch-jobs/{id}/cancel': post: operationId: PostBatchJobsBatchJobCancel @@ -956,132 +795,149 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/collections/{id}/products/batch': - post: - operationId: PostProductsToCollection - summary: Update Products - description: Updates products associated with a Product Collection + /currencies: + get: + operationId: GetCurrencies + summary: List Currency + description: Retrieves a list of Currency x-authenticated: true parameters: - - in: path - name: id - required: true - description: The ID of the Collection. + - in: query + name: code + description: Code of the currency to search for. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostProductsToCollectionReq' + - in: query + name: includes_tax + description: Search for tax inclusive currencies. + schema: + type: boolean + - in: query + name: order + description: order to retrieve products in. + schema: + type: string + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: number + default: '0' + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: number + default: '20' x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.currencies.list() + + .then(({ currencies, count, offset, limit }) => { + console.log(currencies.length); + }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/collections/{id}/products/batch' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + 'https://medusa-url.com/admin/currencies' \ - --data-raw '{ - "product_ids": [ - "prod_01G1G5V2MBA328390B5AXJ610F" - ] - }' - security: - - api_token: [] - - cookie_auth: [] + --header 'Authorization: Bearer {api_token}' tags: - - Collection + - Currency responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCollectionsRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - delete: - operationId: DeleteProductsFromCollection - summary: Remove Product - description: Removes products associated with a Product Collection - x-authenticated: true - parameters: + $ref: '#/components/schemas/AdminCurrenciesListRes' + '/currencies/{code}': + post: + operationId: PostCurrenciesCurrency + summary: Update a Currency + description: Update a Currency + x-authenticated: true + parameters: - in: path - name: id + name: code required: true - description: The ID of the Collection. + description: The code of the Currency. schema: type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminDeleteProductsFromCollectionReq' + $ref: '#/components/schemas/AdminPostCurrenciesCurrencyReq' x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.currencies.update(code, { + includes_tax: true + }) + + .then(({ currency }) => { + console.log(currency.id); + }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/collections/{id}/products/batch' \ + curl --location --request POST + 'https://medusa-url.com/admin/currencies/{code}' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "product_ids": [ - "prod_01G1G5V2MBA328390B5AXJ610F" - ] + "includes_tax": true }' - security: - - api_token: [] - - cookie_auth: [] tags: - - Collection + - Currency responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDeleteProductsFromCollectionRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /collections: + $ref: '#/components/schemas/AdminCurrenciesRes' + '/customer-groups/{id}/customers/batch': post: - operationId: PostCollections - summary: Create a Collection - description: Creates a Product Collection. + operationId: PostCustomerGroupsGroupCustomersBatch + summary: Add Customers + description: 'Adds a list of customers, represented by id''s, to a customer group.' x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the customer group. + schema: + type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostCollectionsReq' + $ref: >- + #/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq x-codeSamples: - lang: JavaScript label: JS Client @@ -1093,38 +949,47 @@ paths: // must be previously logged in or use api token - medusa.admin.collections.create({ - title: 'New Collection' + medusa.admin.customerGroups.addCustomers(customer_group_id, { + customer_ids: [ + { + id: customer_id + } + ] }) - .then(({ collection }) => { - console.log(collection.id); + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/collections' \ + 'https://medusa-url.com/admin/customer-groups/{id}/customers/batch' + \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "title": "New Collection" + "customer_ids": [ + { + "id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2" + } + ] }' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCollectionsRes' + $ref: '#/components/schemas/AdminCustomerGroupsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1137,112 +1002,24 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetCollections - summary: List Collections - description: Retrieve a list of Product Collection. + delete: + operationId: DeleteCustomerGroupsGroupCustomerBatch + summary: Remove Customers + description: 'Removes a list of customers, represented by id''s, from a customer group.' x-authenticated: true parameters: - - in: query - name: limit - description: The number of collections to return. - schema: - type: integer - default: 10 - - in: query - name: offset - description: The number of collections to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: title - description: The title of collections to return. - schema: - type: string - - in: query - name: handle - description: The handle of collections to return. - schema: - type: string - - in: query - name: q - description: a search term to search titles and handles. - schema: - type: string - - in: query - name: discount_condition_id - description: >- - The discount condition id on which to filter the product - collections. + - in: path + name: id + required: true + description: The ID of the customer group. schema: type: string - - in: query - name: created_at - description: Date comparison for when resulting collections were created. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - - in: query - name: updated_at - description: Date comparison for when resulting collections were updated. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - - in: query - name: deleted_at - description: Date comparison for when resulting collections were deleted. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq x-codeSamples: - lang: JavaScript label: JS Client @@ -1254,30 +1031,47 @@ paths: // must be previously logged in or use api token - medusa.admin.collections.list() + medusa.admin.customerGroups.removeCustomers(customer_group_id, { + customer_ids: [ + { + id: customer_id + } + ] + }) - .then(({ collections, limit, offset, count }) => { - console.log(collections.length); + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/collections' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/customer-groups/{id}/customers/batch' + \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "customer_ids": [ + { + "id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2" + } + ] + }' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCollectionsListRes' + $ref: '#/components/schemas/AdminCustomerGroupsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1290,19 +1084,13 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/collections/{id}': - delete: - operationId: DeleteCollectionsCollection - summary: Delete a Collection - description: Deletes a Product Collection. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Collection. - schema: - type: string + /customer-groups: + post: + operationId: PostCustomerGroups + summary: Create a Customer Group + description: Creates a CustomerGroup. + x-authenticated: true + parameters: [] x-codeSamples: - lang: JavaScript label: JS Client @@ -1314,30 +1102,38 @@ paths: // must be previously logged in or use api token - medusa.admin.collections.delete(collection_id) + medusa.admin.customerGroups.create({ + name: 'VIP' + }) - .then(({ id, object, deleted }) => { - console.log(id); + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/collections/{id}' \ + curl --location --request POST + 'https://medusa-url.com/admin/customer-groups' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "name": "VIP" + }' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCollectionsDeleteRes' + $ref: '#/components/schemas/AdminCustomerGroupsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1350,16 +1146,140 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + description: Name of the customer group + metadata: + type: object + description: Metadata for the customer. get: - operationId: GetCollectionsCollection - summary: Get a Collection - description: Retrieves a Product Collection. + operationId: GetCustomerGroups + summary: List Customer Groups + description: Retrieve a list of customer groups. x-authenticated: true parameters: - - in: path + - in: query + name: q + description: Query used for searching customer group names. + schema: + type: string + - in: query + name: offset + description: How many groups to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: order + description: the field used to order the customer groups. + schema: + type: string + - in: query + name: discount_condition_id + description: The discount condition id on which to filter the customer groups. + schema: + type: string + - in: query name: id - required: true - description: The ID of the Product Collection + style: form + explode: false + description: Filter by the customer group ID + schema: + oneOf: + - type: string + description: customer group ID + - type: array + description: multiple customer group IDs + items: + type: string + - type: object + properties: + lt: + type: string + description: filter by IDs less than this ID + gt: + type: string + description: filter by IDs greater than this ID + lte: + type: string + description: filter by IDs less than or equal to this ID + gte: + type: string + description: filter by IDs greater than or equal to this ID + - in: query + name: name + style: form + explode: false + description: Filter by the customer group name + schema: + type: array + description: multiple customer group names + items: + type: string + description: customer group name + - in: query + name: created_at + description: Date comparison for when resulting customer groups were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting customer groups were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: limit + description: Limit the number of customer groups returned. + schema: + type: integer + default: 10 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each customer + groups of the result. schema: type: string x-codeSamples: @@ -1373,30 +1293,30 @@ paths: // must be previously logged in or use api token - medusa.admin.collections.retrieve(collection_id) + medusa.admin.customerGroups.list() - .then(({ collection }) => { - console.log(collection.id); + .then(({ customer_groups, limit, offset, count }) => { + console.log(customer_groups.length); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/collections/{id}' \ + 'https://medusa-url.com/admin/customer-groups' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCollectionsRes' + $ref: '#/components/schemas/AdminCustomerGroupsListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1409,23 +1329,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - post: - operationId: PostCollectionsCollection - summary: Update a Collection - description: Updates a Product Collection. + '/customer-groups/{id}': + delete: + operationId: DeleteCustomerGroupsCustomerGroup + summary: Delete a Customer Group + description: Deletes a CustomerGroup. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Collection. + description: The ID of the Customer Group schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCollectionsCollectionReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -1437,38 +1353,30 @@ paths: // must be previously logged in or use api token - medusa.admin.collections.update(collection_id, { - title: 'New Collection' - }) + medusa.admin.customerGroups.delete(customer_group_id) - .then(({ collection }) => { - console.log(collection.id); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/collections/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/customer-groups/{id}' \ - --data-raw '{ - "title": "New Collection" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Collection + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCollectionsRes' + $ref: '#/components/schemas/AdminCustomerGroupsDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1481,40 +1389,32 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /currencies: get: - operationId: GetCurrencies - summary: List Currency - description: Retrieves a list of Currency + operationId: GetCustomerGroupsGroup + summary: Get a Customer Group + description: Retrieves a Customer Group. x-authenticated: true parameters: - - in: query - name: code - description: Code of the currency to search for. + - in: path + name: id + required: true + description: The ID of the Customer Group. schema: type: string - in: query - name: includes_tax - description: Search for tax inclusive currencies. + name: expand + description: >- + (Comma separated) Which fields should be expanded in the customer + group. schema: - type: boolean + type: string - in: query - name: order - description: order to retrieve products in. + name: fields + description: >- + (Comma separated) Which fields should be included in the customer + group. schema: type: string - - in: query - name: offset - description: How many products to skip in the result. - schema: - type: number - default: '0' - - in: query - name: limit - description: Limit the number of products returned. - schema: - type: number - default: '20' x-codeSamples: - lang: JavaScript label: JS Client @@ -1526,45 +1426,59 @@ paths: // must be previously logged in or use api token - medusa.admin.currencies.list() + medusa.admin.customerGroups.retrieve(customer_group_id) - .then(({ currencies, count, offset, limit }) => { - console.log(currencies.length); + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/currencies' \ + curl --location --request GET + 'https://medusa-url.com/admin/customer-groups/{id}' \ --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] tags: - - Currency + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCurrenciesListRes' - '/currencies/{code}': + $ref: '#/components/schemas/AdminCustomerGroupsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' post: - operationId: PostCurrenciesCurrency - summary: Update a Currency - description: Update a Currency + operationId: PostCustomerGroupsGroup + summary: Update a Customer Group + description: Update a CustomerGroup. x-authenticated: true parameters: - in: path - name: code + name: id required: true - description: The code of the Currency. + description: The ID of the customer group. schema: type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostCurrenciesCurrencyReq' + $ref: '#/components/schemas/AdminPostCustomerGroupsGroupReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -1576,40 +1490,55 @@ paths: // must be previously logged in or use api token - medusa.admin.currencies.update(code, { - includes_tax: true + medusa.admin.customerGroups.update(customer_group_id, { + name: 'VIP' }) - .then(({ currency }) => { - console.log(currency.id); + .then(({ customer_group }) => { + console.log(customer_group.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/currencies/{code}' \ + 'https://medusa-url.com/admin/customer-groups/{id}' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "includes_tax": true + "name": "VIP" }' + security: + - api_token: [] + - cookie_auth: [] tags: - - Currency + - Customer Group responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCurrenciesRes' - '/customer-groups/{id}/customers/batch': - post: - operationId: PostCustomerGroupsGroupCustomersBatch - summary: Add Customers - description: 'Adds a list of customers, represented by id''s, to a customer group.' + $ref: '#/components/schemas/AdminCustomerGroupsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/customer-groups/{id}/customers': + get: + operationId: GetCustomerGroupsGroupCustomers + summary: List Customers + description: Retrieves a list of customers in a customer group x-authenticated: true parameters: - in: path @@ -1618,12 +1547,6 @@ paths: description: The ID of the customer group. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq x-codeSamples: - lang: JavaScript label: JS Client @@ -1635,47 +1558,88 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.addCustomers(customer_group_id, { - customer_ids: [ - { - id: customer_id - } - ] - }) + medusa.admin.customerGroups.listCustomers(customer_group_id) - .then(({ customer_group }) => { - console.log(customer_group.id); + .then(({ customers }) => { + console.log(customers.length); }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/customer-groups/{id}/customers' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminCustomersListRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/collections/{id}/products/batch': + post: + operationId: PostProductsToCollection + summary: Update Products + description: Updates products associated with a Product Collection + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostProductsToCollectionReq' + x-codeSamples: - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/customer-groups/{id}/customers/batch' - \ + 'https://medusa-url.com/admin/collections/{id}/products/batch' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "customer_ids": [ - { - "id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2" - } + "product_ids": [ + "prod_01G1G5V2MBA328390B5AXJ610F" ] }' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminCollectionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1689,75 +1653,50 @@ paths: '500': $ref: '#/components/responses/500_error' delete: - operationId: DeleteCustomerGroupsGroupCustomerBatch - summary: Remove Customers - description: 'Removes a list of customers, represented by id''s, from a customer group.' + operationId: DeleteProductsFromCollection + summary: Remove Product + description: Removes products associated with a Product Collection x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the customer group. + description: The ID of the Collection. schema: type: string requestBody: content: application/json: schema: - $ref: >- - #/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq + $ref: '#/components/schemas/AdminDeleteProductsFromCollectionReq' x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customerGroups.removeCustomers(customer_group_id, { - customer_ids: [ - { - id: customer_id - } - ] - }) - - .then(({ customer_group }) => { - console.log(customer_group.id); - }); - lang: Shell label: cURL source: > curl --location --request DELETE - 'https://medusa-url.com/admin/customer-groups/{id}/customers/batch' - \ + 'https://medusa-url.com/admin/collections/{id}/products/batch' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "customer_ids": [ - { - "id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2" - } + "product_ids": [ + "prod_01G1G5V2MBA328390B5AXJ610F" ] }' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminDeleteProductsFromCollectionRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1770,13 +1709,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /customer-groups: + /collections: post: - operationId: PostCustomerGroups - summary: Create a Customer Group - description: Creates a CustomerGroup. + operationId: PostCollections + summary: Create a Collection + description: Creates a Product Collection. x-authenticated: true - parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCollectionsReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -1788,38 +1731,38 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.create({ - name: 'VIP' + medusa.admin.collections.create({ + title: 'New Collection' }) - .then(({ customer_group }) => { - console.log(customer_group.id); + .then(({ collection }) => { + console.log(collection.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/customer-groups' \ + 'https://medusa-url.com/admin/collections' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "name": "VIP" + "title": "New Collection" }' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminCollectionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -1832,88 +1775,49 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - requestBody: - content: - application/json: - schema: - type: object - required: - - name - properties: - name: - type: string - description: Name of the customer group - metadata: - type: object - description: Metadata for the customer. get: - operationId: GetCustomerGroups - summary: List Customer Groups - description: Retrieve a list of customer groups. + operationId: GetCollections + summary: List Collections + description: Retrieve a list of Product Collection. x-authenticated: true parameters: - in: query - name: q - description: Query used for searching customer group names. + name: limit + description: The number of collections to return. schema: - type: string + type: integer + default: 10 - in: query name: offset - description: How many groups to skip in the result. + description: The number of collections to skip before the results. schema: type: integer default: 0 - in: query - name: order - description: the field used to order the customer groups. + name: title + description: The title of collections to return. schema: type: string - in: query - name: discount_condition_id - description: The discount condition id on which to filter the customer groups. + name: handle + description: The handle of collections to return. schema: type: string - in: query - name: id - style: form - explode: false - description: Filter by the customer group ID + name: q + description: a search term to search titles and handles. schema: - oneOf: - - type: string - description: customer group ID - - type: array - description: multiple customer group IDs - items: - type: string - - type: object - properties: - lt: - type: string - description: filter by IDs less than this ID - gt: - type: string - description: filter by IDs greater than this ID - lte: - type: string - description: filter by IDs less than or equal to this ID - gte: - type: string - description: filter by IDs greater than or equal to this ID + type: string - in: query - name: name - style: form - explode: false - description: Filter by the customer group name + name: discount_condition_id + description: >- + The discount condition id on which to filter the product + collections. schema: - type: array - description: multiple customer group names - items: - type: string - description: customer group name + type: string - in: query name: created_at - description: Date comparison for when resulting customer groups were created. + description: Date comparison for when resulting collections were created. schema: type: object properties: @@ -1935,7 +1839,7 @@ paths: format: date - in: query name: updated_at - description: Date comparison for when resulting customer groups were updated. + description: Date comparison for when resulting collections were updated. schema: type: object properties: @@ -1956,18 +1860,27 @@ paths: description: filter by dates greater than or equal to this date format: date - in: query - name: limit - description: Limit the number of customer groups returned. - schema: - type: integer - default: 10 - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each customer - groups of the result. + name: deleted_at + description: Date comparison for when resulting collections were deleted. schema: - type: string + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date x-codeSamples: - lang: JavaScript label: JS Client @@ -1979,30 +1892,30 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.list() + medusa.admin.collections.list() - .then(({ customer_groups, limit, offset, count }) => { - console.log(customer_groups.length); + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/customer-groups' \ + 'https://medusa-url.com/admin/collections' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsListRes' + $ref: '#/components/schemas/AdminCollectionsListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2015,17 +1928,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/customer-groups/{id}': + '/collections/{id}': delete: - operationId: DeleteCustomerGroupsCustomerGroup - summary: Delete a Customer Group - description: Deletes a CustomerGroup. + operationId: DeleteCollectionsCollection + summary: Delete a Collection + description: Deletes a Product Collection. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Customer Group + description: The ID of the Collection. schema: type: string x-codeSamples: @@ -2039,7 +1952,7 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.delete(customer_group_id) + medusa.admin.collections.delete(collection_id) .then(({ id, object, deleted }) => { console.log(id); @@ -2048,21 +1961,21 @@ paths: label: cURL source: > curl --location --request DELETE - 'https://medusa-url.com/admin/customer-groups/{id}' \ + 'https://medusa-url.com/admin/collections/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsDeleteRes' + $ref: '#/components/schemas/AdminCollectionsDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2076,29 +1989,15 @@ paths: '500': $ref: '#/components/responses/500_error' get: - operationId: GetCustomerGroupsGroup - summary: Get a Customer Group - description: Retrieves a Customer Group. + operationId: GetCollectionsCollection + summary: Get a Collection + description: Retrieves a Product Collection. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Customer Group. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in the customer - group. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in the customer - group. + description: The ID of the Product Collection schema: type: string x-codeSamples: @@ -2112,30 +2011,30 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.retrieve(customer_group_id) + medusa.admin.collections.retrieve(collection_id) - .then(({ customer_group }) => { - console.log(customer_group.id); + .then(({ collection }) => { + console.log(collection.id); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/admin/customer-groups/{id}' \ + 'https://medusa-url.com/admin/collections/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminCollectionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2149,22 +2048,22 @@ paths: '500': $ref: '#/components/responses/500_error' post: - operationId: PostCustomerGroupsGroup - summary: Update a Customer Group - description: Update a CustomerGroup. + operationId: PostCollectionsCollection + summary: Update a Collection + description: Updates a Product Collection. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the customer group. + description: The ID of the Collection. schema: type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostCustomerGroupsGroupReq' + $ref: '#/components/schemas/AdminPostCollectionsCollectionReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -2176,38 +2075,38 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.update(customer_group_id, { - name: 'VIP' + medusa.admin.collections.update(collection_id, { + title: 'New Collection' }) - .then(({ customer_group }) => { - console.log(customer_group.id); + .then(({ collection }) => { + console.log(collection.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/customer-groups/{id}' \ + 'https://medusa-url.com/admin/collections/{id}' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "name": "VIP" + "title": "New Collection" }' security: - api_token: [] - cookie_auth: [] tags: - - Customer Group + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomerGroupsRes' + $ref: '#/components/schemas/AdminCollectionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2220,19 +2119,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/customer-groups/{id}/customers': - get: - operationId: GetCustomerGroupsGroupCustomers - summary: List Customers - description: Retrieves a list of customers in a customer group + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the customer group. - schema: - type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostCustomersReq' + tags: + - Customer x-codeSamples: - lang: JavaScript label: JS Client @@ -2244,102 +2143,42 @@ paths: // must be previously logged in or use api token - medusa.admin.customerGroups.listCustomers(customer_group_id) + medusa.admin.customers.create({ + email: 'user@example.com', + first_name: 'Caterina', + last_name: 'Yost', + password: 'supersecret' + }) - .then(({ customers }) => { - console.log(customers.length); + .then(({ customer }) => { + console.log(customer.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/customer-groups/{id}/customers' \ + curl --location --request POST + 'https://medusa-url.com/admin/customers' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com", + "first_name": "Caterina", + "last_name": "Yost", + "password": "supersecret" + }' security: - api_token: [] - cookie_auth: [] - tags: - - Customer Group responses: - '200': + '201': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminCustomersListRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostCustomersReq' - tags: - - Customer - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.admin.customers.create({ - email: 'user@example.com', - first_name: 'Caterina', - last_name: 'Yost', - password: 'supersecret' - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/customers' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "email": "user@example.com", - "first_name": "Caterina", - "last_name": "Yost", - "password": "supersecret" - }' - security: - - api_token: [] - - cookie_auth: [] - responses: - '201': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminCustomersRes' + $ref: '#/components/schemas/AdminCustomersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2579,25 +2418,28 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/{id}/regions/{region_id}': + /auth: post: - operationId: PostDiscountsDiscountRegionsRegion - summary: Add Region - description: Adds a Region to the list of Regions that a Discount can be used in. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Discount. - schema: - type: string - - in: path - name: region_id - required: true - description: The ID of the Region. - schema: - type: string + operationId: PostAuth + summary: User Login + x-authenticated: false + description: Logs a User in and authorizes them to manage Store settings. + parameters: [] + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + description: The User's email. + password: + type: string + description: The User's password. x-codeSamples: - lang: JavaScript label: JS Client @@ -2607,36 +2449,34 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - - medusa.admin.discounts.addRegion(discount_id, region_id) - - .then(({ discount }) => { - console.log(discount.id); + medusa.admin.auth.createSession({ + email: 'user@example.com', + password: 'supersecret' + }).then((({ user }) => { + console.log(user.id); }); - lang: Shell label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] + source: | + curl --location --request POST 'https://medusa-url.com/admin/auth' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "email": "user@example.com", + "password": "supersecret" + }' tags: - - Discount + - Auth responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: '#/components/schemas/AdminAuthRes' '400': $ref: '#/components/responses/400_error' '401': - $ref: '#/components/responses/unauthorized' + $ref: '#/components/responses/incorrect_credentials' '404': $ref: '#/components/responses/not_found_error' '409': @@ -2646,25 +2486,10 @@ paths: '500': $ref: '#/components/responses/500_error' delete: - operationId: DeleteDiscountsDiscountRegionsRegion - summary: Remove Region + operationId: DeleteAuth + summary: User Logout x-authenticated: true - description: >- - Removes a Region from the list of Regions that a Discount can be used - in. - parameters: - - in: path - name: id - required: true - description: The ID of the Discount. - schema: - type: string - - in: path - name: region_id - required: true - description: The ID of the Region. - schema: - type: string + description: Deletes the current session for the logged in user. x-codeSamples: - lang: JavaScript label: JS Client @@ -2676,30 +2501,22 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.removeRegion(discount_id, region_id) - - .then(({ discount }) => { - console.log(discount.id); - }); + medusa.admin.auth.deleteSession() - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \ + curl --location --request DELETE 'https://medusa-url.com/admin/auth' + \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Auth responses: '200': description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminDiscountsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2712,45 +2529,11 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/{discount_id}/conditions/{condition_id}/batch': - post: - operationId: PostDiscountsDiscountConditionsConditionBatch - summary: Add Batch Resources - description: Add a batch of resources to a discount condition. + get: + operationId: GetAuth + summary: Get Current User x-authenticated: true - parameters: - - in: path - name: discount_id - required: true - description: The ID of the Product. - schema: - type: string - - in: path - name: condition_id - required: true - description: The ID of the condition on which to add the item. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which relations should be expanded in each - discount of the result. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in each discount - of the result. - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq + description: Gets the currently logged in User. x-codeSamples: - lang: JavaScript label: JS Client @@ -2762,40 +2545,28 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.addConditionResourceBatch(discount_id, - condition_id, { - resources: [{ id: item_id }] - }) + medusa.admin.auth.getSession() - .then(({ discount }) => { - console.log(discount.id); + .then(({ user }) => { + console.log(user.id); }); - lang: Shell label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "resources": [{ "id": "item_id" }] - }' + source: | + curl --location --request GET 'https://medusa-url.com/admin/auth' \ + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Discount Condition + - Auth responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: '#/components/schemas/AdminAuthRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2808,44 +2579,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - delete: - operationId: DeleteDiscountsDiscountConditionsConditionBatch - summary: Delete Batch Resources - description: Delete a batch of resources from a discount condition. + /draft-orders: + post: + operationId: PostDraftOrders + summary: Create a Draft Order + description: Creates a Draft Order x-authenticated: true - parameters: - - in: path - name: discount_id - required: true - description: The ID of the Product. - schema: - type: string - - in: path - name: condition_id - required: true - description: The ID of the condition on which to add the item. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which relations should be expanded in each - discount of the result. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in each discount - of the result. - schema: - type: string requestBody: content: application/json: schema: - $ref: >- - #/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq + $ref: '#/components/schemas/AdminPostDraftOrdersReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -2857,40 +2601,60 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.deleteConditionResourceBatch(discount_id, - condition_id, { - resources: [{ id: item_id }] + medusa.admin.draftOrders.create({ + email: 'user@example.com', + region_id, + items: [ + { + quantity: 1 + } + ], + shipping_methods: [ + { + option_id + } + ], }) - .then(({ discount }) => { - console.log(discount.id); + .then(({ draft_order }) => { + console.log(draft_order.id); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch' - \ + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "resources": [{ "id": "item_id" }] + "email": "user@example.com", + "region_id": "{region_id}" + "items": [ + { + "quantity": 1 + } + ], + "shipping_methods": [ + { + "option_id": "{option_id}" + } + ] }' security: - api_token: [] - cookie_auth: [] tags: - - Discount Condition + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: '#/components/schemas/AdminDraftOrdersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2903,86 +2667,66 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/{discount_id}/conditions': - post: - operationId: PostDiscountsDiscountConditions - summary: Create a Condition - description: >- - Creates a DiscountCondition. Only one of `products`, `product_types`, - `product_collections`, `product_tags`, and `customer_groups` should be - provided. + get: + operationId: GetDraftOrders + summary: List Draft Orders + description: Retrieves an list of Draft Orders x-authenticated: true parameters: - - in: path - name: discount_id - required: true - description: The ID of the Product. + - in: query + name: offset + description: The number of items to skip before the results. schema: - type: string + type: number + default: '0' - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each product of - the result. + name: limit + description: Limit the number of items returned. schema: - type: string + type: number + default: '50' - in: query - name: fields + name: q description: >- - (Comma separated) Which fields should be included in each product of - the result. + a search term to search emails in carts associated with draft orders + and display IDs of draft orders schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostDiscountsDiscountConditions' x-codeSamples: - lang: JavaScript label: JS Client source: > import Medusa from "@medusajs/medusa-js" - import { DiscountConditionOperator } from "@medusajs/medusa" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token - medusa.admin.discounts.createCondition(discount_id, { - operator: DiscountConditionOperator.IN - }) + medusa.admin.draftOrders.list() - .then(({ discount }) => { - console.log(discount.id); + .then(({ draft_orders, limit, offset, count }) => { + console.log(draft_orders.length); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/discounts/{id}/conditions' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request GET + 'https://medusa-url.com/admin/draft-orders' \ - --data-raw '{ - "operator": "in" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Discount Condition + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: '#/components/schemas/AdminDraftOrdersListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2995,89 +2739,67 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /discounts: + '/draft-orders/{id}/line-items': post: - operationId: PostDiscounts - summary: Creates a Discount + operationId: PostDraftOrdersDraftOrderLineItems + summary: Create a Line Item + description: Creates a Line Item for the Draft Order x-authenticated: true - description: >- - Creates a Discount with a given set of rules that define how the - Discount behaves. parameters: - - in: query - name: expand - description: (Comma separated) Which fields should be expanded in each customer. - schema: - type: string - - in: query - name: fields - description: (Comma separated) Which fields should be retrieved in each customer. + - in: path + name: id + required: true + description: The ID of the Draft Order. schema: type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostDiscountsReq' + $ref: '#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsReq' x-codeSamples: - lang: JavaScript label: JS Client source: > import Medusa from "@medusajs/medusa-js" - import { AllocationType, DiscountRuleType } from "@medusajs/medusa" - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token - medusa.admin.discounts.create({ - code: 'TEST', - rule: { - type: DiscountRuleType.FIXED, - value: 10, - allocation: AllocationType.ITEM - }, - regions: ["reg_XXXXXXXX"], - is_dynamic: false, - is_disabled: false + medusa.admin.draftOrders.addLineItem(draft_order_id, { + quantity: 1 }) - .then(({ discount }) => { - console.log(discount.id); + .then(({ draft_order }) => { + console.log(draft_order.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/discounts' \ + 'https://medusa-url.com/admin/draft-orders/{id}/line-items' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "code": "TEST", - "rule": { - "type": "fixed", - "value": 10, - "allocation": "item" - }, - "regions": ["reg_XXXXXXXX"] + "quantity": 1 }' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: '#/components/schemas/AdminDraftOrdersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3090,67 +2812,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetDiscounts - summary: List Discounts + '/draft-orders/{id}': + delete: + operationId: DeleteDraftOrdersDraftOrder + summary: Delete a Draft Order + description: Deletes a Draft Order x-authenticated: true - description: Retrieves a list of Discounts parameters: - - in: query - name: q - description: Search query applied on the code field. - schema: - type: string - - in: query - name: rule - description: Discount Rules filters to apply on the search - schema: - type: object - properties: - type: - type: string - enum: - - fixed - - percentage - - free_shipping - 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. - allocation: - type: string - enum: - - total - - item - description: >- - The value that the discount represents; this will depend on - the type of the discount - - in: query - name: is_dynamic - description: Return only dynamic discounts. - schema: - type: boolean - - in: query - name: is_disabled - description: Return only disabled discounts. - schema: - type: boolean - - in: query - name: limit - description: The number of items in the response - schema: - type: number - default: '20' - - in: query - name: offset - description: The offset of items in response - schema: - type: number - default: '0' - - in: query - name: expand - description: Comma separated list of relations to include in the results. + - in: path + name: id + required: true + description: The ID of the Draft Order. schema: type: string x-codeSamples: @@ -3164,30 +2836,30 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.list() + medusa.admin.draftOrders.delete(draft_order_id) - .then(({ discounts, limit, offset, count }) => { - console.log(discounts.id); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/discounts' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/draft-orders/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsListRes' + $ref: '#/components/schemas/AdminDraftOrdersDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3200,20 +2872,16 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/{id}/dynamic-codes': - post: - operationId: PostDiscountsDiscountDynamicCodes - summary: Create a Dynamic Code - description: >- - Creates a dynamic unique code that can map to a parent Discount. This is - useful if you want to automatically generate codes with the same - behaviour. + get: + operationId: GetDraftOrdersDraftOrder + summary: Get a Draft Order + description: Retrieves a Draft Order. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Discount to create the dynamic code from." + description: The ID of the Draft Order. schema: type: string x-codeSamples: @@ -3227,39 +2895,30 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.createDynamicCode(discount_id, { - code: 'TEST', - usage_limit: 1 - }) + medusa.admin.draftOrders.retrieve(draft_order_id) - .then(({ discount }) => { - console.log(discount.id); + .then(({ draft_order }) => { + console.log(draft_order.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request GET + 'https://medusa-url.com/admin/draft-orders/{id}' \ - --data-raw '{ - "code": "TEST" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: '#/components/schemas/AdminDraftOrdersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3272,53 +2931,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - requestBody: - content: - application/json: - schema: - type: object - required: - - code - properties: - code: - type: string - description: The unique code that will be used to redeem the Discount. - usage_limit: - type: number - default: '1' - description: amount of times the discount can be applied. - metadata: - type: object - description: >- - An optional set of key-value paris to hold additional - information. - '/discounts/{discount_id}/conditions/{condition_id}': + '/draft-orders/{id}/line-items/{line_id}': delete: - operationId: DeleteDiscountsDiscountConditionsCondition - summary: Delete a Condition - description: Deletes a DiscountCondition + operationId: DeleteDraftOrdersDraftOrderLineItemsItem + summary: Delete a Line Item + description: Removes a Line Item from a Draft Order. x-authenticated: true parameters: - in: path - name: discount_id + name: id required: true - description: The ID of the Discount + description: The ID of the Draft Order. schema: type: string - in: path - name: condition_id + name: line_id required: true - description: The ID of the DiscountCondition - schema: - type: string - - in: query - name: expand - description: Comma separated list of relations to include in the results. - schema: - type: string - - in: query - name: fields - description: Comma separated list of fields to include in the results. + description: The ID of the Draft Order. schema: type: string x-codeSamples: @@ -3332,16 +2961,16 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.deleteCondition(discount_id, condition_id) + medusa.admin.draftOrders.removeLineItem(draft_order_id, item_id) - .then(({ id, object, deleted }) => { - console.log(id); + .then(({ draft_order }) => { + console.log(draft_order.id); }); - lang: Shell label: cURL source: > curl --location --request DELETE - 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' + 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' \ --header 'Authorization: Bearer {api_token}' @@ -3349,14 +2978,14 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Discount Condition + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountConditionsDeleteRes' + $ref: '#/components/schemas/AdminDraftOrdersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3369,34 +2998,30 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetDiscountsDiscountConditionsCondition - summary: Get a Condition - description: Gets a DiscountCondition + post: + operationId: PostDraftOrdersDraftOrderLineItemsItem + summary: Update a Line Item + description: Updates a Line Item for a Draft Order x-authenticated: true parameters: - in: path - name: discount_id + name: id required: true - description: The ID of the Discount. + description: The ID of the Draft Order. schema: type: string - in: path - name: condition_id + name: line_id required: true - description: The ID of the DiscountCondition. - schema: - type: string - - in: query - name: expand - description: Comma separated list of relations to include in the results. - schema: - type: string - - in: query - name: fields - description: Comma separated list of fields to include in the results. + description: The ID of the Line Item. schema: type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsItemReq x-codeSamples: - lang: JavaScript label: JS Client @@ -3408,31 +3033,39 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.getCondition(discount_id, condition_id) + medusa.admin.draftOrders.updateLineItem(draft_order_id, line_id, { + quantity: 1 + }) - .then(({ discount_condition }) => { - console.log(discount_condition.id); + .then(({ draft_order }) => { + console.log(draft_order.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "quantity": 1 + }' security: - api_token: [] - cookie_auth: [] tags: - - Discount Condition + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountConditionsRes' + $ref: '#/components/schemas/AdminDraftOrdersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3445,47 +3078,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/draft-orders/{id}/pay': post: - operationId: PostDiscountsDiscountConditionsCondition - summary: Update a Condition - description: >- - Updates a DiscountCondition. Only one of `products`, `product_types`, - `product_collections`, `product_tags`, and `customer_groups` should be - provided. + summary: Registers a Payment + operationId: PostDraftOrdersDraftOrderRegisterPayment + description: Registers a payment for a Draft Order. x-authenticated: true parameters: - in: path - name: discount_id - required: true - description: The ID of the Product. - schema: - type: string - - in: path - name: condition_id + name: id required: true - description: The ID of the DiscountCondition. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each item of - the result. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in each item of - the result. + description: The Draft Order id. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/AdminPostDiscountsDiscountConditionsCondition x-codeSamples: - lang: JavaScript label: JS Client @@ -3497,43 +3102,31 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.updateCondition(discount_id, condition_id, { - products: [ - product_id - ] - }) + medusa.admin.draftOrders.markPaid(draft_order_id) - .then(({ discount }) => { - console.log(discount.id); + .then(({ order }) => { + console.log(order.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition}' - \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + 'https://medusa-url.com/admin/draft-orders/{id}/pay' \ - --data-raw '{ - "products": [ - "prod_01G1G5V2MBA328390B5AXJ610F" - ] - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsRes' + $ref: >- + #/components/schemas/AdminPostDraftOrdersDraftOrderRegisterPaymentRes '400': $ref: '#/components/responses/400_error' '401': @@ -3546,20 +3139,25 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/{id}': - delete: - operationId: DeleteDiscountsDiscount - summary: Delete a Discount - description: Deletes a Discount. + '/admin/draft-orders/{id}': + post: + operationId: PostDraftOrdersDraftOrder + summary: Update a Draft Order + description: Updates a Draft Order. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Discount + description: The ID of the Draft Order. schema: type: string - x-codeSamples: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostDraftOrdersDraftOrderReq' + x-codeSamples: - lang: JavaScript label: JS Client source: > @@ -3570,30 +3168,38 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.delete(discount_id) + medusa.admin.draftOrders.update(draft_order_id, { + email: "user@example.com" + }) - .then(({ id, object, deleted }) => { - console.log(id); + .then(({ draft_order }) => { + console.log(draft_order.id); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/discounts/{id}' \ + curl --location --request POST + 'https://medusa-url.com/admin/draft-orders/{id}' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "email": "user@example.com" + }' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Draft Order responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDiscountsDeleteRes' + $ref: '#/components/schemas/AdminDraftOrdersRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3606,26 +3212,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetDiscountsDiscount - summary: Get a Discount - description: Retrieves a Discount + '/discounts/{id}/regions/{region_id}': + post: + operationId: PostDiscountsDiscountRegionsRegion + summary: Add Region + description: Adds a Region to the list of Regions that a Discount can be used in. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Discount - schema: - type: string - - in: query - name: expand - description: Comma separated list of relations to include in the results. + description: The ID of the Discount. schema: type: string - - in: query - name: fields - description: Comma separated list of fields to include in the results. + - in: path + name: region_id + required: true + description: The ID of the Region. schema: type: string x-codeSamples: @@ -3639,7 +3242,7 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.retrieve(discount_id) + medusa.admin.discounts.addRegion(discount_id, region_id) .then(({ discount }) => { console.log(discount.id); @@ -3647,8 +3250,8 @@ paths: - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/discounts/{id}' \ + curl --location --request POST + 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \ --header 'Authorization: Bearer {api_token}' security: @@ -3675,13 +3278,13 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - post: - operationId: PostDiscountsDiscount - summary: Update a Discount - description: >- - Updates a Discount with a given set of rules that define how the - Discount behaves. + delete: + operationId: DeleteDiscountsDiscountRegionsRegion + summary: Remove Region x-authenticated: true + description: >- + Removes a Region from the list of Regions that a Discount can be used + in. parameters: - in: path name: id @@ -3689,25 +3292,12 @@ paths: description: The ID of the Discount. schema: type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each item of - the result. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in each item of - the result. + - in: path + name: region_id + required: true + description: The ID of the Region. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostDiscountsDiscountReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -3719,9 +3309,7 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.update(discount_id, { - code: 'TEST' - }) + medusa.admin.discounts.removeRegion(discount_id, region_id) .then(({ discount }) => { console.log(discount.id); @@ -3729,16 +3317,10 @@ paths: - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/discounts/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \ - --data-raw '{ - "code": "TEST" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] @@ -3763,25 +3345,45 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/{id}/dynamic-codes/{code}': - delete: - operationId: DeleteDiscountsDiscountDynamicCodesCode - summary: Delete a Dynamic Code - description: Deletes a dynamic code from a Discount. + '/discounts/{discount_id}/conditions/{condition_id}/batch': + post: + operationId: PostDiscountsDiscountConditionsConditionBatch + summary: Add Batch Resources + description: Add a batch of resources to a discount condition. x-authenticated: true parameters: - in: path - name: id + name: discount_id required: true - description: The ID of the Discount + description: The ID of the Product. schema: type: string - in: path - name: code + name: condition_id required: true - description: The ID of the Discount + description: The ID of the condition on which to add the item. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which relations should be expanded in each + discount of the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each discount + of the result. schema: type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq x-codeSamples: - lang: JavaScript label: JS Client @@ -3793,7 +3395,10 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.deleteDynamicCode(discount_id, code) + medusa.admin.discounts.addConditionResourceBatch(discount_id, + condition_id, { + resources: [{ id: item_id }] + }) .then(({ discount }) => { console.log(discount.id); @@ -3801,15 +3406,22 @@ paths: - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes/{code}' \ + curl --location --request POST + 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch' + \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "resources": [{ "id": "item_id" }] + }' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Discount Condition responses: '200': description: OK @@ -3829,29 +3441,44 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/discounts/code/{code}': - get: - operationId: GetDiscountsDiscountCode - summary: Get Discount by Code - description: Retrieves a Discount by its discount code + delete: + operationId: DeleteDiscountsDiscountConditionsConditionBatch + summary: Delete Batch Resources + description: Delete a batch of resources from a discount condition. x-authenticated: true parameters: - in: path - name: code + name: discount_id required: true - description: The code of the Discount + description: The ID of the Product. + schema: + type: string + - in: path + name: condition_id + required: true + description: The ID of the condition on which to add the item. schema: type: string - in: query name: expand - description: Comma separated list of relations to include in the results. + description: >- + (Comma separated) Which relations should be expanded in each + discount of the result. schema: type: string - in: query name: fields - description: Comma separated list of fields to include in the results. + description: >- + (Comma separated) Which fields should be included in each discount + of the result. schema: type: string + requestBody: + content: + application/json: + schema: + $ref: >- + #/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq x-codeSamples: - lang: JavaScript label: JS Client @@ -3863,7 +3490,10 @@ paths: // must be previously logged in or use api token - medusa.admin.discounts.retrieveByCode(code) + medusa.admin.discounts.deleteConditionResourceBatch(discount_id, + condition_id, { + resources: [{ id: item_id }] + }) .then(({ discount }) => { console.log(discount.id); @@ -3871,15 +3501,22 @@ paths: - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/discounts/code/{code}' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch' + \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "resources": [{ "id": "item_id" }] + }' security: - api_token: [] - cookie_auth: [] tags: - - Discount + - Discount Condition responses: '200': description: OK @@ -3899,82 +3536,86 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /draft-orders: + '/discounts/{discount_id}/conditions': post: - operationId: PostDraftOrders - summary: Create a Draft Order - description: Creates a Draft Order + operationId: PostDiscountsDiscountConditions + summary: Create a Condition + description: >- + Creates a DiscountCondition. Only one of `products`, `product_types`, + `product_collections`, `product_tags`, and `customer_groups` should be + provided. x-authenticated: true + parameters: + - in: path + name: discount_id + required: true + description: The ID of the Product. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product of + the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each product of + the result. + schema: + type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostDraftOrdersReq' + $ref: '#/components/schemas/AdminPostDiscountsDiscountConditions' x-codeSamples: - lang: JavaScript label: JS Client source: > import Medusa from "@medusajs/medusa-js" + import { DiscountConditionOperator } from "@medusajs/medusa" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token - medusa.admin.draftOrders.create({ - email: 'user@example.com', - region_id, - items: [ - { - quantity: 1 - } - ], - shipping_methods: [ - { - option_id - } - ], + medusa.admin.discounts.createCondition(discount_id, { + operator: DiscountConditionOperator.IN }) - .then(({ draft_order }) => { - console.log(draft_order.id); + .then(({ discount }) => { + console.log(discount.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/draft-orders' \ + 'https://medusa-url.com/admin/discounts/{id}/conditions' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "email": "user@example.com", - "region_id": "{region_id}" - "items": [ - { - "quantity": 1 - } - ], - "shipping_methods": [ - { - "option_id": "{option_id}" - } - ] + "operator": "in" }' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount Condition responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersRes' + $ref: '#/components/schemas/AdminDiscountsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3987,66 +3628,89 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetDraftOrders - summary: List Draft Orders - description: Retrieves an list of Draft Orders + /discounts: + post: + operationId: PostDiscounts + summary: Creates a Discount x-authenticated: true + description: >- + Creates a Discount with a given set of rules that define how the + Discount behaves. parameters: - in: query - name: offset - description: The number of items to skip before the results. - schema: - type: number - default: '0' - - in: query - name: limit - description: Limit the number of items returned. + name: expand + description: (Comma separated) Which fields should be expanded in each customer. schema: - type: number - default: '50' + type: string - in: query - name: q - description: >- - a search term to search emails in carts associated with draft orders - and display IDs of draft orders + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. schema: type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostDiscountsReq' x-codeSamples: - lang: JavaScript label: JS Client source: > import Medusa from "@medusajs/medusa-js" + import { AllocationType, DiscountRuleType } from "@medusajs/medusa" + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token - medusa.admin.draftOrders.list() + medusa.admin.discounts.create({ + code: 'TEST', + rule: { + type: DiscountRuleType.FIXED, + value: 10, + allocation: AllocationType.ITEM + }, + regions: ["reg_XXXXXXXX"], + is_dynamic: false, + is_disabled: false + }) - .then(({ draft_orders, limit, offset, count }) => { - console.log(draft_orders.length); + .then(({ discount }) => { + console.log(discount.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/draft-orders' \ + curl --location --request POST + 'https://medusa-url.com/admin/discounts' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "code": "TEST", + "rule": { + "type": "fixed", + "value": 10, + "allocation": "item" + }, + "regions": ["reg_XXXXXXXX"] + }' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersListRes' + $ref: '#/components/schemas/AdminDiscountsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4059,24 +3723,69 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/draft-orders/{id}/line-items': - post: - operationId: PostDraftOrdersDraftOrderLineItems - summary: Create a Line Item - description: Creates a Line Item for the Draft Order + get: + operationId: GetDiscounts + summary: List Discounts x-authenticated: true + description: Retrieves a list of Discounts parameters: - - in: path - name: id - required: true - description: The ID of the Draft Order. + - in: query + name: q + description: Search query applied on the code field. + schema: + type: string + - in: query + name: rule + description: Discount Rules filters to apply on the search + schema: + type: object + properties: + type: + type: string + enum: + - fixed + - percentage + - free_shipping + 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. + allocation: + type: string + enum: + - total + - item + description: >- + The value that the discount represents; this will depend on + the type of the discount + - in: query + name: is_dynamic + description: Return only dynamic discounts. + schema: + type: boolean + - in: query + name: is_disabled + description: Return only disabled discounts. + schema: + type: boolean + - in: query + name: limit + description: The number of items in the response + schema: + type: number + default: '20' + - in: query + name: offset + description: The offset of items in response + schema: + type: number + default: '0' + - in: query + name: expand + description: Comma separated list of relations to include in the results. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -4088,38 +3797,30 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.addLineItem(draft_order_id, { - quantity: 1 - }) + medusa.admin.discounts.list() - .then(({ draft_order }) => { - console.log(draft_order.id); + .then(({ discounts, limit, offset, count }) => { + console.log(discounts.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}/line-items' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request GET + 'https://medusa-url.com/admin/discounts' \ - --data-raw '{ - "quantity": 1 - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersRes' + $ref: '#/components/schemas/AdminDiscountsListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4132,17 +3833,20 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/draft-orders/{id}': - delete: - operationId: DeleteDraftOrdersDraftOrder - summary: Delete a Draft Order - description: Deletes a Draft Order + '/discounts/{id}/dynamic-codes': + post: + operationId: PostDiscountsDiscountDynamicCodes + summary: Create a Dynamic Code + description: >- + Creates a dynamic unique code that can map to a parent Discount. This is + useful if you want to automatically generate codes with the same + behaviour. x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Draft Order. + description: The ID of the Discount to create the dynamic code from." schema: type: string x-codeSamples: @@ -4156,30 +3860,39 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.delete(draft_order_id) + medusa.admin.discounts.createDynamicCode(discount_id, { + code: 'TEST', + usage_limit: 1 + }) - .then(({ id, object, deleted }) => { - console.log(id); + .then(({ discount }) => { + console.log(discount.id); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/draft-orders/{id}' \ + curl --location --request POST + 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "code": "TEST" + }' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersDeleteRes' + $ref: '#/components/schemas/AdminDiscountsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4192,16 +3905,53 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetDraftOrdersDraftOrder - summary: Get a Draft Order - description: Retrieves a Draft Order. - x-authenticated: true - parameters: - - in: path - name: id + requestBody: + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + type: string + description: The unique code that will be used to redeem the Discount. + usage_limit: + type: number + default: '1' + description: amount of times the discount can be applied. + metadata: + type: object + description: >- + An optional set of key-value paris to hold additional + information. + '/discounts/{discount_id}/conditions/{condition_id}': + delete: + operationId: DeleteDiscountsDiscountConditionsCondition + summary: Delete a Condition + description: Deletes a DiscountCondition + x-authenticated: true + parameters: + - in: path + name: discount_id required: true - description: The ID of the Draft Order. + description: The ID of the Discount + schema: + type: string + - in: path + name: condition_id + required: true + description: The ID of the DiscountCondition + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. schema: type: string x-codeSamples: @@ -4215,30 +3965,31 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.retrieve(draft_order_id) + medusa.admin.discounts.deleteCondition(discount_id, condition_id) - .then(({ draft_order }) => { - console.log(draft_order.id); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/draft-orders/{id}' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' + \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount Condition responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersRes' + $ref: '#/components/schemas/AdminDiscountConditionsDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4251,23 +4002,32 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/draft-orders/{id}/line-items/{line_id}': - delete: - operationId: DeleteDraftOrdersDraftOrderLineItemsItem - summary: Delete a Line Item - description: Removes a Line Item from a Draft Order. + get: + operationId: GetDiscountsDiscountConditionsCondition + summary: Get a Condition + description: Gets a DiscountCondition x-authenticated: true parameters: - in: path - name: id + name: discount_id required: true - description: The ID of the Draft Order. + description: The ID of the Discount. schema: type: string - in: path - name: line_id + name: condition_id required: true - description: The ID of the Draft Order. + description: The ID of the DiscountCondition. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. schema: type: string x-codeSamples: @@ -4281,16 +4041,16 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.removeLineItem(draft_order_id, item_id) + medusa.admin.discounts.getCondition(discount_id, condition_id) - .then(({ draft_order }) => { - console.log(draft_order.id); + .then(({ discount_condition }) => { + console.log(discount_condition.id); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' + curl --location --request GET + 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' \ --header 'Authorization: Bearer {api_token}' @@ -4298,14 +4058,14 @@ paths: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount Condition responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersRes' + $ref: '#/components/schemas/AdminDiscountConditionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4319,21 +4079,38 @@ paths: '500': $ref: '#/components/responses/500_error' post: - operationId: PostDraftOrdersDraftOrderLineItemsItem - summary: Update a Line Item - description: Updates a Line Item for a Draft Order + operationId: PostDiscountsDiscountConditionsCondition + summary: Update a Condition + description: >- + Updates a DiscountCondition. Only one of `products`, `product_types`, + `product_collections`, `product_tags`, and `customer_groups` should be + provided. x-authenticated: true parameters: - in: path - name: id + name: discount_id required: true - description: The ID of the Draft Order. + description: The ID of the Product. schema: type: string - in: path - name: line_id + name: condition_id required: true - description: The ID of the Line Item. + description: The ID of the DiscountCondition. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of + the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each item of + the result. schema: type: string requestBody: @@ -4341,7 +4118,7 @@ paths: application/json: schema: $ref: >- - #/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsItemReq + #/components/schemas/AdminPostDiscountsDiscountConditionsCondition x-codeSamples: - lang: JavaScript label: JS Client @@ -4353,18 +4130,20 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.updateLineItem(draft_order_id, line_id, { - quantity: 1 + medusa.admin.discounts.updateCondition(discount_id, condition_id, { + products: [ + product_id + ] }) - .then(({ draft_order }) => { - console.log(draft_order.id); + .then(({ discount }) => { + console.log(discount.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' + 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition}' \ --header 'Authorization: Bearer {api_token}' \ @@ -4372,20 +4151,22 @@ paths: --header 'Content-Type: application/json' \ --data-raw '{ - "quantity": 1 + "products": [ + "prod_01G1G5V2MBA328390B5AXJ610F" + ] }' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersRes' + $ref: '#/components/schemas/AdminDiscountsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4398,17 +4179,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/draft-orders/{id}/pay': - post: - summary: Registers a Payment - operationId: PostDraftOrdersDraftOrderRegisterPayment - description: Registers a payment for a Draft Order. + '/discounts/{id}': + delete: + operationId: DeleteDiscountsDiscount + summary: Delete a Discount + description: Deletes a Discount. x-authenticated: true parameters: - in: path name: id required: true - description: The Draft Order id. + description: The ID of the Discount schema: type: string x-codeSamples: @@ -4422,31 +4203,30 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.markPaid(draft_order_id) + medusa.admin.discounts.delete(discount_id) - .then(({ order }) => { - console.log(order.id); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}/pay' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/discounts/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount responses: '200': description: OK content: application/json: schema: - $ref: >- - #/components/schemas/AdminPostDraftOrdersDraftOrderRegisterPaymentRes + $ref: '#/components/schemas/AdminDiscountsDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4459,24 +4239,28 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/admin/draft-orders/{id}': - post: - operationId: PostDraftOrdersDraftOrder - summary: Update a Draft Order - description: Updates a Draft Order. + get: + operationId: GetDiscountsDiscount + summary: Get a Discount + description: Retrieves a Discount x-authenticated: true parameters: - in: path name: id required: true - description: The ID of the Draft Order. + description: The ID of the Discount + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostDraftOrdersDraftOrderReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -4488,38 +4272,30 @@ paths: // must be previously logged in or use api token - medusa.admin.draftOrders.update(draft_order_id, { - email: "user@example.com" - }) + medusa.admin.discounts.retrieve(discount_id) - .then(({ draft_order }) => { - console.log(draft_order.id); + .then(({ discount }) => { + console.log(discount.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/draft-orders/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + curl --location --request GET + 'https://medusa-url.com/admin/discounts/{id}' \ - --data-raw '{ - "email": "user@example.com" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Draft Order + - Discount responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminDraftOrdersRes' + $ref: '#/components/schemas/AdminDiscountsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4532,27 +4308,251 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /gift-cards: post: - operationId: PostGiftCards - summary: Create a Gift Card + operationId: PostDiscountsDiscount + summary: Update a Discount description: >- - Creates a Gift Card that can redeemed by its unique code. The Gift Card - is only valid within 1 region. + Updates a Discount with a given set of rules that define how the + Discount behaves. x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostGiftCardsReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) + parameters: + - in: path + name: id + required: true + description: The ID of the Discount. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of + the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each item of + the result. + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostDiscountsDiscountReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.discounts.update(discount_id, { + code: 'TEST' + }) + + .then(({ discount }) => { + console.log(discount.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/admin/discounts/{id}' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "code": "TEST" + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminDiscountsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/discounts/{id}/dynamic-codes/{code}': + delete: + operationId: DeleteDiscountsDiscountDynamicCodesCode + summary: Delete a Dynamic Code + description: Deletes a dynamic code from a Discount. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount + schema: + type: string + - in: path + name: code + required: true + description: The ID of the Discount + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.discounts.deleteDynamicCode(discount_id, code) + + .then(({ discount }) => { + console.log(discount.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request DELETE + 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes/{code}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminDiscountsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/discounts/code/{code}': + get: + operationId: GetDiscountsDiscountCode + summary: Get Discount by Code + description: Retrieves a Discount by its discount code + x-authenticated: true + parameters: + - in: path + name: code + required: true + description: The code of the Discount + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.admin.discounts.retrieveByCode(code) + + .then(({ discount }) => { + console.log(discount.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/admin/discounts/code/{code}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminDiscountsRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /gift-cards: + post: + operationId: PostGiftCards + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card + is only valid within 1 region. + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostGiftCardsReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) // must be previously logged in or use api token @@ -4863,16 +4863,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /invites/accept: + /notes: post: - operationId: PostInvitesInviteAccept - summary: Accept an Invite - description: Accepts an Invite and creates a corresponding user + operationId: PostNotes + summary: Creates a Note + description: Creates a Note which can be associated with any resource as required. + x-authenticated: true requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq' + $ref: '#/components/schemas/AdminPostNotesReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -4884,48 +4885,42 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.accept({ - token, - user: { - first_name: 'Brigitte', - last_name: 'Collier', - password: 'supersecret' - } - }) - - .then(() => { - // successful + medusa.admin.notes.create({ + resource_id, + resource_type: 'order', + value: 'We delivered this order' }) - .catch(() => { - // an error occurred + .then(({ note }) => { + console.log(note.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/admin/invites/accept' \ + curl --location --request POST 'https://medusa-url.com/admin/notes' + \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "token": "{token}", - "user": { - "first_name": "Brigitte", - "last_name": "Collier", - "password": "supersecret" - } + "resource_id": "{resource_id}", + "resource_type": "order", + "value": "We delivered this order" }' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Note responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminNotesRes' '400': $ref: '#/components/responses/400_error' '401': @@ -4938,17 +4933,29 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /invites: - post: - operationId: PostInvites - summary: Create an Invite - description: Creates an Invite and triggers an 'invite' created event + get: + operationId: GetNotes + summary: List Notes x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostInvitesReq' + description: Retrieves a list of notes + parameters: + - in: query + name: limit + description: The number of notes to get + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset at which to get notes + schema: + type: number + default: '0' + - in: query + name: resource_id + description: The ID which the notes belongs to + schema: + type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -4960,40 +4967,28 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.create({ - user: "user@example.com", - role: "admin" - }) - - .then(() => { - // successful - }) + medusa.admin.notes.list() - .catch(() => { - // an error occurred + .then(({ notes, limit, offset, count }) => { + console.log(notes.length); }); - lang: Shell label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/admin/invites' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "user": "user@example.com", - "role": "admin" - }' + source: | + curl --location --request GET 'https://medusa-url.com/admin/notes' \ + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Note responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminNotesListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5006,11 +5001,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetInvites - summary: Lists Invites - description: Lists all Invites + '/notes/{id}': + delete: + operationId: DeleteNotesNote + summary: Delete a Note + description: Deletes a Note. x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Note to delete. + schema: + type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -5022,30 +5025,30 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.list() + medusa.admin.notes.delete(note_id) - .then(({ invites }) => { - console.log(invites.length); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request GET 'https://medusa-url.com/admin/invites' - \ + curl --location --request DELETE + 'https://medusa-url.com/admin/notes/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Note responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminListInvitesRes' + $ref: '#/components/schemas/AdminNotesDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5058,17 +5061,16 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/invites/{invite_id}': - delete: - operationId: DeleteInvitesInvite - summary: Delete an Invite - description: Deletes an Invite + get: + operationId: GetNotesNote + summary: Get a Note + description: Retrieves a single note using its id x-authenticated: true parameters: - in: path - name: invite_id + name: id required: true - description: The ID of the Invite + description: The ID of the note to retrieve. schema: type: string x-codeSamples: @@ -5082,30 +5084,30 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.delete(invite_id) + medusa.admin.notes.retrieve(note_id) - .then(({ id, object, deleted }) => { - console.log(id); + .then(({ note }) => { + console.log(note.id); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/invites/{invite_id}' \ + curl --location --request GET + 'https://medusa-url.com/admin/notes/{id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Note responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminInviteDeleteRes' + $ref: '#/components/schemas/AdminNotesRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5118,19 +5120,23 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/invites/{invite_id}/resend': post: - operationId: PostInvitesInviteResend - summary: Resend an Invite - description: Resends an Invite by triggering the 'invite' created event again + operationId: PostNotesNote + summary: Update a Note x-authenticated: true + description: Updates a Note associated with some resource parameters: - in: path - name: invite_id + name: id required: true - description: The ID of the Invite + description: The ID of the Note to update schema: type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostNotesNoteReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -5142,30 +5148,38 @@ paths: // must be previously logged in or use api token - medusa.admin.invites.resend(invite_id) - - .then(() => { - // successful + medusa.admin.notes.update(note_id, { + value: 'We delivered this order' }) - .catch(() => { - // an error occurred + .then(({ note }) => { + console.log(note.id); }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ + 'https://medusa-url.com/admin/notes/{id}' \ - --header 'Authorization: Bearer {api_token}' + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "value": "We delivered this order" + }' security: - api_token: [] - cookie_auth: [] tags: - - Invite + - Note responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AdminNotesRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5178,17 +5192,16 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /notes: + /invites/accept: post: - operationId: PostNotes - summary: Creates a Note - description: Creates a Note which can be associated with any resource as required. - x-authenticated: true + operationId: PostInvitesInviteAccept + summary: Accept an Invite + description: Accepts an Invite and creates a corresponding user requestBody: content: application/json: schema: - $ref: '#/components/schemas/AdminPostNotesReq' + $ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -5200,42 +5213,48 @@ paths: // must be previously logged in or use api token - medusa.admin.notes.create({ - resource_id, - resource_type: 'order', - value: 'We delivered this order' + medusa.admin.invites.accept({ + token, + user: { + first_name: 'Brigitte', + last_name: 'Collier', + password: 'supersecret' + } }) - .then(({ note }) => { - console.log(note.id); + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred }); - lang: Shell label: cURL source: > - curl --location --request POST 'https://medusa-url.com/admin/notes' - \ + curl --location --request POST + 'https://medusa-url.com/admin/invites/accept' \ --header 'Authorization: Bearer {api_token}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "resource_id": "{resource_id}", - "resource_type": "order", - "value": "We delivered this order" + "token": "{token}", + "user": { + "first_name": "Brigitte", + "last_name": "Collier", + "password": "supersecret" + } }' security: - api_token: [] - cookie_auth: [] tags: - - Note + - Invite responses: '200': description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminNotesRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5248,29 +5267,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetNotes - summary: List Notes + /invites: + post: + operationId: PostInvites + summary: Create an Invite + description: Creates an Invite and triggers an 'invite' created event x-authenticated: true - description: Retrieves a list of notes - parameters: - - in: query - name: limit - description: The number of notes to get - schema: - type: number - default: '50' - - in: query - name: offset - description: The offset at which to get notes - schema: - type: number - default: '0' - - in: query - name: resource_id - description: The ID which the notes belongs to - schema: - type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AdminPostInvitesReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -5282,28 +5289,40 @@ paths: // must be previously logged in or use api token - medusa.admin.notes.list() + medusa.admin.invites.create({ + user: "user@example.com", + role: "admin" + }) - .then(({ notes, limit, offset, count }) => { - console.log(notes.length); + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred }); - lang: Shell label: cURL - source: | - curl --location --request GET 'https://medusa-url.com/admin/notes' \ - --header 'Authorization: Bearer {api_token}' + source: > + curl --location --request POST + 'https://medusa-url.com/admin/invites' \ + + --header 'Authorization: Bearer {api_token}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "user": "user@example.com", + "role": "admin" + }' security: - api_token: [] - cookie_auth: [] tags: - - Note + - Invite responses: '200': description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminNotesListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5316,19 +5335,11 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/notes/{id}': - delete: - operationId: DeleteNotesNote - summary: Delete a Note - description: Deletes a Note. + get: + operationId: GetInvites + summary: Lists Invites + description: Lists all Invites x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The ID of the Note to delete. - schema: - type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -5340,30 +5351,30 @@ paths: // must be previously logged in or use api token - medusa.admin.notes.delete(note_id) + medusa.admin.invites.list() - .then(({ id, object, deleted }) => { - console.log(id); + .then(({ invites }) => { + console.log(invites.length); }); - lang: Shell label: cURL source: > - curl --location --request DELETE - 'https://medusa-url.com/admin/notes/{id}' \ + curl --location --request GET 'https://medusa-url.com/admin/invites' + \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Note + - Invite responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminNotesDeleteRes' + $ref: '#/components/schemas/AdminListInvitesRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5376,16 +5387,17 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - get: - operationId: GetNotesNote - summary: Get a Note - description: Retrieves a single note using its id + '/invites/{invite_id}': + delete: + operationId: DeleteInvitesInvite + summary: Delete an Invite + description: Deletes an Invite x-authenticated: true parameters: - in: path - name: id + name: invite_id required: true - description: The ID of the note to retrieve. + description: The ID of the Invite schema: type: string x-codeSamples: @@ -5399,30 +5411,30 @@ paths: // must be previously logged in or use api token - medusa.admin.notes.retrieve(note_id) + medusa.admin.invites.delete(invite_id) - .then(({ note }) => { - console.log(note.id); + .then(({ id, object, deleted }) => { + console.log(id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/admin/notes/{id}' \ + curl --location --request DELETE + 'https://medusa-url.com/admin/invites/{invite_id}' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Note + - Invite responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/AdminNotesRes' + $ref: '#/components/schemas/AdminInviteDeleteRes' '400': $ref: '#/components/responses/400_error' '401': @@ -5435,23 +5447,19 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/invites/{invite_id}/resend': post: - operationId: PostNotesNote - summary: Update a Note + operationId: PostInvitesInviteResend + summary: Resend an Invite + description: Resends an Invite by triggering the 'invite' created event again x-authenticated: true - description: Updates a Note associated with some resource parameters: - in: path - name: id + name: invite_id required: true - description: The ID of the Note to update + description: The ID of the Invite schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AdminPostNotesNoteReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -5463,38 +5471,30 @@ paths: // must be previously logged in or use api token - medusa.admin.notes.update(note_id, { - value: 'We delivered this order' + medusa.admin.invites.resend(invite_id) + + .then(() => { + // successful }) - .then(({ note }) => { - console.log(note.id); + .catch(() => { + // an error occurred }); - lang: Shell label: cURL source: > curl --location --request POST - 'https://medusa-url.com/admin/notes/{id}' \ - - --header 'Authorization: Bearer {api_token}' \ - - --header 'Content-Type: application/json' \ + 'https://medusa-url.com/admin/invites/{invite_id}/resend' \ - --data-raw '{ - "value": "We delivered this order" - }' + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Note + - Invite responses: '200': description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/AdminNotesRes' '400': $ref: '#/components/responses/400_error' '401': @@ -18667,7 +18667,7 @@ components: ```tsx @@ -24519,25 +24519,6 @@ components: type: array items: $ref: '#/components/schemas/OAuth' - 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 - AdminAuthRes: - type: object - properties: - user: - $ref: '#/components/schemas/User' AdminPostBatchesReq: type: object required: @@ -24596,40 +24577,13 @@ components: limit: type: integer description: The number of items per page - 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 - 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 - AdminCollectionsListRes: + AdminCurrenciesListRes: type: object properties: - collections: + currencies: type: array items: - $ref: '#/components/schemas/ProductCollection' + $ref: '#/components/schemas/Currency' count: type: integer description: The total number of items available @@ -24639,102 +24593,27 @@ components: limit: type: integer description: The number of items per page - AdminCollectionsDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Collection - object: - type: string - description: The type of the object that was deleted. - default: product-collection - deleted: - type: boolean - description: Whether the collection was deleted successfully or not. - default: true - AdminDeleteProductsFromCollectionRes: + AdminCurrenciesRes: type: object properties: - id: - type: string - description: The ID of the collection - object: - type: string - description: The type of object the removal was executed on - default: product-collection - removed_products: - description: The IDs of the products removed from the collection - type: array - items: - description: The ID of a Product to add to the Product Collection. - type: string - AdminCollectionsRes: + currency: + $ref: '#/components/schemas/Currency' + AdminPostCurrenciesCurrencyReq: type: object properties: - collection: - $ref: '#/components/schemas/ProductCollection' - AdminDeleteProductsFromCollectionReq: + includes_tax: + type: boolean + description: '[EXPERIMENTAL] Tax included in prices of currency.' + AdminPostCustomerGroupsGroupCustomersBatchReq: type: object required: - - product_ids + - customer_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 - 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 - AdminCurrenciesListRes: - type: object - properties: - currencies: - type: array - items: - $ref: '#/components/schemas/Currency' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - AdminCurrenciesRes: - type: object - properties: - currency: - $ref: '#/components/schemas/Currency' - AdminPostCurrenciesCurrencyReq: - type: object - properties: - includes_tax: - type: boolean - description: '[EXPERIMENTAL] Tax included in prices of currency.' - AdminPostCustomerGroupsGroupCustomersBatchReq: - type: object - required: - - customer_ids - properties: - customer_ids: - description: The ids of the customers to add + customer_ids: + description: The ids of the customers to add type: array items: + type: object required: - id properties: @@ -24750,6 +24629,7 @@ components: description: The ids of the customers to remove type: array items: + type: object required: - id properties: @@ -24800,6 +24680,109 @@ components: metadata: description: Metadata for the customer. type: object + 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 + 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 + AdminCollectionsListRes: + type: object + properties: + collections: + type: array + items: + $ref: '#/components/schemas/ProductCollection' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + AdminCollectionsDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted Collection + object: + type: string + description: The type of the object that was deleted. + default: product-collection + deleted: + type: boolean + description: Whether the collection was deleted successfully or not. + default: true + AdminDeleteProductsFromCollectionRes: + type: object + properties: + id: + type: string + description: The ID of the collection + object: + type: string + description: The type of object the removal was executed on + default: product-collection + removed_products: + description: The IDs of the products removed from the collection + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string + AdminCollectionsRes: + type: object + properties: + collection: + $ref: '#/components/schemas/ProductCollection' + 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 + 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 AdminPostCustomersReq: type: object required: @@ -24836,10 +24819,222 @@ components: AdminCustomersListRes: type: object properties: - customers: + customers: + type: array + items: + $ref: '#/components/schemas/Customer' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + 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: + type: object + 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 + 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 + AdminAuthRes: + type: object + properties: + user: + $ref: '#/components/schemas/User' + 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 + 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 + AdminPostDraftOrdersDraftOrderRegisterPaymentRes: + type: object + properties: + order: + $ref: '#/components/schemas/Order' + AdminDraftOrdersRes: + type: object + properties: + draft_order: + $ref: '#/components/schemas/DraftOrder' + AdminDraftOrdersDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted Draft Order. + object: + type: string + description: The type of the object that was deleted. + default: draft-order + deleted: + type: boolean + description: Whether the draft order was deleted successfully or not. + default: true + AdminDraftOrdersListRes: + type: object + properties: + draft_orders: type: array items: - $ref: '#/components/schemas/Customer' + $ref: '#/components/schemas/DraftOrder' count: type: integer description: The total number of items available @@ -24849,38 +25044,68 @@ components: limit: type: integer description: The number of items per page - AdminPostCustomersCustomerReq: + AdminPostDraftOrdersDraftOrderReq: 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: + region_id: type: string - description: The Customer's last name. - phone: + description: The ID of the Region to create the Draft Order in. + country_code: type: string - description: The Customer's phone number. - password: + 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: The Customer's password. - format: password - groups: + 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: - - id + - code properties: - id: - description: The ID of a customer group + code: + description: The code that a Discount is identifed by. type: string - description: A list of customer groups to which the customer belongs. + 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 + 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: An optional set of key-value pairs to hold additional information. + description: >- + The optional key-value map with additional details about the Line + Item. type: object AdminPostDiscountsDiscountConditionsConditionBatchReq: type: object @@ -24891,6 +25116,7 @@ components: description: The resources to be added to the discount condition type: array items: + type: object required: - id properties: @@ -25081,6 +25307,7 @@ components: description: The resources to be deleted from the discount condition type: array items: + type: object required: - id properties: @@ -25255,265 +25482,43 @@ components: 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 - 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 - 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 - AdminPostDraftOrdersDraftOrderRegisterPaymentRes: - type: object - properties: - order: - $ref: '#/components/schemas/Order' - AdminDraftOrdersRes: - type: object - properties: - draft_order: - $ref: '#/components/schemas/DraftOrder' - AdminDraftOrdersDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Draft Order. - object: - type: string - description: The type of the object that was deleted. - default: draft-order - deleted: + 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 draft order was deleted successfully or not. - default: true - AdminDraftOrdersListRes: - type: object - properties: - draft_orders: - type: array - items: - $ref: '#/components/schemas/DraftOrder' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - AdminPostDraftOrdersDraftOrderReq: - type: object - properties: - region_id: + 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 - description: The ID of the Region to create the Draft Order in. - country_code: + format: date-time + description: The time at which the Discount should be available. + ends_at: 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: + format: date-time + description: The time at which the Discount should no longer be available. + valid_duration: 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. + 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: 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 - 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 + type: string metadata: - description: >- - The optional key-value map with additional details about the Line - Item. + description: An object containing metadata of the discount type: object AdminPostGiftCardsReq: type: object @@ -25594,6 +25599,65 @@ components: metadata: description: An optional set of key-value pairs to hold additional information. type: object + 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. + AdminNotesRes: + type: object + properties: + note: + $ref: '#/components/schemas/Note' + AdminNotesDeleteRes: + type: object + properties: + id: + type: string + description: The ID of the deleted Note. + object: + type: string + description: The type of the object that was deleted. + default: note + deleted: + type: boolean + description: Whether or not the Note was deleted. + default: true + AdminNotesListRes: + type: object + properties: + notes: + type: array + items: + $ref: '#/components/schemas/Note' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + AdminPostNotesNoteReq: + type: object + required: + - value + properties: + value: + type: string + description: The updated description of the Note. AdminPostInvitesInviteAcceptReq: type: object required: @@ -25659,65 +25723,6 @@ components: type: array items: $ref: '#/components/schemas/Invite' - 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. - AdminNotesRes: - type: object - properties: - note: - $ref: '#/components/schemas/Note' - AdminNotesDeleteRes: - type: object - properties: - id: - type: string - description: The ID of the deleted Note. - object: - type: string - description: The type of the object that was deleted. - default: note - deleted: - type: boolean - description: Whether or not the Note was deleted. - default: true - AdminNotesListRes: - type: object - properties: - notes: - type: array - items: - $ref: '#/components/schemas/Note' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - AdminPostNotesNoteReq: - type: object - required: - - value - properties: - value: - type: string - description: The updated description of the Note. AdminNotificationsListRes: type: object properties: @@ -25860,6 +25865,7 @@ components: description: The Claim Items that the Claim will consist of. type: array items: + type: object required: - item_id - quantity @@ -25910,6 +25916,7 @@ components: Replace. type: array items: + type: object required: - variant_id - quantity @@ -25924,6 +25931,7 @@ components: description: The Shipping Methods to send the additional Line Items with. type: array items: + type: object properties: id: description: The ID of an existing Shipping Method @@ -25958,6 +25966,7 @@ components: description: The Line Items to include in the Fulfillment. type: array items: + type: object required: - item_id - quantity @@ -26028,6 +26037,7 @@ components: description: The Line Items to return as part of the Swap. type: array items: + type: object required: - item_id - quantity @@ -26062,6 +26072,7 @@ components: description: The new items to send to the Customer. type: array items: + type: object required: - variant_id - quantity @@ -26078,6 +26089,7 @@ components: from. type: array items: + type: object required: - option_id - price @@ -26161,6 +26173,7 @@ components: description: The Line Items that will be returned. type: array items: + type: object required: - item_id - quantity @@ -26213,6 +26226,7 @@ components: description: The Claim Items that the Claim will consist of. type: array items: + type: object required: - id - images @@ -26271,6 +26285,7 @@ components: description: The Shipping Methods to send the additional Line Items with. type: array items: + type: object properties: id: description: The ID of an existing Shipping Method @@ -26413,6 +26428,7 @@ components: description: The prices to update or add. type: array items: + type: object required: - amount - variant_id @@ -26488,6 +26504,7 @@ components: description: The prices of the Price List. type: array items: + type: object required: - amount - variant_id @@ -26521,6 +26538,7 @@ components: type: array description: A list of customer groups that the Price List applies to. items: + type: object required: - id properties: @@ -26670,6 +26688,7 @@ components: description: The prices of the Price List. type: array items: + type: object required: - amount - variant_id @@ -26706,6 +26725,7 @@ components: type: array description: A list of customer groups that the Price List applies to. items: + type: object required: - id properties: @@ -26861,6 +26881,7 @@ components: description: Tags to associate the Product with. type: array items: + type: object required: - value properties: @@ -26874,6 +26895,7 @@ components: description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + type: object required: - id properties: @@ -26886,6 +26908,7 @@ components: properties the Product's Product Variants will differ. type: array items: + type: object required: - title properties: @@ -26896,6 +26919,7 @@ components: description: A list of Product Variants to create with the Product. type: array items: + type: object required: - title properties: @@ -26960,6 +26984,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -26989,6 +27014,7 @@ components: options: type: array items: + type: object required: - value properties: @@ -27089,6 +27115,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -27120,6 +27147,7 @@ components: options: type: array items: + type: object required: - option_id - value @@ -27223,6 +27251,7 @@ components: tags: type: array items: + type: object properties: id: description: The ID of the tag. @@ -27313,6 +27342,7 @@ components: description: Tags to associate the Product with. type: array items: + type: object required: - value properties: @@ -27326,6 +27356,7 @@ components: description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + type: object required: - id properties: @@ -27336,6 +27367,7 @@ components: description: A list of Product Variants to create with the Product. type: array items: + type: object properties: id: description: The ID of the Product Variant. @@ -27400,6 +27432,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -27432,6 +27465,7 @@ components: options: type: array items: + type: object required: - option_id - value @@ -27529,6 +27563,7 @@ components: prices: type: array items: + type: object required: - amount properties: @@ -27560,6 +27595,7 @@ components: options: type: array items: + type: object required: - option_id - value @@ -27979,6 +28015,7 @@ components: description: The Line Items that have been received. type: array items: + type: object required: - item_id - quantity @@ -28156,6 +28193,7 @@ components: be available. type: array items: + type: object required: - type - amount @@ -28235,6 +28273,7 @@ components: be available. type: array items: + type: object required: - type - amount diff --git a/docs/api/admin/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq.yaml b/docs/api/admin/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq.yaml index 1829b6c7cfd53..f8faad9a4eed3 100644 --- a/docs/api/admin/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq.yaml +++ b/docs/api/admin/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq.yaml @@ -6,6 +6,7 @@ properties: description: The ids of the customers to remove type: array items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq.yaml b/docs/api/admin/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq.yaml index 65ab064008a0c..02b1e9b06f591 100644 --- a/docs/api/admin/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq.yaml +++ b/docs/api/admin/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq.yaml @@ -6,6 +6,7 @@ properties: description: The resources to be deleted from the discount condition type: array items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq.yaml b/docs/api/admin/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq.yaml index ba460c4c792b6..f9d2ccacbea91 100644 --- a/docs/api/admin/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq.yaml @@ -6,6 +6,7 @@ properties: description: The ids of the customers to add type: array items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminPostCustomersCustomerReq.yaml b/docs/api/admin/components/schemas/AdminPostCustomersCustomerReq.yaml index c10421b691d47..9a4edf247c090 100644 --- a/docs/api/admin/components/schemas/AdminPostCustomersCustomerReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostCustomersCustomerReq.yaml @@ -20,6 +20,7 @@ properties: groups: type: array items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq.yaml b/docs/api/admin/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq.yaml index afe209d46ed35..c19f3561294d9 100644 --- a/docs/api/admin/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq.yaml @@ -6,6 +6,7 @@ properties: description: The resources to be added to the discount condition type: array items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsClaimReq.yaml b/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsClaimReq.yaml index 8ae3a23fe68a6..5670bd1ba23d5 100644 --- a/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsClaimReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsClaimReq.yaml @@ -4,6 +4,7 @@ properties: description: The Claim Items that the Claim will consist of. type: array items: + type: object required: - id - images @@ -60,6 +61,7 @@ properties: description: The Shipping Methods to send the additional Line Items with. type: array items: + type: object properties: id: description: The ID of an existing Shipping Method diff --git a/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsReq.yaml b/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsReq.yaml index cd86c5f9a0a07..c6d845f643509 100644 --- a/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostOrdersOrderClaimsReq.yaml @@ -17,6 +17,7 @@ properties: description: The Claim Items that the Claim will consist of. type: array items: + type: object required: - item_id - quantity @@ -63,6 +64,7 @@ properties: description: The new items to send to the Customer when the Claim type is Replace. type: array items: + type: object required: - variant_id - quantity @@ -77,6 +79,7 @@ properties: description: The Shipping Methods to send the additional Line Items with. type: array items: + type: object properties: id: description: The ID of an existing Shipping Method diff --git a/docs/api/admin/components/schemas/AdminPostOrdersOrderFulfillmentsReq.yaml b/docs/api/admin/components/schemas/AdminPostOrdersOrderFulfillmentsReq.yaml index c910300406bea..377b2b8f5f011 100644 --- a/docs/api/admin/components/schemas/AdminPostOrdersOrderFulfillmentsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostOrdersOrderFulfillmentsReq.yaml @@ -6,6 +6,7 @@ properties: description: The Line Items to include in the Fulfillment. type: array items: + type: object required: - item_id - quantity diff --git a/docs/api/admin/components/schemas/AdminPostOrdersOrderReturnsReq.yaml b/docs/api/admin/components/schemas/AdminPostOrdersOrderReturnsReq.yaml index 938c93c8ef095..383a5d143f723 100644 --- a/docs/api/admin/components/schemas/AdminPostOrdersOrderReturnsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostOrdersOrderReturnsReq.yaml @@ -6,6 +6,7 @@ properties: description: The Line Items that will be returned. type: array items: + type: object required: - item_id - quantity diff --git a/docs/api/admin/components/schemas/AdminPostOrdersOrderSwapsReq.yaml b/docs/api/admin/components/schemas/AdminPostOrdersOrderSwapsReq.yaml index 45e754b7762b4..42491fcf7b8db 100644 --- a/docs/api/admin/components/schemas/AdminPostOrdersOrderSwapsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostOrdersOrderSwapsReq.yaml @@ -6,6 +6,7 @@ properties: description: The Line Items to return as part of the Swap. type: array items: + type: object required: - item_id - quantity @@ -38,6 +39,7 @@ properties: description: The new items to send to the Customer. type: array items: + type: object required: - variant_id - quantity @@ -52,6 +54,7 @@ properties: description: The custom shipping options to potentially create a Shipping Method from. type: array items: + type: object required: - option_id - price diff --git a/docs/api/admin/components/schemas/AdminPostPriceListPricesPricesReq.yaml b/docs/api/admin/components/schemas/AdminPostPriceListPricesPricesReq.yaml index 28d3868fdb124..dc789b1ae4a69 100644 --- a/docs/api/admin/components/schemas/AdminPostPriceListPricesPricesReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostPriceListPricesPricesReq.yaml @@ -4,6 +4,7 @@ properties: description: The prices to update or add. type: array items: + type: object required: - amount - variant_id diff --git a/docs/api/admin/components/schemas/AdminPostPriceListsPriceListPriceListReq.yaml b/docs/api/admin/components/schemas/AdminPostPriceListsPriceListPriceListReq.yaml index 09bbab331ca01..090fb1305bf4e 100644 --- a/docs/api/admin/components/schemas/AdminPostPriceListsPriceListPriceListReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostPriceListsPriceListPriceListReq.yaml @@ -30,6 +30,7 @@ properties: description: The prices of the Price List. type: array items: + type: object required: - amount - variant_id @@ -66,6 +67,7 @@ properties: type: array description: A list of customer groups that the Price List applies to. items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminPostPriceListsPriceListReq.yaml b/docs/api/admin/components/schemas/AdminPostPriceListsPriceListReq.yaml index aeb0835071a33..fce72ccea1d3b 100644 --- a/docs/api/admin/components/schemas/AdminPostPriceListsPriceListReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostPriceListsPriceListReq.yaml @@ -35,6 +35,7 @@ properties: description: The prices of the Price List. type: array items: + type: object required: - amount - variant_id @@ -68,6 +69,7 @@ properties: type: array description: A list of customer groups that the Price List applies to. items: + type: object required: - id properties: diff --git a/docs/api/admin/components/schemas/AdminPostProductsProductReq.yaml b/docs/api/admin/components/schemas/AdminPostProductsProductReq.yaml index 024aaa2c9c251..0bce3d2cae3b9 100644 --- a/docs/api/admin/components/schemas/AdminPostProductsProductReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostProductsProductReq.yaml @@ -52,6 +52,7 @@ properties: description: Tags to associate the Product with. type: array items: + type: object required: - value properties: @@ -65,6 +66,7 @@ properties: description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + type: object required: - id properties: @@ -75,6 +77,7 @@ properties: description: A list of Product Variants to create with the Product. type: array items: + type: object properties: id: description: The ID of the Product Variant. @@ -135,6 +138,7 @@ properties: prices: type: array items: + type: object required: - amount properties: @@ -166,6 +170,7 @@ properties: options: type: array items: + type: object required: - option_id - value diff --git a/docs/api/admin/components/schemas/AdminPostProductsProductVariantsReq.yaml b/docs/api/admin/components/schemas/AdminPostProductsProductVariantsReq.yaml index d57a04ec20f12..84f2e0ca37478 100644 --- a/docs/api/admin/components/schemas/AdminPostProductsProductVariantsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostProductsProductVariantsReq.yaml @@ -62,6 +62,7 @@ properties: prices: type: array items: + type: object required: - amount properties: @@ -93,6 +94,7 @@ properties: options: type: array items: + type: object required: - option_id - value diff --git a/docs/api/admin/components/schemas/AdminPostProductsProductVariantsVariantReq.yaml b/docs/api/admin/components/schemas/AdminPostProductsProductVariantsVariantReq.yaml index 9deff44aeb1ee..c124bbb24deec 100644 --- a/docs/api/admin/components/schemas/AdminPostProductsProductVariantsVariantReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostProductsProductVariantsVariantReq.yaml @@ -58,6 +58,7 @@ properties: prices: type: array items: + type: object required: - amount properties: @@ -89,6 +90,7 @@ properties: options: type: array items: + type: object required: - option_id - value diff --git a/docs/api/admin/components/schemas/AdminPostProductsReq.yaml b/docs/api/admin/components/schemas/AdminPostProductsReq.yaml index a7790602186ed..b5624bc61f09e 100644 --- a/docs/api/admin/components/schemas/AdminPostProductsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostProductsReq.yaml @@ -63,6 +63,7 @@ properties: description: Tags to associate the Product with. type: array items: + type: object required: - value properties: @@ -76,6 +77,7 @@ properties: description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + type: object required: - id properties: @@ -88,6 +90,7 @@ properties: the Product's Product Variants will differ. type: array items: + type: object required: - title properties: @@ -98,6 +101,7 @@ properties: description: A list of Product Variants to create with the Product. type: array items: + type: object required: - title properties: @@ -158,6 +162,7 @@ properties: prices: type: array items: + type: object required: - amount properties: @@ -186,6 +191,7 @@ properties: options: type: array items: + type: object required: - value properties: diff --git a/docs/api/admin/components/schemas/AdminPostReturnsReturnReceiveReq.yaml b/docs/api/admin/components/schemas/AdminPostReturnsReturnReceiveReq.yaml index 68ee28260e3bb..c04d99907c03d 100644 --- a/docs/api/admin/components/schemas/AdminPostReturnsReturnReceiveReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostReturnsReturnReceiveReq.yaml @@ -6,6 +6,7 @@ properties: description: The Line Items that have been received. type: array items: + type: object required: - item_id - quantity diff --git a/docs/api/admin/components/schemas/AdminPostShippingOptionsOptionReq.yaml b/docs/api/admin/components/schemas/AdminPostShippingOptionsOptionReq.yaml index 91f0798ca7515..29bb98c358eff 100644 --- a/docs/api/admin/components/schemas/AdminPostShippingOptionsOptionReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostShippingOptionsOptionReq.yaml @@ -20,6 +20,7 @@ properties: available. type: array items: + type: object required: - type - amount diff --git a/docs/api/admin/components/schemas/AdminPostShippingOptionsReq.yaml b/docs/api/admin/components/schemas/AdminPostShippingOptionsReq.yaml index d5088992f19d5..632348bb8b40d 100644 --- a/docs/api/admin/components/schemas/AdminPostShippingOptionsReq.yaml +++ b/docs/api/admin/components/schemas/AdminPostShippingOptionsReq.yaml @@ -38,6 +38,7 @@ properties: available. type: array items: + type: object required: - type - amount diff --git a/docs/api/admin/components/schemas/AdminProductsListTagsRes.yaml b/docs/api/admin/components/schemas/AdminProductsListTagsRes.yaml index b795f110cec2e..12e422431bbde 100644 --- a/docs/api/admin/components/schemas/AdminProductsListTagsRes.yaml +++ b/docs/api/admin/components/schemas/AdminProductsListTagsRes.yaml @@ -3,6 +3,7 @@ properties: tags: type: array items: + type: object properties: id: description: The ID of the tag. diff --git a/docs/api/admin/openapi.yaml b/docs/api/admin/openapi.yaml index 4c2251095acd3..35b7c36304818 100644 --- a/docs/api/admin/openapi.yaml +++ b/docs/api/admin/openapi.yaml @@ -177,8 +177,6 @@ paths: $ref: paths/apps_authorizations.yaml /apps: $ref: paths/apps.yaml - /auth: - $ref: paths/auth.yaml /batch-jobs/{id}/cancel: $ref: paths/batch-jobs_{id}_cancel.yaml /batch-jobs/{id}/confirm: @@ -187,12 +185,6 @@ paths: $ref: paths/batch-jobs.yaml /batch-jobs/{id}: $ref: paths/batch-jobs_{id}.yaml - /collections/{id}/products/batch: - $ref: paths/collections_{id}_products_batch.yaml - /collections: - $ref: paths/collections.yaml - /collections/{id}: - $ref: paths/collections_{id}.yaml /currencies: $ref: paths/currencies.yaml /currencies/{code}: @@ -205,10 +197,30 @@ paths: $ref: paths/customer-groups_{id}.yaml /customer-groups/{id}/customers: $ref: paths/customer-groups_{id}_customers.yaml + /collections/{id}/products/batch: + $ref: paths/collections_{id}_products_batch.yaml + /collections: + $ref: paths/collections.yaml + /collections/{id}: + $ref: paths/collections_{id}.yaml /customers: $ref: paths/customers.yaml /customers/{id}: $ref: paths/customers_{id}.yaml + /auth: + $ref: paths/auth.yaml + /draft-orders: + $ref: paths/draft-orders.yaml + /draft-orders/{id}/line-items: + $ref: paths/draft-orders_{id}_line-items.yaml + /draft-orders/{id}: + $ref: paths/draft-orders_{id}.yaml + /draft-orders/{id}/line-items/{line_id}: + $ref: paths/draft-orders_{id}_line-items_{line_id}.yaml + /draft-orders/{id}/pay: + $ref: paths/draft-orders_{id}_pay.yaml + /admin/draft-orders/{id}: + $ref: paths/admin_draft-orders_{id}.yaml /discounts/{id}/regions/{region_id}: $ref: paths/discounts_{id}_regions_{region_id}.yaml /discounts/{discount_id}/conditions/{condition_id}/batch: @@ -227,22 +239,14 @@ paths: $ref: paths/discounts_{id}_dynamic-codes_{code}.yaml /discounts/code/{code}: $ref: paths/discounts_code_{code}.yaml - /draft-orders: - $ref: paths/draft-orders.yaml - /draft-orders/{id}/line-items: - $ref: paths/draft-orders_{id}_line-items.yaml - /draft-orders/{id}: - $ref: paths/draft-orders_{id}.yaml - /draft-orders/{id}/line-items/{line_id}: - $ref: paths/draft-orders_{id}_line-items_{line_id}.yaml - /draft-orders/{id}/pay: - $ref: paths/draft-orders_{id}_pay.yaml - /admin/draft-orders/{id}: - $ref: paths/admin_draft-orders_{id}.yaml /gift-cards: $ref: paths/gift-cards.yaml /gift-cards/{id}: $ref: paths/gift-cards_{id}.yaml + /notes: + $ref: paths/notes.yaml + /notes/{id}: + $ref: paths/notes_{id}.yaml /invites/accept: $ref: paths/invites_accept.yaml /invites: @@ -251,10 +255,6 @@ paths: $ref: paths/invites_{invite_id}.yaml /invites/{invite_id}/resend: $ref: paths/invites_{invite_id}_resend.yaml - /notes: - $ref: paths/notes.yaml - /notes/{id}: - $ref: paths/notes_{id}.yaml /notifications: $ref: paths/notifications.yaml /notifications/{id}/resend: @@ -562,7 +562,7 @@ components: ```tsx diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 61259dedfbb50..9a76805771274 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -1176,158 +1176,6 @@ paths: provider_id: type: string description: The ID of the Payment Provider. - '/collections/{id}': - get: - operationId: GetCollectionsCollection - summary: Get a Collection - description: Retrieves a Product Collection. - parameters: - - in: path - name: id - required: true - description: The id of the Product Collection - schema: - type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.collections.retrieve(collection_id) - - .then(({ collection }) => { - console.log(collection.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/collections/{id}' - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreCollectionsRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /collections: - get: - operationId: GetCollections - summary: List Collections - description: Retrieve a list of Product Collection. - parameters: - - in: query - name: offset - description: >- - The number of collections to skip before starting to collect the - collections set - schema: - type: integer - default: 0 - - in: query - name: limit - description: The number of collections to return - schema: - type: integer - default: 10 - - in: query - name: created_at - description: Date comparison for when resulting collections were created. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - - in: query - name: updated_at - description: Date comparison for when resulting collections were updated. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.collections.list() - - .then(({ collections, limit, offset, count }) => { - console.log(collections.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/collections' - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreCollectionsListRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /customers/me/addresses: post: operationId: PostCustomersCustomerAddresses @@ -2140,16 +1988,16 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/gift-cards/{code}': + '/collections/{id}': get: - operationId: GetGiftCardsCode - summary: Get Gift Card by Code - description: Retrieves a Gift Card by its associated unqiue code. + operationId: GetCollectionsCollection + summary: Get a Collection + description: Retrieves a Product Collection. parameters: - in: path - name: code + name: id required: true - description: The unique Gift Card code. + description: The id of the Product Collection schema: type: string x-codeSamples: @@ -2161,25 +2009,25 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.giftCards.retrieve(code) + medusa.collections.retrieve(collection_id) - .then(({ gift_card }) => { - console.log(gift_card.id); + .then(({ collection }) => { + console.log(collection.id); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/store/gift-cards/{code}' + 'https://medusa-url.com/store/collections/{id}' tags: - - Gift Card + - Collection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StoreGiftCardsRes' + $ref: '#/components/schemas/StoreCollectionsRes' '400': $ref: '#/components/responses/400_error' '404': @@ -2190,18 +2038,70 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/order-edits/{id}/complete': - post: - operationId: PostOrderEditsOrderEditComplete - summary: Completes an OrderEdit - description: Completes an OrderEdit. + /collections: + get: + operationId: GetCollections + summary: List Collections + description: Retrieve a list of Product Collection. parameters: - - in: path - name: id - required: true - description: The ID of the Order Edit. + - in: query + name: offset + description: >- + The number of collections to skip before starting to collect the + collections set schema: - type: string + type: integer + default: 0 + - in: query + name: limit + description: The number of collections to return + schema: + type: integer + default: 10 + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date x-codeSamples: - lang: JavaScript label: JS Client @@ -2211,14 +2111,114 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.orderEdits.complete(order_edit_id) - .then(({ order_edit }) => { - console.log(order_edit.id) - }) - - lang: Shell - label: cURL - source: > - curl --location --request POST + medusa.collections.list() + + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections' + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreCollectionsListRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/gift-cards/{code}': + get: + operationId: GetGiftCardsCode + summary: Get Gift Card by Code + description: Retrieves a Gift Card by its associated unqiue code. + parameters: + - in: path + name: code + required: true + description: The unique Gift Card code. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.giftCards.retrieve(code) + + .then(({ gift_card }) => { + console.log(gift_card.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/gift-cards/{code}' + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreGiftCardsRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/order-edits/{id}/complete': + post: + operationId: PostOrderEditsOrderEditComplete + summary: Completes an OrderEdit + description: Completes an OrderEdit. + parameters: + - in: path + name: id + required: true + description: The ID of the Order Edit. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.orderEdits.complete(order_edit_id) + .then(({ order_edit }) => { + console.log(order_edit.id) + }) + - lang: Shell + label: cURL + source: > + curl --location --request POST 'https://medusa-url.com/store/order-edits/{id}/complete' tags: - OrderEdit @@ -2646,25 +2646,102 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/payment-collections/{id}/sessions/batch/authorize': - post: - operationId: PostPaymentCollectionsSessionsBatchAuthorize - summary: Authorize PaymentSessions - description: Authorizes Payment Sessions of a Payment Collection. - x-authenticated: false + /product-tags: + get: + operationId: GetProductTags + summary: List Product Tags + description: Retrieve a list of Product Tags. + x-authenticated: true parameters: - - in: path + - in: query + name: limit + description: The number of types to return. + schema: + type: integer + default: 20 + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. + schema: + type: string + - in: query + name: discount_condition_id + description: The discount condition id on which to filter the product tags. + schema: + type: string + - in: query + name: value + style: form + explode: false + description: The tag values to search for + schema: + type: array + items: + type: string + - in: query name: id - required: true - description: The ID of the Payment Collections. + style: form + explode: false + description: The tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for schema: type: string - requestBody: - content: - application/json: - schema: - $ref: >- - #/components/schemas/StorePostPaymentCollectionsBatchSessionsAuthorizeReq + - in: query + name: created_at + description: Date comparison for when resulting product tags were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting product tags were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date x-codeSamples: - lang: JavaScript label: JS Client @@ -2674,30 +2751,37 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - // must be previously logged in or use api token - - medusa.paymentCollections.authorize(payment_id) + medusa.productTags.list() - .then(({ payment_collection }) => { - console.log(payment_collection.id); + .then(({ product_tags }) => { + console.log(product_tags.length); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/store/payment-collections/{id}/sessions/batch/authorize' - security: - - api_token: [] - - cookie_auth: [] + curl --location --request GET + 'https://medusa-url.com/store/product-tags' tags: - - PaymentCollection + - Product Tag responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StorePaymentCollectionsRes' + type: object + properties: + product_tags: + $ref: '#/components/schemas/ProductTag' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '400': $ref: '#/components/responses/400_error' '401': @@ -2710,23 +2794,31 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/payment-collections/{id}/sessions/{session_id}/authorize': - post: - operationId: PostPaymentCollectionsSessionsSessionAuthorize - summary: Authorize Payment Session - description: Authorizes a Payment Session of a Payment Collection. + '/product-categories/{id}': + get: + operationId: GetProductCategoriesCategory + summary: Get a Product Category + description: Retrieves a Product Category. x-authenticated: false parameters: - in: path name: id required: true - description: The ID of the Payment Collections. + description: The ID of the Product Category schema: type: string - - in: path - name: session_id - required: true - description: The ID of the Payment Session. + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product + category. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be retrieved in each product + category. schema: type: string x-codeSamples: @@ -2740,28 +2832,30 @@ paths: // must be previously logged in or use api token - medusa.paymentCollections.authorize(payment_id, session_id) + medusa.productCategories.retrieve("pcat-id") - .then(({ payment_collection }) => { - console.log(payment_collection.id); + .then(({ productCategory }) => { + console.log(productCategory.id); }); - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/store/payment-collections/{id}/sessions/{session_id}/authorize' + curl --location --request GET + 'https://medusa-url.com/store/product-categories/{id}' \ + + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - PaymentCollection + - Product Category responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StorePaymentCollectionsSessionRes' + $ref: '#/components/schemas/StoreGetProductCategoryRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2774,61 +2868,69 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/payment-collections/{id}': + /product-categories: get: - operationId: GetPaymentCollectionsPaymentCollection - summary: Get a PaymentCollection - description: Get a Payment Collection + operationId: GetProductCategories + summary: List Product Categories + description: Retrieve a list of product categories. x-authenticated: false parameters: - - in: path - name: id - required: true - description: The ID of the PaymentCollection. + - in: query + name: q + description: Query used for searching product category names orhandles. schema: type: string - in: query - name: expand - description: Comma separated list of relations to include in the results. + name: parent_category_id + description: Returns categories scoped by parent schema: type: string - in: query - name: fields - description: Comma separated list of fields to include in the results. + name: offset + description: How many product categories to skip in the result. schema: - type: string + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of product categories returned. + schema: + type: integer + default: 100 x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.paymentCollections.retrieve(paymentCollectionId) - .then(({ payment_collection }) => { - console.log(payment_collection.id) - }) - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/store/payment-collections/{id}' + 'https://medusa-url.com/store/product-categories' \ + + --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - PaymentCollection + - Product Category responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StorePaymentCollectionsRes' + type: object + properties: + product_categories: + type: array + items: + $ref: '#/components/schemas/ProductCategory' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '400': $ref: '#/components/responses/400_error' '401': @@ -2841,11 +2943,11 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/payment-collections/{id}/sessions/batch': + '/payment-collections/{id}/sessions/batch/authorize': post: - operationId: PostPaymentCollectionsPaymentCollectionSessionsBatch - summary: Manage Payment Sessions - description: Manages Multiple Payment Sessions from Payment Collections. + operationId: PostPaymentCollectionsSessionsBatchAuthorize + summary: Authorize PaymentSessions + description: Authorizes Payment Sessions of a Payment Collection. x-authenticated: false parameters: - in: path @@ -2858,7 +2960,8 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/StorePostPaymentCollectionsBatchSessionsReq' + $ref: >- + #/components/schemas/StorePostPaymentCollectionsBatchSessionsAuthorizeReq x-codeSamples: - lang: JavaScript label: JS Client @@ -2870,34 +2973,7 @@ paths: // must be previously logged in or use api token - // Total amount = 10000 - - // Adding two new sessions - - medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [ - { - provider_id: "stripe", - amount: 5000, - }, - { - provider_id: "manual", - amount: 5000, - }, - ]) - - .then(({ payment_collection }) => { - console.log(payment_collection.id); - }); - - // Updating one session and removing the other - - medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [ - { - provider_id: "stripe", - amount: 10000, - session_id: "ps_123456" - }, - ]) + medusa.paymentCollections.authorize(payment_id) .then(({ payment_collection }) => { console.log(payment_collection.id); @@ -2906,7 +2982,7 @@ paths: label: cURL source: > curl --location --request POST - 'https://medusa-url.com/store/payment-collections/{id}/sessions/batch' + 'https://medusa-url.com/store/payment-collections/{id}/sessions/batch/authorize' security: - api_token: [] - cookie_auth: [] @@ -2931,24 +3007,25 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/payment-collections/{id}/sessions': + '/payment-collections/{id}/sessions/{session_id}/authorize': post: - operationId: PostPaymentCollectionsSessions - summary: Manage a Payment Session - description: Manages Payment Sessions from Payment Collections. + operationId: PostPaymentCollectionsSessionsSessionAuthorize + summary: Authorize Payment Session + description: Authorizes a Payment Session of a Payment Collection. x-authenticated: false parameters: - in: path name: id required: true - description: The ID of the Payment Collection. + description: The ID of the Payment Collections. + schema: + type: string + - in: path + name: session_id + required: true + description: The ID of the Payment Session. schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePaymentCollectionSessionsReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -2960,12 +3037,7 @@ paths: // must be previously logged in or use api token - // Total amount = 10000 - - // Adding a payment session - - medusa.paymentCollections.managePaymentSession(payment_id, { - provider_id: "stripe" }) + medusa.paymentCollections.authorize(payment_id, session_id) .then(({ payment_collection }) => { console.log(payment_collection.id); @@ -2974,7 +3046,7 @@ paths: label: cURL source: > curl --location --request POST - 'https://medusa-url.com/store/payment-collections/{id}/sessions' + 'https://medusa-url.com/store/payment-collections/{id}/sessions/{session_id}/authorize' security: - api_token: [] - cookie_auth: [] @@ -2986,7 +3058,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/StorePaymentCollectionsRes' + $ref: '#/components/schemas/StorePaymentCollectionsSessionRes' '400': $ref: '#/components/responses/400_error' '401': @@ -2999,25 +3071,27 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/payment-collections/{id}/sessions/{session_id}': - post: - operationId: PostPaymentCollectionsPaymentCollectionPaymentSessionsSession - summary: Refresh a Payment Session - description: >- - Refreshes a Payment Session to ensure that it is in sync with the - Payment Collection. + '/payment-collections/{id}': + get: + operationId: GetPaymentCollectionsPaymentCollection + summary: Get a PaymentCollection + description: Get a Payment Collection x-authenticated: false parameters: - in: path name: id required: true - description: The id of the PaymentCollection. + description: The ID of the PaymentCollection. schema: type: string - - in: path - name: session_id - required: true - description: The id of the Payment Session to be refreshed. + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. schema: type: string x-codeSamples: @@ -3029,17 +3103,20 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.paymentCollections.refreshPaymentSession(payment_collection_id, - session_id) + // must be previously logged in or use api token - .then(({ payment_session }) => { - console.log(payment_session.id); - }); + medusa.paymentCollections.retrieve(paymentCollectionId) + .then(({ payment_collection }) => { + console.log(payment_collection.id) + }) - lang: Shell label: cURL source: > - curl --location --request POST - 'https://medusa-url.com/store/payment-collections/{id}/sessions/{session_id}' + curl --location --request GET + 'https://medusa-url.com/store/payment-collections/{id}' + security: + - api_token: [] + - cookie_auth: [] tags: - PaymentCollection responses: @@ -3048,9 +3125,11 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/StorePaymentCollectionsSessionRes' + $ref: '#/components/schemas/StorePaymentCollectionsRes' '400': $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found_error' '409': @@ -3059,33 +3138,24 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/product-categories/{id}': - get: - operationId: GetProductCategoriesCategory - summary: Get a Product Category - description: Retrieves a Product Category. + '/payment-collections/{id}/sessions/batch': + post: + operationId: PostPaymentCollectionsPaymentCollectionSessionsBatch + summary: Manage Payment Sessions + description: Manages Multiple Payment Sessions from Payment Collections. x-authenticated: false parameters: - in: path name: id required: true - description: The ID of the Product Category - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each product - category. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be retrieved in each product - category. + description: The ID of the Payment Collections. schema: type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostPaymentCollectionsBatchSessionsReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -3097,30 +3167,55 @@ paths: // must be previously logged in or use api token - medusa.productCategories.retrieve("pcat-id") + // Total amount = 10000 - .then(({ productCategory }) => { - console.log(productCategory.id); + // Adding two new sessions + + medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [ + { + provider_id: "stripe", + amount: 5000, + }, + { + provider_id: "manual", + amount: 5000, + }, + ]) + + .then(({ payment_collection }) => { + console.log(payment_collection.id); + }); + + // Updating one session and removing the other + + medusa.paymentCollections.managePaymentSessionsBatch(payment_id, [ + { + provider_id: "stripe", + amount: 10000, + session_id: "ps_123456" + }, + ]) + + .then(({ payment_collection }) => { + console.log(payment_collection.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/store/product-categories/{id}' \ - - --header 'Authorization: Bearer {api_token}' + curl --location --request POST + 'https://medusa-url.com/store/payment-collections/{id}/sessions/batch' security: - api_token: [] - cookie_auth: [] tags: - - Product Category + - PaymentCollection responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StoreGetProductCategoryRes' + $ref: '#/components/schemas/StorePaymentCollectionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3133,69 +3228,62 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /product-categories: - get: - operationId: GetProductCategories - summary: List Product Categories - description: Retrieve a list of product categories. + '/payment-collections/{id}/sessions': + post: + operationId: PostPaymentCollectionsSessions + summary: Manage a Payment Session + description: Manages Payment Sessions from Payment Collections. x-authenticated: false parameters: - - in: query - name: q - description: Query used for searching product category names orhandles. - schema: - type: string - - in: query - name: parent_category_id - description: Returns categories scoped by parent + - in: path + name: id + required: true + description: The ID of the Payment Collection. schema: type: string - - in: query - name: offset - description: How many product categories to skip in the result. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of product categories returned. - schema: - type: integer - default: 100 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePaymentCollectionSessionsReq' x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + // Total amount = 10000 + + // Adding a payment session + + medusa.paymentCollections.managePaymentSession(payment_id, { + provider_id: "stripe" }) + + .then(({ payment_collection }) => { + console.log(payment_collection.id); + }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/store/product-categories' \ - - --header 'Authorization: Bearer {api_token}' + curl --location --request POST + 'https://medusa-url.com/store/payment-collections/{id}/sessions' security: - api_token: [] - cookie_auth: [] tags: - - Product Category + - PaymentCollection responses: '200': description: OK content: application/json: schema: - type: object - properties: - product_categories: - type: array - items: - $ref: '#/components/schemas/ProductCategory' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page + $ref: '#/components/schemas/StorePaymentCollectionsRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3208,102 +3296,27 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /product-tags: - get: - operationId: GetProductTags - summary: List Product Tags - description: Retrieve a list of Product Tags. - x-authenticated: true + '/payment-collections/{id}/sessions/{session_id}': + post: + operationId: PostPaymentCollectionsPaymentCollectionPaymentSessionsSession + summary: Refresh a Payment Session + description: >- + Refreshes a Payment Session to ensure that it is in sync with the + Payment Collection. + x-authenticated: false parameters: - - in: query - name: limit - description: The number of types to return. - schema: - type: integer - default: 20 - - in: query - name: offset - description: The number of items to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: order - description: The field to sort items by. - schema: - type: string - - in: query - name: discount_condition_id - description: The discount condition id on which to filter the product tags. - schema: - type: string - - in: query - name: value - style: form - explode: false - description: The tag values to search for - schema: - type: array - items: - type: string - - in: query + - in: path name: id - style: form - explode: false - description: The tag IDs to search for - schema: - type: array - items: - type: string - - in: query - name: q - description: A query string to search values for + required: true + description: The id of the PaymentCollection. schema: type: string - - in: query - name: created_at - description: Date comparison for when resulting product tags were created. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - - in: query - name: updated_at - description: Date comparison for when resulting product tags were updated. + - in: path + name: session_id + required: true + description: The id of the Payment Session to be refreshed. schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date + type: string x-codeSamples: - lang: JavaScript label: JS Client @@ -3313,41 +3326,28 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.productTags.list() + medusa.paymentCollections.refreshPaymentSession(payment_collection_id, + session_id) - .then(({ product_tags }) => { - console.log(product_tags.length); + .then(({ payment_session }) => { + console.log(payment_session.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/store/product-tags' + curl --location --request POST + 'https://medusa-url.com/store/payment-collections/{id}/sessions/{session_id}' tags: - - Product Tag + - PaymentCollection responses: '200': description: OK content: application/json: schema: - type: object - properties: - product_tags: - $ref: '#/components/schemas/ProductTag' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page + $ref: '#/components/schemas/StorePaymentCollectionsSessionRes' '400': $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found_error' '409': @@ -10602,6 +10602,7 @@ components: Items from. type: array items: + type: object required: - variant_id - quantity @@ -10695,6 +10696,7 @@ components: description: An array of Gift Card codes to add to the Cart. type: array items: + type: object required: - code properties: @@ -10705,6 +10707,7 @@ components: description: An array of Discount codes to add to the Cart. type: array items: + type: object required: - code properties: @@ -10720,27 +10723,6 @@ components: example: ip: '::1' user_agent: Chrome - StoreCollectionsListRes: - type: object - properties: - collections: - type: array - items: - $ref: '#/components/schemas/ProductCollection' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - StoreCollectionsRes: - type: object - properties: - collection: - $ref: '#/components/schemas/ProductCollection' StorePostCustomersCustomerAddressesReq: type: object required: @@ -10880,6 +10862,27 @@ components: metadata: description: Metadata about the customer. type: object + StoreCollectionsListRes: + type: object + properties: + collections: + type: array + items: + $ref: '#/components/schemas/ProductCollection' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + StoreCollectionsRes: + type: object + properties: + collection: + $ref: '#/components/schemas/ProductCollection' StoreGiftCardsRes: type: object properties: @@ -10919,6 +10922,11 @@ components: type: array items: type: string + StoreGetProductCategoryRes: + type: object + properties: + product_category: + $ref: '#/components/schemas/ProductCategory' StorePostPaymentCollectionsBatchSessionsAuthorizeReq: type: object required: @@ -10951,6 +10959,7 @@ components: be deleted and the provided ones will be created. type: array items: + type: object required: - provider_id - amount @@ -10972,11 +10981,6 @@ components: provider_id: type: string description: The ID of the Payment Provider. - StoreGetProductCategoryRes: - type: object - properties: - product_category: - $ref: '#/components/schemas/ProductCategory' StoreProductTypesListRes: type: object properties: @@ -11059,6 +11063,7 @@ components: description: The items to include in the Return. type: array items: + type: object required: - item_id - quantity @@ -11115,6 +11120,7 @@ components: description: The items to include in the Return. type: array items: + type: object required: - item_id - quantity @@ -11138,6 +11144,7 @@ components: description: The items to exchange the returned items to. type: array items: + type: object required: - variant_id - quantity diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index 61259dedfbb50..b90075924f326 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -333,6 +333,158 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + '/collections/{id}': + get: + operationId: GetCollectionsCollection + summary: Get a Collection + description: Retrieves a Product Collection. + parameters: + - in: path + name: id + required: true + description: The id of the Product Collection + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.collections.retrieve(collection_id) + + .then(({ collection }) => { + console.log(collection.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections/{id}' + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreCollectionsRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /collections: + get: + operationId: GetCollections + summary: List Collections + description: Retrieve a list of Product Collection. + parameters: + - in: query + name: offset + description: >- + The number of collections to skip before starting to collect the + collections set + schema: + type: integer + default: 0 + - in: query + name: limit + description: The number of collections to return + schema: + type: integer + default: 10 + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.collections.list() + + .then(({ collections, limit, offset, count }) => { + console.log(collections.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/collections' + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreCollectionsListRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' '/carts/{id}/shipping-methods': post: operationId: PostCartsCartShippingMethod @@ -1176,18 +1328,17 @@ paths: provider_id: type: string description: The ID of the Payment Provider. - '/collections/{id}': - get: - operationId: GetCollectionsCollection - summary: Get a Collection - description: Retrieves a Product Collection. - parameters: - - in: path - name: id - required: true - description: The id of the Product Collection - schema: - type: string + /customers/me/addresses: + post: + operationId: PostCustomersCustomerAddresses + summary: Add a Shipping Address + description: Adds a Shipping Address to a Customer's saved addresses. + x-authenticated: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostCustomersCustomerAddressesReq' x-codeSamples: - lang: JavaScript label: JS Client @@ -1197,213 +1348,62 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.collections.retrieve(collection_id) + // must be previously logged - .then(({ collection }) => { - console.log(collection.id); + medusa.customers.addresses.addAddress({ + address: { + first_name: 'Celia', + last_name: 'Schumm', + address_1: '225 Bednar Curve', + city: 'Danielville', + country_code: 'US', + postal_code: '85137', + phone: '981-596-6748 x90188', + company: 'Wyman LLC', + address_2: '', + province: 'Georgia', + metadata: {} + } + }) + + .then(({ customer }) => { + console.log(customer.id); }); - lang: Shell label: cURL source: > - curl --location --request GET - 'https://medusa-url.com/store/collections/{id}' + curl --location --request POST + 'https://medusa-url.com/store/customers/me/addresses' \ + + --header 'Cookie: connect.sid={sid}' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "address": { + "first_name": "Celia", + "last_name": "Schumm", + "address_1": "225 Bednar Curve", + "city": "Danielville", + "country_code": "US", + "postal_code": "85137" + } + }' + security: + - cookie_auth: [] tags: - - Collection + - Customer responses: '200': - description: OK + description: A successful response content: application/json: schema: - $ref: '#/components/schemas/StoreCollectionsRes' + $ref: '#/components/schemas/StoreCustomersRes' '400': $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /collections: - get: - operationId: GetCollections - summary: List Collections - description: Retrieve a list of Product Collection. - parameters: - - in: query - name: offset - description: >- - The number of collections to skip before starting to collect the - collections set - schema: - type: integer - default: 0 - - in: query - name: limit - description: The number of collections to return - schema: - type: integer - default: 10 - - in: query - name: created_at - description: Date comparison for when resulting collections were created. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - - in: query - name: updated_at - description: Date comparison for when resulting collections were updated. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.collections.list() - - .then(({ collections, limit, offset, count }) => { - console.log(collections.length); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/collections' - tags: - - Collection - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreCollectionsListRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /customers/me/addresses: - post: - operationId: PostCustomersCustomerAddresses - summary: Add a Shipping Address - description: Adds a Shipping Address to a Customer's saved addresses. - x-authenticated: true - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePostCustomersCustomerAddressesReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged - - medusa.customers.addresses.addAddress({ - address: { - first_name: 'Celia', - last_name: 'Schumm', - address_1: '225 Bednar Curve', - city: 'Danielville', - country_code: 'US', - postal_code: '85137', - phone: '981-596-6748 x90188', - company: 'Wyman LLC', - address_2: '', - province: 'Georgia', - metadata: {} - } - }) - - .then(({ customer }) => { - console.log(customer.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/customers/me/addresses' \ - - --header 'Cookie: connect.sid={sid}' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "address": { - "first_name": "Celia", - "last_name": "Schumm", - "address_1": "225 Bednar Curve", - "city": "Danielville", - "country_code": "US", - "postal_code": "85137" - } - }' - security: - - cookie_auth: [] - tags: - - Customer - responses: - '200': - description: A successful response - content: - application/json: - schema: - $ref: '#/components/schemas/StoreCustomersRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' + '401': + $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found_error' '409': @@ -2341,90 +2341,238 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /orders/customer/confirm: - post: - operationId: PostOrdersCustomerOrderClaimsCustomerOrderClaimAccept - summary: Verify an Order Claim - description: >- - Verifies the claim order token provided to the customer upon request of - order ownership - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePostCustomersCustomerAcceptClaimReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.orders.confirmRequest( - token, - ) - - .then(() => { - // successful - }) - - .catch(() => { - // an error occurred - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/orders/customer/confirm' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "token": "{token}", - }' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Order - responses: - '200': - description: OK - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - '/orders/cart/{cart_id}': + /product-tags: get: - operationId: GetOrdersOrderCartId - summary: Get by Cart ID - description: >- - Retrieves an Order by the id of the Cart that was used to create the - Order. + operationId: GetProductTags + summary: List Product Tags + description: Retrieve a list of Product Tags. + x-authenticated: true parameters: - - in: path - name: cart_id - required: true - description: The ID of Cart. + - in: query + name: limit + description: The number of types to return. + schema: + type: integer + default: 20 + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. schema: type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" + - in: query + name: discount_condition_id + description: The discount condition id on which to filter the product tags. + schema: + type: string + - in: query + name: value + style: form + explode: false + description: The tag values to search for + schema: + type: array + items: + type: string + - in: query + name: id + style: form + explode: false + description: The tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting product tags were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting product tags were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.productTags.list() + + .then(({ product_tags }) => { + console.log(product_tags.length); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/product-tags' + tags: + - Product Tag + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + product_tags: + $ref: '#/components/schemas/ProductTag' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /orders/customer/confirm: + post: + operationId: PostOrdersCustomerOrderClaimsCustomerOrderClaimAccept + summary: Verify an Order Claim + description: >- + Verifies the claim order token provided to the customer upon request of + order ownership + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostCustomersCustomerAcceptClaimReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.orders.confirmRequest( + token, + ) + + .then(() => { + // successful + }) + + .catch(() => { + // an error occurred + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/orders/customer/confirm' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "token": "{token}", + }' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Order + responses: + '200': + description: OK + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + '/orders/cart/{cart_id}': + get: + operationId: GetOrdersOrderCartId + summary: Get by Cart ID + description: >- + Retrieves an Order by the id of the Cart that was used to create the + Order. + parameters: + - in: path + name: cart_id + required: true + description: The ID of Cart. + schema: + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) @@ -3059,189 +3207,40 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - '/product-categories/{id}': + /product-types: get: - operationId: GetProductCategoriesCategory - summary: Get a Product Category - description: Retrieves a Product Category. - x-authenticated: false + operationId: GetProductTypes + summary: List Product Types + description: Retrieve a list of Product Types. + x-authenticated: true parameters: - - in: path - name: id - required: true - description: The ID of the Product Category + - in: query + name: limit + description: The number of types to return. schema: - type: string + type: integer + default: 20 - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each product - category. + name: offset + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. schema: type: string - in: query - name: fields - description: >- - (Comma separated) Which fields should be retrieved in each product - category. - schema: - type: string - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.productCategories.retrieve("pcat-id") - - .then(({ productCategory }) => { - console.log(productCategory.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/product-categories/{id}' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreGetProductCategoryRes' - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-categories: - get: - operationId: GetProductCategories - summary: List Product Categories - description: Retrieve a list of product categories. - x-authenticated: false - parameters: - - in: query - name: q - description: Query used for searching product category names orhandles. - schema: - type: string - - in: query - name: parent_category_id - description: Returns categories scoped by parent - schema: - type: string - - in: query - name: offset - description: How many product categories to skip in the result. - schema: - type: integer - default: 0 - - in: query - name: limit - description: Limit the number of product categories returned. - schema: - type: integer - default: 100 - x-codeSamples: - - lang: Shell - label: cURL - source: > - curl --location --request GET - 'https://medusa-url.com/store/product-categories' \ - - --header 'Authorization: Bearer {api_token}' - security: - - api_token: [] - - cookie_auth: [] - tags: - - Product Category - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - product_categories: - type: array - items: - $ref: '#/components/schemas/ProductCategory' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - '400': - $ref: '#/components/responses/400_error' - '401': - $ref: '#/components/responses/unauthorized' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' - /product-tags: - get: - operationId: GetProductTags - summary: List Product Tags - description: Retrieve a list of Product Tags. - x-authenticated: true - parameters: - - in: query - name: limit - description: The number of types to return. - schema: - type: integer - default: 20 - - in: query - name: offset - description: The number of items to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: order - description: The field to sort items by. - schema: - type: string - - in: query - name: discount_condition_id - description: The discount condition id on which to filter the product tags. + name: discount_condition_id + description: The discount condition id on which to filter the product types. schema: type: string - in: query name: value style: form explode: false - description: The tag values to search for + description: The type values to search for schema: type: array items: @@ -3250,7 +3249,7 @@ paths: name: id style: form explode: false - description: The tag IDs to search for + description: The type IDs to search for schema: type: array items: @@ -3262,7 +3261,7 @@ paths: type: string - in: query name: created_at - description: Date comparison for when resulting product tags were created. + description: Date comparison for when resulting product types were created. schema: type: object properties: @@ -3284,7 +3283,7 @@ paths: format: date - in: query name: updated_at - description: Date comparison for when resulting product tags were updated. + description: Date comparison for when resulting product types were updated. schema: type: object properties: @@ -3313,37 +3312,32 @@ paths: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) - medusa.productTags.list() + // must be previously logged in or use api token - .then(({ product_tags }) => { - console.log(product_tags.length); + medusa.productTypes.list() + + .then(({ product_types }) => { + console.log(product_types.length); }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/store/product-tags' + 'https://medusa-url.com/store/product-types' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] tags: - - Product Tag + - Product Type responses: '200': description: OK content: application/json: schema: - type: object - properties: - product_tags: - $ref: '#/components/schemas/ProductTag' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page + $ref: '#/components/schemas/StoreProductTypesListRes' '400': $ref: '#/components/responses/400_error' '401': @@ -3356,137 +3350,143 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /product-types: + '/product-categories/{id}': get: - operationId: GetProductTypes - summary: List Product Types - description: Retrieve a list of Product Types. - x-authenticated: true + operationId: GetProductCategoriesCategory + summary: Get a Product Category + description: Retrieves a Product Category. + x-authenticated: false parameters: - - in: query - name: limit - description: The number of types to return. - schema: - type: integer - default: 20 - - in: query - name: offset - description: The number of items to skip before the results. - schema: - type: integer - default: 0 - - in: query - name: order - description: The field to sort items by. + - in: path + name: id + required: true + description: The ID of the Product Category schema: type: string - in: query - name: discount_condition_id - description: The discount condition id on which to filter the product types. + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product + category. schema: type: string - in: query - name: value - style: form - explode: false - description: The type values to search for - schema: - type: array - items: - type: string - - in: query - name: id - style: form - explode: false - description: The type IDs to search for + name: fields + description: >- + (Comma separated) Which fields should be retrieved in each product + category. schema: - type: array - items: - type: string + type: string + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + // must be previously logged in or use api token + + medusa.productCategories.retrieve("pcat-id") + + .then(({ productCategory }) => { + console.log(productCategory.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request GET + 'https://medusa-url.com/store/product-categories/{id}' \ + + --header 'Authorization: Bearer {api_token}' + security: + - api_token: [] + - cookie_auth: [] + tags: + - Product Category + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreGetProductCategoryRes' + '400': + $ref: '#/components/responses/400_error' + '401': + $ref: '#/components/responses/unauthorized' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' + /product-categories: + get: + operationId: GetProductCategories + summary: List Product Categories + description: Retrieve a list of product categories. + x-authenticated: false + parameters: - in: query name: q - description: A query string to search values for + description: Query used for searching product category names orhandles. schema: type: string - in: query - name: created_at - description: Date comparison for when resulting product types were created. - schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date - - in: query - name: updated_at - description: Date comparison for when resulting product types were updated. + name: parent_category_id + description: Returns categories scoped by parent schema: - type: object - properties: - lt: - type: string - description: filter by dates less than this date - format: date - gt: - type: string - description: filter by dates greater than this date - format: date - lte: - type: string - description: filter by dates less than or equal to this date - format: date - gte: - type: string - description: filter by dates greater than or equal to this date - format: date + type: string + - in: query + name: offset + description: How many product categories to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of product categories returned. + schema: + type: integer + default: 100 x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - // must be previously logged in or use api token - - medusa.productTypes.list() - - .then(({ product_types }) => { - console.log(product_types.length); - }); - lang: Shell label: cURL source: > curl --location --request GET - 'https://medusa-url.com/store/product-types' \ + 'https://medusa-url.com/store/product-categories' \ --header 'Authorization: Bearer {api_token}' security: - api_token: [] - cookie_auth: [] tags: - - Product Type + - Product Category responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/StoreProductTypesListRes' + type: object + properties: + product_categories: + type: array + items: + $ref: '#/components/schemas/ProductCategory' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '400': $ref: '#/components/responses/400_error' '401': @@ -4072,74 +4072,6 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' - /returns: - post: - operationId: PostReturns - summary: Create Return - description: Creates a Return for an Order. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/StorePostReturnsReq' - x-codeSamples: - - lang: JavaScript - label: JS Client - source: > - import Medusa from "@medusajs/medusa-js" - - const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: - 3 }) - - medusa.returns.create({ - order_id, - items: [ - { - item_id, - quantity: 1 - } - ] - }) - - .then((data) => { - console.log(data.return.id); - }); - - lang: Shell - label: cURL - source: > - curl --location --request POST - 'https://medusa-url.com/store/returns' \ - - --header 'Content-Type: application/json' \ - - --data-raw '{ - "order_id": "asfasf", - "items": [ - { - "item_id": "assfasf", - "quantity": 1 - } - ] - }' - tags: - - Return - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/StoreReturnsRes' - '400': - $ref: '#/components/responses/400_error' - '404': - $ref: '#/components/responses/not_found_error' - '409': - $ref: '#/components/responses/invalid_state_error' - '422': - $ref: '#/components/responses/invalid_request_error' - '500': - $ref: '#/components/responses/500_error' /shipping-options: get: operationId: GetShippingOptions @@ -4251,6 +4183,74 @@ paths: $ref: '#/components/responses/invalid_request_error' '500': $ref: '#/components/responses/500_error' + /returns: + post: + operationId: PostReturns + summary: Create Return + description: Creates a Return for an Order. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StorePostReturnsReq' + x-codeSamples: + - lang: JavaScript + label: JS Client + source: > + import Medusa from "@medusajs/medusa-js" + + const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: + 3 }) + + medusa.returns.create({ + order_id, + items: [ + { + item_id, + quantity: 1 + } + ] + }) + + .then((data) => { + console.log(data.return.id); + }); + - lang: Shell + label: cURL + source: > + curl --location --request POST + 'https://medusa-url.com/store/returns' \ + + --header 'Content-Type: application/json' \ + + --data-raw '{ + "order_id": "asfasf", + "items": [ + { + "item_id": "assfasf", + "quantity": 1 + } + ] + }' + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/StoreReturnsRes' + '400': + $ref: '#/components/responses/400_error' + '404': + $ref: '#/components/responses/not_found_error' + '409': + $ref: '#/components/responses/invalid_state_error' + '422': + $ref: '#/components/responses/invalid_request_error' + '500': + $ref: '#/components/responses/500_error' /swaps: post: operationId: PostSwaps @@ -10580,6 +10580,27 @@ components: exists: type: boolean description: Whether email exists or not. + StoreCollectionsListRes: + type: object + properties: + collections: + type: array + items: + $ref: '#/components/schemas/ProductCollection' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + StoreCollectionsRes: + type: object + properties: + collection: + $ref: '#/components/schemas/ProductCollection' StorePostCartReq: type: object properties: @@ -10602,6 +10623,7 @@ components: Items from. type: array items: + type: object required: - variant_id - quantity @@ -10695,6 +10717,7 @@ components: description: An array of Gift Card codes to add to the Cart. type: array items: + type: object required: - code properties: @@ -10705,6 +10728,7 @@ components: description: An array of Discount codes to add to the Cart. type: array items: + type: object required: - code properties: @@ -10720,27 +10744,6 @@ components: example: ip: '::1' user_agent: Chrome - StoreCollectionsListRes: - type: object - properties: - collections: - type: array - items: - $ref: '#/components/schemas/ProductCollection' - count: - type: integer - description: The total number of items available - offset: - type: integer - description: The number of items skipped before these items - limit: - type: integer - description: The number of items per page - StoreCollectionsRes: - type: object - properties: - collection: - $ref: '#/components/schemas/ProductCollection' StorePostCustomersCustomerAddressesReq: type: object required: @@ -10951,6 +10954,7 @@ components: be deleted and the provided ones will be created. type: array items: + type: object required: - provider_id - amount @@ -10972,11 +10976,6 @@ components: provider_id: type: string description: The ID of the Payment Provider. - StoreGetProductCategoryRes: - type: object - properties: - product_category: - $ref: '#/components/schemas/ProductCategory' StoreProductTypesListRes: type: object properties: @@ -10993,6 +10992,11 @@ components: limit: type: integer description: The number of items per page + StoreGetProductCategoryRes: + type: object + properties: + product_category: + $ref: '#/components/schemas/ProductCategory' StoreProductsRes: type: object properties: @@ -11046,6 +11050,13 @@ components: properties: return_reason: $ref: '#/components/schemas/ReturnReason' + StoreShippingOptionsListRes: + type: object + properties: + shipping_options: + type: array + items: + $ref: '#/components/schemas/ShippingOption' StorePostReturnsReq: type: object required: @@ -11059,6 +11070,7 @@ components: description: The items to include in the Return. type: array items: + type: object required: - item_id - quantity @@ -11094,13 +11106,6 @@ components: properties: return: $ref: '#/components/schemas/Return' - StoreShippingOptionsListRes: - type: object - properties: - shipping_options: - type: array - items: - $ref: '#/components/schemas/ShippingOption' StorePostSwapsReq: type: object required: @@ -11115,6 +11120,7 @@ components: description: The items to include in the Return. type: array items: + type: object required: - item_id - quantity @@ -11138,6 +11144,7 @@ components: description: The items to exchange the returned items to. type: array items: + type: object required: - variant_id - quantity diff --git a/docs/api/store/components/schemas/StorePostCartReq.yaml b/docs/api/store/components/schemas/StorePostCartReq.yaml index e403744a2bf12..836a28a8b9dc5 100644 --- a/docs/api/store/components/schemas/StorePostCartReq.yaml +++ b/docs/api/store/components/schemas/StorePostCartReq.yaml @@ -19,6 +19,7 @@ properties: from. type: array items: + type: object required: - variant_id - quantity diff --git a/docs/api/store/components/schemas/StorePostCartsCartReq.yaml b/docs/api/store/components/schemas/StorePostCartsCartReq.yaml index 1a3f876ecdc7a..86402c2bd1dee 100644 --- a/docs/api/store/components/schemas/StorePostCartsCartReq.yaml +++ b/docs/api/store/components/schemas/StorePostCartsCartReq.yaml @@ -35,6 +35,7 @@ properties: description: An array of Gift Card codes to add to the Cart. type: array items: + type: object required: - code properties: @@ -45,6 +46,7 @@ properties: description: An array of Discount codes to add to the Cart. type: array items: + type: object required: - code properties: diff --git a/docs/api/store/components/schemas/StorePostPaymentCollectionsBatchSessionsReq.yaml b/docs/api/store/components/schemas/StorePostPaymentCollectionsBatchSessionsReq.yaml index b7db27a304bf3..38b13cf93cda6 100644 --- a/docs/api/store/components/schemas/StorePostPaymentCollectionsBatchSessionsReq.yaml +++ b/docs/api/store/components/schemas/StorePostPaymentCollectionsBatchSessionsReq.yaml @@ -9,6 +9,7 @@ properties: and the provided ones will be created. type: array items: + type: object required: - provider_id - amount diff --git a/docs/api/store/components/schemas/StorePostReturnsReq.yaml b/docs/api/store/components/schemas/StorePostReturnsReq.yaml index fe17ff69316bb..28a7393f5791a 100644 --- a/docs/api/store/components/schemas/StorePostReturnsReq.yaml +++ b/docs/api/store/components/schemas/StorePostReturnsReq.yaml @@ -10,6 +10,7 @@ properties: description: The items to include in the Return. type: array items: + type: object required: - item_id - quantity diff --git a/docs/api/store/components/schemas/StorePostSwapsReq.yaml b/docs/api/store/components/schemas/StorePostSwapsReq.yaml index 3a246b86e23c9..fd08d4a05a192 100644 --- a/docs/api/store/components/schemas/StorePostSwapsReq.yaml +++ b/docs/api/store/components/schemas/StorePostSwapsReq.yaml @@ -11,6 +11,7 @@ properties: description: The items to include in the Return. type: array items: + type: object required: - item_id - quantity @@ -34,6 +35,7 @@ properties: description: The items to exchange the returned items to. type: array items: + type: object required: - variant_id - quantity diff --git a/docs/api/store/openapi.yaml b/docs/api/store/openapi.yaml index 4a0067f12f752..4eb35e55aa122 100644 --- a/docs/api/store/openapi.yaml +++ b/docs/api/store/openapi.yaml @@ -137,6 +137,10 @@ paths: $ref: paths/auth.yaml /auth/{email}: $ref: paths/auth_{email}.yaml + /collections/{id}: + $ref: paths/collections_{id}.yaml + /collections: + $ref: paths/collections.yaml /carts/{id}/shipping-methods: $ref: paths/carts_{id}_shipping-methods.yaml /carts/{id}/taxes: @@ -159,10 +163,6 @@ paths: $ref: paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml /carts/{id}/payment-session: $ref: paths/carts_{id}_payment-session.yaml - /collections/{id}: - $ref: paths/collections_{id}.yaml - /collections: - $ref: paths/collections.yaml /customers/me/addresses: $ref: paths/customers_me_addresses.yaml /customers: @@ -187,6 +187,8 @@ paths: $ref: paths/order-edits_{id}_decline.yaml /order-edits/{id}: $ref: paths/order-edits_{id}.yaml + /product-tags: + $ref: paths/product-tags.yaml /orders/customer/confirm: $ref: paths/orders_customer_confirm.yaml /orders/cart/{cart_id}: @@ -209,14 +211,12 @@ paths: $ref: paths/payment-collections_{id}_sessions.yaml /payment-collections/{id}/sessions/{session_id}: $ref: paths/payment-collections_{id}_sessions_{session_id}.yaml + /product-types: + $ref: paths/product-types.yaml /product-categories/{id}: $ref: paths/product-categories_{id}.yaml /product-categories: $ref: paths/product-categories.yaml - /product-tags: - $ref: paths/product-tags.yaml - /product-types: - $ref: paths/product-types.yaml /products/{id}: $ref: paths/products_{id}.yaml /products: @@ -231,12 +231,12 @@ paths: $ref: paths/return-reasons_{id}.yaml /return-reasons: $ref: paths/return-reasons.yaml - /returns: - $ref: paths/returns.yaml /shipping-options: $ref: paths/shipping-options.yaml /shipping-options/{cart_id}: $ref: paths/shipping-options_{cart_id}.yaml + /returns: + $ref: paths/returns.yaml /swaps: $ref: paths/swaps.yaml /swaps/{cart_id}: