chore(docs): Generated API Reference (#2572)

Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
This commit is contained in:
github-actions[bot]andshahednasser authored and GitHub committed 2022-11-09 18:30:06 +02:00
1 parent 884322447e
commit 325b1e9017
63 files changed
+2962 -239

No files matched your search

+835 -63
View File
File diff suppressed because it is too large. Load diff
+835 -63
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
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);
});
@@ -0,0 +1,9 @@
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);
});
@@ -0,0 +1,9 @@
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.deleteConditionResourceBatch(discount_id, condition_id, {
resources: [{ id: item_id }]
})
.then(({ discount }) => {
console.log(discount.id);
});
@@ -0,0 +1,9 @@
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.addConditionResourceBatch(discount_id, condition_id, {
resources: [{ id: item_id }]
})
.then(({ discount }) => {
console.log(discount.id);
});
@@ -0,0 +1,7 @@
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.orderEdits.list()
.then(({ order_edits, count, limit, offset }) => {
console.log(order_edits.length)
})
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdit.create({ order_id, internal_note }) medusa.admin.orderEdits.create({ order_id })
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdits.delete(edit_id) medusa.admin.orderEdits.delete(order_edit_id)
.then(({ id, object, deleted }) => { .then(({ id, object, deleted }) => {
console.log(id) console.log(id)
}) })
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdit.retrieve(orderEditId) medusa.admin.orderEdits.retrieve(orderEditId)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,8 +1,9 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
const params = {internal_note: "internal reason XY"} medusa.admin.orderEdits.update(order_edit_id, {
medusa.admin.orderEdit.update(orderEditId, params) internal_note: "internal reason XY"
})
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdit.cancel(orderEditId) medusa.admin.orderEdits.cancel(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdits.deleteItemChange(item_change_id, order_edit_id) medusa.admin.orderEdits.deleteItemChange(order_edit_id, item_change_id)
.then(({ id, object, deleted }) => { .then(({ id, object, deleted }) => {
console.log(id) console.log(id)
}) })
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdit.confirm(orderEditId) medusa.admin.orderEdits.confirm(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,7 +1,10 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdit.addLineItem(order_edit_id, { variant_id, quantity }) medusa.admin.orderEdits.addLineItem(order_edit_id, {
variant_id,
quantity
})
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,7 +1,9 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id) medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id, {
quantity: 5
})
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,7 +1,7 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token // must be previously logged in or use api token
medusa.admin.orderEdits.requestConfirmation(edit_id) medusa.admin.orderEdits.requestConfirmation(order_edit_id)
.then({ order_edit }) => { .then({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -9,6 +9,6 @@ medusa.admin.returns.receive(return_id, {
} }
] ]
}) })
.then(({ return }) => { .then((data) => {
console.log(return.id); console.log(data.return.id);
}); });
@@ -0,0 +1,7 @@
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.uploads.createProtected(file)
.then(({ uploads }) => {
console.log(uploads.length);
});
@@ -0,0 +1,2 @@
curl --location --request POST 'https://medusa-url.com/admin/currencies' \
--header 'Authorization: Bearer {api_token}'
@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/admin/currencies/{code}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"includes_tax": true
}'
@@ -0,0 +1,6 @@
curl --location --request DELETE '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" }]
}'
@@ -0,0 +1,6 @@
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" }]
}'
@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/admin/order-edits' \
--header 'Authorization: Bearer {api_token}'
@@ -1,3 +1,4 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits' \ curl --location --request POST 'https://medusa-url.com/admin/order-edits' \
--header 'Authorization: Bearer {api_token}' --header 'Authorization: Bearer {api_token}' \
-d '{ "order_id": "my_order_id", "internal_note": "my_optional_note" }' --header 'Content-Type: application/json' \
--data-raw '{ "order_id": "my_order_id", "internal_note": "my_optional_note" }'
@@ -1,5 +1,5 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}' \ curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}' \
--header 'Authorization: Bearer {api_token}' --header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
"internal_note": "internal reason XY" "internal_note": "internal reason XY"
@@ -1,2 +1,2 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/cancel' \ curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/cancel' \
--header 'Authorization: Bearer {api_token}' --header 'Authorization: Bearer {api_token}'
@@ -1,2 +1,2 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/confirm' \ curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/confirm' \
--header 'Authorization: Bearer {api_token}' --header 'Authorization: Bearer {api_token}'
@@ -1,3 +1,4 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items' \ curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items' \
--header 'Authorization: Bearer {api_token}' --header 'Authorization: Bearer {api_token}' \
-d '{ "variant_id": "some_variant_id", "quantity": 3 }' --header 'Content-Type: application/json' \
--data-raw '{ "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6", "quantity": 3 }'
@@ -1,3 +1,4 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \ curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
--header 'Authorization: Bearer {api_token}' --header 'Authorization: Bearer {api_token}' \
-d '{ "quantity": 5 }' --header 'Content-Type: application/json' \
--data-raw '{ "quantity": 5 }'
@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/admin/uploads/protected' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: image/jpeg' \
--form 'files=@"<FILE_PATH_1>"' \
--form 'files=@"<FILE_PATH_1>"'
@@ -16,11 +16,11 @@ properties:
description: The ID of the order that is edited description: The ID of the order that is edited
example: order_01G2SG30J8C85S4A5CHM2S1NS2 example: order_01G2SG30J8C85S4A5CHM2S1NS2
order: order:
description: Order object description: Available if the relation `order` is expanded.
$ref: ./order.yaml $ref: ./order.yaml
changes: changes:
type: array type: array
description: Line item changes array. description: Available if the relation `changes` is expanded.
items: items:
$ref: ./order_item_change.yaml $ref: ./order_item_change.yaml
internal_note: internal_note:
@@ -92,8 +92,32 @@ properties:
The difference between the total amount of the order and total amount of The difference between the total amount of the order and total amount of
edited order. edited order.
example: 8200 example: 8200
status:
type: string
description: The status of the order edit.
enum:
- confirmed
- declined
- requested
- created
- canceled
items: items:
type: array type: array
description: Computed line items from the changes. description: Available if the relation `items` is expanded.
items: items:
$ref: ./line_item.yaml $ref: ./line_item.yaml
payment_collection_id:
type: string
description: The ID of the payment collection
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
payment_collection:
description: Available if the relation `payment_collection` is expanded.
$ref: ./payment_collection.yaml
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
@@ -11,7 +11,7 @@ properties:
example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
type: type:
type: string type: string
description: The order's status description: The order item change's status
enum: enum:
- item_add - item_add
- item_remove - item_remove
@@ -21,19 +21,36 @@ properties:
description: The ID of the order edit description: The ID of the order edit
example: oe_01G2SG30J8C85S4A5CHM2S1NS2 example: oe_01G2SG30J8C85S4A5CHM2S1NS2
order_edit: order_edit:
description: Order edit object description: Available if the relation `order_edit` is expanded.
$ref: ./order_edit.yaml $ref: ./order_edit.yaml
original_line_item_id: original_line_item_id:
type: string type: string
description: The ID of the original line item in the order description: The ID of the original line item in the order
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
original_line_item: original_line_item:
description: Original line item object. description: Available if the relation `original_line_item` is expanded.
$ref: ./line_item.yaml $ref: ./line_item.yaml
line_item_id: line_item_id:
type: string type: string
description: The ID of the cloned line item. description: The ID of the cloned line item.
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
line_item: line_item:
description: Line item object. description: Available if the relation `line_item` is expanded.
$ref: ./line_item.yaml $ref: ./line_item.yaml
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
@@ -0,0 +1,96 @@
title: Payment Collection
description: Payment Collection
x-resourceId: payment_collection
required:
- type
- status
- amount
- region_id
- currency_code
- created_by
properties:
id:
type: string
description: The payment collection's ID
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
type: string
description: The type of the payment collection
enum:
- order_edit
status:
type: string
description: The type of the payment collection
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- captured
- partially_captured
- refunded
- partially_refunded
- canceled
- requires_action
description:
type: string
description: Description of the payment collection
amount:
type: number
description: Amount of the payment collection.
authorized_amount:
type: number
description: Authorized amount of the payment collection.
captured_amount:
type: number
description: Captured amount of the payment collection.
refunded_amount:
type: number
description: Refunded amount of the payment collection.
region_id:
type: string
description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: Available if the relation `region` is expanded.
$ref: ./region.yaml
currency_code:
description: The 3 character ISO code for the currency.
type: string
example: usd
externalDocs:
url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
$ref: ./currency.yaml
payment_sessions:
type: array
description: Available if the relation `payment_sessions` is expanded.
items:
$ref: ./payment_session.yaml
payments:
type: array
description: Available if the relation `payments` is expanded.
items:
$ref: ./payment.yaml
created_by:
type: string
description: The ID of the user that created the payment collection.
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
@@ -12,7 +12,7 @@ required:
properties: properties:
id: id:
type: string type: string
description: The cart's ID description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
name: name:
description: >- description: >-
+4
View File
@@ -240,6 +240,8 @@ paths:
$ref: paths/customers_{id}.yaml $ref: paths/customers_{id}.yaml
/discounts/{id}/regions/{region_id}: /discounts/{id}/regions/{region_id}:
$ref: paths/discounts_{id}_regions_{region_id}.yaml $ref: paths/discounts_{id}_regions_{region_id}.yaml
/discounts/{discount_id}/conditions/{condition_id}/batch:
$ref: paths/discounts_{discount_id}_conditions_{condition_id}_batch.yaml
/discounts/{discount_id}/conditions: /discounts/{discount_id}/conditions:
$ref: paths/discounts_{discount_id}_conditions.yaml $ref: paths/discounts_{discount_id}_conditions.yaml
/discounts: /discounts:
@@ -450,6 +452,8 @@ paths:
$ref: paths/tax-rates.yaml $ref: paths/tax-rates.yaml
/tax-rates/{id}: /tax-rates/{id}:
$ref: paths/tax-rates_{id}.yaml $ref: paths/tax-rates_{id}.yaml
/uploads/protected:
$ref: paths/uploads_protected.yaml
/uploads: /uploads:
$ref: paths/uploads.yaml $ref: paths/uploads.yaml
/users: /users:
@@ -31,10 +31,14 @@ post:
format: email format: email
billing_address: billing_address:
description: The Address to be used for billing purposes. description: The Address to be used for billing purposes.
$ref: ../components/schemas/address_fields.yaml anyOf:
- $ref: ../components/schemas/address_fields.yaml
- type: string
shipping_address: shipping_address:
description: The Address to be used for shipping. description: The Address to be used for shipping.
$ref: ../components/schemas/address_fields.yaml anyOf:
- $ref: ../components/schemas/address_fields.yaml
- type: string
discounts: discounts:
description: An array of Discount codes to add to the Draft Order. description: An array of Discount codes to add to the Draft Order.
type: array type: array
+5
View File
@@ -91,6 +91,11 @@ get:
description: a search term to search titles and handles. description: a search term to search titles and handles.
schema: schema:
type: string type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the product collections.
schema:
type: string
- in: query - in: query
name: created_at name: created_at
description: Date comparison for when resulting collections were created. description: Date comparison for when resulting collections were created.
+23 -12
View File
@@ -16,19 +16,30 @@ get:
type: boolean type: boolean
- in: query - in: query
name: order name: order
description: to retrieve products in. description: order to retrieve products in.
schema: schema:
type: string type: string
- in: query - in: query
name: offset name: offset
description: How many products to skip in the result. description: How many products to skip in the result.
schema: schema:
type: string type: number
default: '0'
- in: query - in: query
name: limit name: limit
description: Limit the number of products returned. description: Limit the number of products returned.
schema: schema:
type: string type: number
default: '20'
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: ../code_samples/JavaScript/currencies/getundefined
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/currencies/getundefined
tags: tags:
- Currency - Currency
responses: responses:
@@ -38,16 +49,16 @@ get:
application/json: application/json:
schema: schema:
properties: properties:
count:
description: The number of Currency.
type: integer
offset:
description: The offset of the Currency query.
type: integer
limit:
description: The limit of the currency query.
type: integer
currencies: currencies:
type: array type: array
items: items:
$ref: ../components/schemas/currency.yaml $ref: ../components/schemas/currency.yaml
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
@@ -18,6 +18,15 @@ post:
includes_tax: includes_tax:
type: boolean type: boolean
description: '[EXPERIMENTAL] Tax included in prices of currency.' description: '[EXPERIMENTAL] Tax included in prices of currency.'
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: ../code_samples/JavaScript/currencies_{code}/postundefined
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/currencies_{code}/postundefined
tags: tags:
- Currency - Currency
responses: responses:
@@ -75,6 +75,11 @@ get:
description: the field used to order the customer groups. description: the field used to order the customer groups.
schema: schema:
type: string 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 - in: query
name: id name: id
style: form style: form
@@ -0,0 +1,172 @@
post:
operationId: PostDiscountsDiscountConditionsConditionBatch
summary: Add a batch of resources to a discount condition
description: Add a batch of resources to a discount condition.
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:
required:
- resources
properties:
resources:
description: The resources to be added to the discount condition
type: array
items:
required:
- id
properties:
id:
description: The id of the item
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: >-
../code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}_batch/postundefined
- lang: Shell
label: cURL
source:
$ref: >-
../code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}_batch/postundefined
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
discount:
$ref: ../components/schemas/discount.yaml
'400':
$ref: ../components/responses/400_error.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
delete:
operationId: DeleteDiscountsDiscountConditionsConditionBatch
summary: Delete a batch of resources from a discount condition
description: Delete a batch of resources from a discount condition.
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:
required:
- resources
properties:
resources:
description: The resources to be deleted from the discount condition
type: array
items:
required:
- id
properties:
id:
description: The id of the item
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: >-
../code_samples/JavaScript/discounts_{discount_id}_conditions_{condition_id}_batch/deleteundefined
- lang: Shell
label: cURL
source:
$ref: >-
../code_samples/Shell/discounts_{discount_id}_conditions_{condition_id}_batch/deleteundefined
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
discount:
$ref: ../components/schemas/discount.yaml
'400':
$ref: ../components/responses/400_error.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
+6 -2
View File
@@ -25,10 +25,14 @@ post:
format: email format: email
billing_address: billing_address:
description: The Address to be used for billing purposes. description: The Address to be used for billing purposes.
$ref: ../components/schemas/address_fields.yaml anyOf:
- $ref: ../components/schemas/address_fields.yaml
- type: string
shipping_address: shipping_address:
description: The Address to be used for shipping. description: The Address to be used for shipping.
$ref: ../components/schemas/address_fields.yaml anyOf:
- $ref: ../components/schemas/address_fields.yaml
- type: string
items: items:
description: The Line Items that have been received. description: The Line Items that have been received.
type: array type: array
+96
View File
@@ -2,6 +2,19 @@ post:
operationId: PostOrderEdits operationId: PostOrderEdits
summary: Create an OrderEdit summary: Create an OrderEdit
description: Creates an OrderEdit. description: Creates an OrderEdit.
requestBody:
content:
application/json:
schema:
required:
- order_id
properties:
order_id:
description: The ID of the order to create the edit for.
type: string
internal_note:
description: An optional note to create for the order edit.
type: string
x-authenticated: true x-authenticated: true
x-codeSamples: x-codeSamples:
- lang: JavaScript - lang: JavaScript
@@ -38,3 +51,86 @@ post:
$ref: ../components/responses/invalid_request_error.yaml $ref: ../components/responses/invalid_request_error.yaml
'500': '500':
$ref: ../components/responses/500_error.yaml $ref: ../components/responses/500_error.yaml
get:
operationId: GetOrderEdits
summary: List an OrderEdit
description: List a OrderEdit.
x-authenticated: true
parameters:
- in: query
name: q
description: Query used for searching order edit internal note.
schema:
type: string
- in: query
name: order_id
description: List order edits by order id.
schema:
type: string
- 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
- 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:
$ref: ../code_samples/JavaScript/order-edits/getundefined
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/order-edits/getundefined
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
order_edits:
type: array
$ref: ../components/schemas/order_edit.yaml
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.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
@@ -56,6 +56,16 @@ get:
description: The ID of the OrderEdit. description: The ID of the OrderEdit.
schema: schema:
type: string 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: x-codeSamples:
- lang: JavaScript - lang: JavaScript
label: JS Client label: JS Client
@@ -103,6 +113,14 @@ post:
description: The ID of the OrderEdit. description: The ID of the OrderEdit.
schema: schema:
type: string type: string
requestBody:
content:
application/json:
schema:
properties:
internal_note:
description: An optional note to create or update for the order edit.
type: string
x-codeSamples: x-codeSamples:
- lang: JavaScript - lang: JavaScript
label: JS Client label: JS Client
@@ -9,6 +9,25 @@ post:
description: The ID of the Order Edit. description: The ID of the Order Edit.
schema: schema:
type: string type: string
requestBody:
content:
application/json:
schema:
required:
- variant_id
- quantity
properties:
variant_id:
description: The ID of the variant ID to add
type: string
quantity:
description: The quantity to add
type: number
metadata:
description: >-
An optional set of key-value pairs to hold additional
information.
type: object
x-authenticated: true x-authenticated: true
x-codeSamples: x-codeSamples:
- lang: JavaScript - lang: JavaScript
@@ -70,6 +70,16 @@ post:
description: The ID of the order edit item to update. description: The ID of the order edit item to update.
schema: schema:
type: string type: string
requestBody:
content:
application/json:
schema:
required:
- quantity
properties:
quantity:
description: The quantity to update
type: number
x-codeSamples: x-codeSamples:
- lang: JavaScript - lang: JavaScript
label: JS Client label: JS Client
+5
View File
@@ -21,6 +21,11 @@ get:
description: The field to sort items by. description: The field to sort items by.
schema: schema:
type: string type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the tags.
schema:
type: string
- in: query - in: query
name: value name: value
style: form style: form
+5
View File
@@ -21,6 +21,11 @@ get:
description: The field to sort items by. description: The field to sort items by.
schema: schema:
type: string type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the product types.
schema:
type: string
- in: query - in: query
name: value name: value
style: form style: form
+14 -5
View File
@@ -289,6 +289,11 @@ get:
and sku, and collection title. and sku, and collection title.
schema: schema:
type: string type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the product.
schema:
type: string
- in: query - in: query
name: id name: id
style: form style: form
@@ -352,6 +357,15 @@ get:
type: array type: array
items: items:
type: string type: string
- in: query
name: type_id
style: form
explode: false
description: Type IDs to filter products by
schema:
type: array
items:
type: string
- in: query - in: query
name: title name: title
description: title to search for. description: title to search for.
@@ -372,11 +386,6 @@ get:
description: Search for giftcards using is_giftcard=true. description: Search for giftcards using is_giftcard=true.
schema: schema:
type: boolean type: boolean
- in: query
name: type
description: type ID to search for.
schema:
type: string
- in: query - in: query
name: created_at name: created_at
description: Date comparison for when resulting products were created. description: Date comparison for when resulting products were created.
@@ -0,0 +1,58 @@
post:
operationId: PostUploadsProtected
summary: Upload files with acl or in a non-public bucket
description: >-
Uploads at least one file to the specific fileservice that is installed in
Medusa.
x-authenticated: true
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
files:
type: string
format: binary
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: ../code_samples/JavaScript/uploads_protected/postundefined
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/uploads_protected/postundefined
security:
- api_token: []
- cookie_auth: []
tags:
- Upload
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
uploads:
type: array
items:
type: object
properties:
url:
type: string
description: The URL of the uploaded file.
format: uri
'400':
$ref: ../components/responses/400_error.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
+80 -8
View File
@@ -5,22 +5,94 @@ get:
x-authenticated: true x-authenticated: true
parameters: parameters:
- in: query - in: query
name: q name: id
description: Query used for searching variants. description: A Product Variant id to filter by.
schema:
type: string
- in: query
name: ids
description: A comma separated list of Product Variant ids to filter by.
schema:
type: string
- in: query
name: expand
description: A comma separated list of Product Variant relations to load.
schema:
type: string
- in: query
name: fields
description: A comma separated list of Product Variant fields to include.
schema: schema:
type: string type: string
- in: query - in: query
name: offset name: offset
description: How many variants to skip in the result. description: How many product variants to skip in the result.
schema: schema:
type: integer type: number
default: 0 default: '0'
- in: query - in: query
name: limit name: limit
description: Limit the number of variants returned. description: Maximum number of Product Variants to return.
schema: schema:
type: integer type: number
default: 20 default: '100'
- in: query
name: cart_id
description: The id of the cart to use for price selection.
schema:
type: string
- in: query
name: region_id
description: The id of the region to use for price selection.
schema:
type: string
- in: query
name: currency_code
description: The currency code to use for price selection.
schema:
type: string
- in: query
name: customer_id
description: The id of the customer to use for price selection.
schema:
type: string
- in: query
name: title
style: form
explode: false
description: product variant title to search for.
schema:
oneOf:
- type: string
description: a single title to search by
- type: array
description: multiple titles to search by
items:
type: string
- in: query
name: inventory_quantity
description: Filter by available inventory quantity
schema:
oneOf:
- type: number
description: a specific number to search by.
- type: object
description: search using less and greater than comparisons.
properties:
lt:
type: number
description: filter by inventory quantity less than this number
gt:
type: number
description: filter by inventory quantity greater than this number
lte:
type: number
description: filter by inventory quantity less than or equal to this number
gte:
type: number
description: >-
filter by inventory quantity greater than or equal to this
number
x-codeSamples: x-codeSamples:
- lang: JavaScript - lang: JavaScript
label: JS Client label: JS Client
+169 -18
View File
@@ -2617,7 +2617,7 @@ paths:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 }) 3 })
medusa.orderEdit.complete(orderEditId) medusa.orderEdits.complete(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -2674,7 +2674,7 @@ paths:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 }) 3 })
medusa.orderEdit.decline(orderEditId) medusa.orderEdits.decline(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id); console.log(order_edit.id);
}) })
@@ -2723,7 +2723,7 @@ paths:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 }) 3 })
medusa.orderEdit.retrieve(orderEditId) medusa.orderEdits.retrieve(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id); console.log(order_edit.id);
@@ -3047,6 +3047,15 @@ paths:
- type: array - type: array
items: items:
type: string type: string
- in: query
name: sales_channel_id
style: form
explode: false
description: an array of sales channel IDs to filter the retrieved products by.
schema:
type: array
items:
type: string
- in: query - in: query
name: collection_id name: collection_id
style: form style: form
@@ -3056,6 +3065,15 @@ paths:
type: array type: array
items: items:
type: string type: string
- in: query
name: type_id
style: form
explode: false
description: Type IDs to search for
schema:
type: array
items:
type: string
- in: query - in: query
name: tags name: tags
style: form style: form
@@ -3085,11 +3103,6 @@ paths:
description: Search for giftcards using is_giftcard=true. description: Search for giftcards using is_giftcard=true.
schema: schema:
type: boolean type: boolean
- in: query
name: type
description: type to search for.
schema:
type: string
- in: query - in: query
name: created_at name: created_at
description: Date comparison for when resulting products were created. description: Date comparison for when resulting products were created.
@@ -3613,8 +3626,8 @@ paths:
] ]
}) })
.then(({ return }) => { .then((data) => {
console.log(return.id); console.log(data.return.id);
}); });
- lang: Shell - lang: Shell
label: cURL label: cURL
@@ -6871,11 +6884,11 @@ components:
description: The ID of the order that is edited description: The ID of the order that is edited
example: order_01G2SG30J8C85S4A5CHM2S1NS2 example: order_01G2SG30J8C85S4A5CHM2S1NS2
order: order:
description: Order object description: Available if the relation `order` is expanded.
$ref: '#/components/schemas/order' $ref: '#/components/schemas/order'
changes: changes:
type: array type: array
description: Line item changes array. description: Available if the relation `changes` is expanded.
items: items:
$ref: '#/components/schemas/order_item_change' $ref: '#/components/schemas/order_item_change'
internal_note: internal_note:
@@ -6951,11 +6964,35 @@ components:
The difference between the total amount of the order and total The difference between the total amount of the order and total
amount of edited order. amount of edited order.
example: 8200 example: 8200
status:
type: string
description: The status of the order edit.
enum:
- confirmed
- declined
- requested
- created
- canceled
items: items:
type: array type: array
description: Computed line items from the changes. description: Available if the relation `items` is expanded.
items: items:
$ref: '#/components/schemas/line_item' $ref: '#/components/schemas/line_item'
payment_collection_id:
type: string
description: The ID of the payment collection
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
payment_collection:
description: Available if the relation `payment_collection` is expanded.
$ref: '#/components/schemas/payment_collection'
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
order_item_change: order_item_change:
title: Order Item Change title: Order Item Change
description: Represents an order edit item change description: Represents an order edit item change
@@ -6970,7 +7007,7 @@ components:
example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
type: type:
type: string type: string
description: The order's status description: The order item change's status
enum: enum:
- item_add - item_add
- item_remove - item_remove
@@ -6980,22 +7017,39 @@ components:
description: The ID of the order edit description: The ID of the order edit
example: oe_01G2SG30J8C85S4A5CHM2S1NS2 example: oe_01G2SG30J8C85S4A5CHM2S1NS2
order_edit: order_edit:
description: Order edit object description: Available if the relation `order_edit` is expanded.
$ref: '#/components/schemas/order_edit' $ref: '#/components/schemas/order_edit'
original_line_item_id: original_line_item_id:
type: string type: string
description: The ID of the original line item in the order description: The ID of the original line item in the order
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
original_line_item: original_line_item:
description: Original line item object. description: Available if the relation `original_line_item` is expanded.
$ref: '#/components/schemas/line_item' $ref: '#/components/schemas/line_item'
line_item_id: line_item_id:
type: string type: string
description: The ID of the cloned line item. description: The ID of the cloned line item.
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
line_item: line_item:
description: Line item object. description: Available if the relation `line_item` is expanded.
$ref: '#/components/schemas/line_item' $ref: '#/components/schemas/line_item'
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
order: order:
title: Order title: Order
description: Represents an order description: Represents an order
@@ -7274,6 +7328,103 @@ components:
type: integer type: integer
description: The total of gift cards with taxes description: The total of gift cards with taxes
example: 0 example: 0
payment_collection:
title: Payment Collection
description: Payment Collection
x-resourceId: payment_collection
required:
- type
- status
- amount
- region_id
- currency_code
- created_by
properties:
id:
type: string
description: The payment collection's ID
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
type: string
description: The type of the payment collection
enum:
- order_edit
status:
type: string
description: The type of the payment collection
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- captured
- partially_captured
- refunded
- partially_refunded
- canceled
- requires_action
description:
type: string
description: Description of the payment collection
amount:
type: number
description: Amount of the payment collection.
authorized_amount:
type: number
description: Authorized amount of the payment collection.
captured_amount:
type: number
description: Captured amount of the payment collection.
refunded_amount:
type: number
description: Refunded amount of the payment collection.
region_id:
type: string
description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: Available if the relation `region` is expanded.
$ref: '#/components/schemas/region'
currency_code:
description: The 3 character ISO code for the currency.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
$ref: '#/components/schemas/currency'
payment_sessions:
type: array
description: Available if the relation `payment_sessions` is expanded.
items:
$ref: '#/components/schemas/payment_session'
payments:
type: array
description: Available if the relation `payments` is expanded.
items:
$ref: '#/components/schemas/payment'
created_by:
type: string
description: The ID of the user that created the payment collection.
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
payment_provider: payment_provider:
title: Payment Provider title: Payment Provider
description: Represents a Payment Provider plugin and holds its installation status. description: Represents a Payment Provider plugin and holds its installation status.
@@ -8312,7 +8463,7 @@ components:
properties: properties:
id: id:
type: string type: string
description: The cart's ID description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
name: name:
description: >- description: >-
+169 -18
View File
@@ -2617,7 +2617,7 @@ paths:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 }) 3 })
medusa.orderEdit.complete(orderEditId) medusa.orderEdits.complete(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -2674,7 +2674,7 @@ paths:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 }) 3 })
medusa.orderEdit.decline(orderEditId) medusa.orderEdits.decline(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id); console.log(order_edit.id);
}) })
@@ -2723,7 +2723,7 @@ paths:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 }) 3 })
medusa.orderEdit.retrieve(orderEditId) medusa.orderEdits.retrieve(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id); console.log(order_edit.id);
@@ -3047,6 +3047,15 @@ paths:
- type: array - type: array
items: items:
type: string type: string
- in: query
name: sales_channel_id
style: form
explode: false
description: an array of sales channel IDs to filter the retrieved products by.
schema:
type: array
items:
type: string
- in: query - in: query
name: collection_id name: collection_id
style: form style: form
@@ -3056,6 +3065,15 @@ paths:
type: array type: array
items: items:
type: string type: string
- in: query
name: type_id
style: form
explode: false
description: Type IDs to search for
schema:
type: array
items:
type: string
- in: query - in: query
name: tags name: tags
style: form style: form
@@ -3085,11 +3103,6 @@ paths:
description: Search for giftcards using is_giftcard=true. description: Search for giftcards using is_giftcard=true.
schema: schema:
type: boolean type: boolean
- in: query
name: type
description: type to search for.
schema:
type: string
- in: query - in: query
name: created_at name: created_at
description: Date comparison for when resulting products were created. description: Date comparison for when resulting products were created.
@@ -3613,8 +3626,8 @@ paths:
] ]
}) })
.then(({ return }) => { .then((data) => {
console.log(return.id); console.log(data.return.id);
}); });
- lang: Shell - lang: Shell
label: cURL label: cURL
@@ -6871,11 +6884,11 @@ components:
description: The ID of the order that is edited description: The ID of the order that is edited
example: order_01G2SG30J8C85S4A5CHM2S1NS2 example: order_01G2SG30J8C85S4A5CHM2S1NS2
order: order:
description: Order object description: Available if the relation `order` is expanded.
$ref: '#/components/schemas/order' $ref: '#/components/schemas/order'
changes: changes:
type: array type: array
description: Line item changes array. description: Available if the relation `changes` is expanded.
items: items:
$ref: '#/components/schemas/order_item_change' $ref: '#/components/schemas/order_item_change'
internal_note: internal_note:
@@ -6951,11 +6964,35 @@ components:
The difference between the total amount of the order and total The difference between the total amount of the order and total
amount of edited order. amount of edited order.
example: 8200 example: 8200
status:
type: string
description: The status of the order edit.
enum:
- confirmed
- declined
- requested
- created
- canceled
items: items:
type: array type: array
description: Computed line items from the changes. description: Available if the relation `items` is expanded.
items: items:
$ref: '#/components/schemas/line_item' $ref: '#/components/schemas/line_item'
payment_collection_id:
type: string
description: The ID of the payment collection
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
payment_collection:
description: Available if the relation `payment_collection` is expanded.
$ref: '#/components/schemas/payment_collection'
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
order_item_change: order_item_change:
title: Order Item Change title: Order Item Change
description: Represents an order edit item change description: Represents an order edit item change
@@ -6970,7 +7007,7 @@ components:
example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
type: type:
type: string type: string
description: The order's status description: The order item change's status
enum: enum:
- item_add - item_add
- item_remove - item_remove
@@ -6980,22 +7017,39 @@ components:
description: The ID of the order edit description: The ID of the order edit
example: oe_01G2SG30J8C85S4A5CHM2S1NS2 example: oe_01G2SG30J8C85S4A5CHM2S1NS2
order_edit: order_edit:
description: Order edit object description: Available if the relation `order_edit` is expanded.
$ref: '#/components/schemas/order_edit' $ref: '#/components/schemas/order_edit'
original_line_item_id: original_line_item_id:
type: string type: string
description: The ID of the original line item in the order description: The ID of the original line item in the order
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
original_line_item: original_line_item:
description: Original line item object. description: Available if the relation `original_line_item` is expanded.
$ref: '#/components/schemas/line_item' $ref: '#/components/schemas/line_item'
line_item_id: line_item_id:
type: string type: string
description: The ID of the cloned line item. description: The ID of the cloned line item.
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
line_item: line_item:
description: Line item object. description: Available if the relation `line_item` is expanded.
$ref: '#/components/schemas/line_item' $ref: '#/components/schemas/line_item'
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
order: order:
title: Order title: Order
description: Represents an order description: Represents an order
@@ -7274,6 +7328,103 @@ components:
type: integer type: integer
description: The total of gift cards with taxes description: The total of gift cards with taxes
example: 0 example: 0
payment_collection:
title: Payment Collection
description: Payment Collection
x-resourceId: payment_collection
required:
- type
- status
- amount
- region_id
- currency_code
- created_by
properties:
id:
type: string
description: The payment collection's ID
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
type: string
description: The type of the payment collection
enum:
- order_edit
status:
type: string
description: The type of the payment collection
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- captured
- partially_captured
- refunded
- partially_refunded
- canceled
- requires_action
description:
type: string
description: Description of the payment collection
amount:
type: number
description: Amount of the payment collection.
authorized_amount:
type: number
description: Authorized amount of the payment collection.
captured_amount:
type: number
description: Captured amount of the payment collection.
refunded_amount:
type: number
description: Refunded amount of the payment collection.
region_id:
type: string
description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: Available if the relation `region` is expanded.
$ref: '#/components/schemas/region'
currency_code:
description: The 3 character ISO code for the currency.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
$ref: '#/components/schemas/currency'
payment_sessions:
type: array
description: Available if the relation `payment_sessions` is expanded.
items:
$ref: '#/components/schemas/payment_session'
payments:
type: array
description: Available if the relation `payments` is expanded.
items:
$ref: '#/components/schemas/payment'
created_by:
type: string
description: The ID of the user that created the payment collection.
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
payment_provider: payment_provider:
title: Payment Provider title: Payment Provider
description: Represents a Payment Provider plugin and holds its installation status. description: Represents a Payment Provider plugin and holds its installation status.
@@ -8312,7 +8463,7 @@ components:
properties: properties:
id: id:
type: string type: string
description: The cart's ID description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
name: name:
description: >- description: >-
@@ -1,6 +1,6 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orderEdit.retrieve(orderEditId) medusa.orderEdits.retrieve(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id); console.log(order_edit.id);
}); });
@@ -1,6 +1,6 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orderEdit.complete(orderEditId) medusa.orderEdits.complete(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id) console.log(order_edit.id)
}) })
@@ -1,6 +1,6 @@
import Medusa from "@medusajs/medusa-js" import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orderEdit.decline(orderEditId) medusa.orderEdits.decline(order_edit_id)
.then(({ order_edit }) => { .then(({ order_edit }) => {
console.log(order_edit.id); console.log(order_edit.id);
}) })
@@ -9,6 +9,6 @@ medusa.returns.create({
} }
] ]
}) })
.then(({ return }) => { .then((data) => {
console.log(return.id); console.log(data.return.id);
}); });
@@ -16,11 +16,11 @@ properties:
description: The ID of the order that is edited description: The ID of the order that is edited
example: order_01G2SG30J8C85S4A5CHM2S1NS2 example: order_01G2SG30J8C85S4A5CHM2S1NS2
order: order:
description: Order object description: Available if the relation `order` is expanded.
$ref: ./order.yaml $ref: ./order.yaml
changes: changes:
type: array type: array
description: Line item changes array. description: Available if the relation `changes` is expanded.
items: items:
$ref: ./order_item_change.yaml $ref: ./order_item_change.yaml
internal_note: internal_note:
@@ -92,8 +92,32 @@ properties:
The difference between the total amount of the order and total amount of The difference between the total amount of the order and total amount of
edited order. edited order.
example: 8200 example: 8200
status:
type: string
description: The status of the order edit.
enum:
- confirmed
- declined
- requested
- created
- canceled
items: items:
type: array type: array
description: Computed line items from the changes. description: Available if the relation `items` is expanded.
items: items:
$ref: ./line_item.yaml $ref: ./line_item.yaml
payment_collection_id:
type: string
description: The ID of the payment collection
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
payment_collection:
description: Available if the relation `payment_collection` is expanded.
$ref: ./payment_collection.yaml
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
@@ -11,7 +11,7 @@ properties:
example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
type: type:
type: string type: string
description: The order's status description: The order item change's status
enum: enum:
- item_add - item_add
- item_remove - item_remove
@@ -21,19 +21,36 @@ properties:
description: The ID of the order edit description: The ID of the order edit
example: oe_01G2SG30J8C85S4A5CHM2S1NS2 example: oe_01G2SG30J8C85S4A5CHM2S1NS2
order_edit: order_edit:
description: Order edit object description: Available if the relation `order_edit` is expanded.
$ref: ./order_edit.yaml $ref: ./order_edit.yaml
original_line_item_id: original_line_item_id:
type: string type: string
description: The ID of the original line item in the order description: The ID of the original line item in the order
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
original_line_item: original_line_item:
description: Original line item object. description: Available if the relation `original_line_item` is expanded.
$ref: ./line_item.yaml $ref: ./line_item.yaml
line_item_id: line_item_id:
type: string type: string
description: The ID of the cloned line item. description: The ID of the cloned line item.
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
line_item: line_item:
description: Line item object. description: Available if the relation `line_item` is expanded.
$ref: ./line_item.yaml $ref: ./line_item.yaml
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
@@ -0,0 +1,96 @@
title: Payment Collection
description: Payment Collection
x-resourceId: payment_collection
required:
- type
- status
- amount
- region_id
- currency_code
- created_by
properties:
id:
type: string
description: The payment collection's ID
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
type: string
description: The type of the payment collection
enum:
- order_edit
status:
type: string
description: The type of the payment collection
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- captured
- partially_captured
- refunded
- partially_refunded
- canceled
- requires_action
description:
type: string
description: Description of the payment collection
amount:
type: number
description: Amount of the payment collection.
authorized_amount:
type: number
description: Authorized amount of the payment collection.
captured_amount:
type: number
description: Captured amount of the payment collection.
refunded_amount:
type: number
description: Refunded amount of the payment collection.
region_id:
type: string
description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: Available if the relation `region` is expanded.
$ref: ./region.yaml
currency_code:
description: The 3 character ISO code for the currency.
type: string
example: usd
externalDocs:
url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
$ref: ./currency.yaml
payment_sessions:
type: array
description: Available if the relation `payment_sessions` is expanded.
items:
$ref: ./payment_session.yaml
payments:
type: array
description: Available if the relation `payments` is expanded.
items:
$ref: ./payment.yaml
created_by:
type: string
description: The ID of the user that created the payment collection.
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
@@ -12,7 +12,7 @@ required:
properties: properties:
id: id:
type: string type: string
description: The cart's ID description: The region's ID
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
name: name:
description: >- description: >-
+18 -5
View File
@@ -21,6 +21,15 @@ get:
- type: array - type: array
items: items:
type: string type: string
- in: query
name: sales_channel_id
style: form
explode: false
description: an array of sales channel IDs to filter the retrieved products by.
schema:
type: array
items:
type: string
- in: query - in: query
name: collection_id name: collection_id
style: form style: form
@@ -30,6 +39,15 @@ get:
type: array type: array
items: items:
type: string type: string
- in: query
name: type_id
style: form
explode: false
description: Type IDs to search for
schema:
type: array
items:
type: string
- in: query - in: query
name: tags name: tags
style: form style: form
@@ -59,11 +77,6 @@ get:
description: Search for giftcards using is_giftcard=true. description: Search for giftcards using is_giftcard=true.
schema: schema:
type: boolean type: boolean
- in: query
name: type
description: type to search for.
schema:
type: string
- in: query - in: query
name: created_at name: created_at
description: Date comparison for when resulting products were created. description: Date comparison for when resulting products were created.