chore(docs): Generated API Reference (#2417)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c4c83c9717
commit
10b9b0dc49
+266
-172
@@ -308,6 +308,171 @@ 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:
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/user'
|
||||
'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:
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/user'
|
||||
'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
|
||||
@@ -898,171 +1063,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:
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/user'
|
||||
'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:
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/user'
|
||||
'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
|
||||
@@ -2158,7 +2158,7 @@ paths:
|
||||
medusa.admin.customerGroups.list()
|
||||
|
||||
.then(({ customer_groups, limit, offset, count }) => {
|
||||
console.log(customer_groups.id);
|
||||
console.log(customer_groups.length);
|
||||
});
|
||||
- lang: Shell
|
||||
label: cURL
|
||||
@@ -4421,10 +4421,10 @@ paths:
|
||||
format: email
|
||||
billing_address:
|
||||
description: The Address to be used for billing purposes.
|
||||
$ref: '#/components/schemas/address'
|
||||
$ref: '#/components/schemas/address_fields'
|
||||
shipping_address:
|
||||
description: The Address to be used for shipping.
|
||||
$ref: '#/components/schemas/address'
|
||||
$ref: '#/components/schemas/address_fields'
|
||||
items:
|
||||
description: The Line Items that have been received.
|
||||
type: array
|
||||
@@ -5151,10 +5151,10 @@ paths:
|
||||
format: email
|
||||
billing_address:
|
||||
description: The Address to be used for billing purposes.
|
||||
$ref: '#/components/schemas/address'
|
||||
$ref: '#/components/schemas/address_fields'
|
||||
shipping_address:
|
||||
description: The Address to be used for shipping.
|
||||
$ref: '#/components/schemas/address'
|
||||
$ref: '#/components/schemas/address_fields'
|
||||
discounts:
|
||||
description: An array of Discount codes to add to the Draft Order.
|
||||
type: array
|
||||
@@ -8980,11 +8980,11 @@ paths:
|
||||
billing_address:
|
||||
description: Billing address
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/address'
|
||||
- $ref: '#/components/schemas/address_fields'
|
||||
shipping_address:
|
||||
description: Shipping address
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/address'
|
||||
- $ref: '#/components/schemas/address_fields'
|
||||
items:
|
||||
description: The Line Items for the order
|
||||
type: array
|
||||
@@ -19262,6 +19262,60 @@ components:
|
||||
|
||||
Where `{sid}` is the value of `connect.sid` that you copied.
|
||||
schemas:
|
||||
address_fields:
|
||||
title: Address Fields
|
||||
description: Address fields used when creating/updating an address.
|
||||
x-resourceId: address
|
||||
properties:
|
||||
company:
|
||||
type: string
|
||||
description: Company name
|
||||
example: Acme
|
||||
first_name:
|
||||
type: string
|
||||
description: First name
|
||||
example: Arno
|
||||
last_name:
|
||||
type: string
|
||||
description: Last name
|
||||
example: Willms
|
||||
address_1:
|
||||
type: string
|
||||
description: Address line 1
|
||||
example: 14433 Kemmer Court
|
||||
address_2:
|
||||
type: string
|
||||
description: Address line 2
|
||||
example: Suite 369
|
||||
city:
|
||||
type: string
|
||||
description: City
|
||||
example: South Geoffreyview
|
||||
country_code:
|
||||
type: string
|
||||
description: The 2 character ISO code of the country in lower case
|
||||
externalDocs:
|
||||
url: >-
|
||||
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
description: See a list of codes.
|
||||
example: st
|
||||
province:
|
||||
type: string
|
||||
description: Province
|
||||
example: Kentucky
|
||||
postal_code:
|
||||
type: string
|
||||
description: Postal Code
|
||||
example: 72093
|
||||
phone:
|
||||
type: string
|
||||
description: Phone Number
|
||||
example: 16128234334802
|
||||
metadata:
|
||||
type: object
|
||||
description: An optional key-value map with additional details
|
||||
example:
|
||||
car: white
|
||||
address:
|
||||
title: Address
|
||||
description: An address.
|
||||
@@ -22888,6 +22942,46 @@ components:
|
||||
description: An optional key-value map with additional details
|
||||
example:
|
||||
car: white
|
||||
product_variant_prices_fields:
|
||||
title: Product Variant Prices Fields
|
||||
description: Product Variants Prices Fields that are only available in some requests.
|
||||
x-resourceId: product_variant_prices_fields
|
||||
properties:
|
||||
original_price:
|
||||
type: number
|
||||
description: >-
|
||||
The original price of the variant without any discounted prices
|
||||
applied.
|
||||
calculated_price:
|
||||
type: number
|
||||
description: The calculated price of the variant. Can be a discounted price.
|
||||
original_price_incl_tax:
|
||||
type: number
|
||||
description: The original price of the variant including taxes.
|
||||
calculated_price_incl_tax:
|
||||
type: number
|
||||
description: The calculated price of the variant including taxes.
|
||||
original_tax:
|
||||
type: number
|
||||
description: The taxes applied on the original price.
|
||||
calculated_tax:
|
||||
type: number
|
||||
description: The taxes applied on the calculated price.
|
||||
tax_rates:
|
||||
type: array
|
||||
description: An array of applied tax rates
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
rate:
|
||||
type: number
|
||||
description: The tax rate value
|
||||
name:
|
||||
type: string
|
||||
description: The name of the tax rate
|
||||
code:
|
||||
type: string
|
||||
description: The code of the tax rate
|
||||
product:
|
||||
title: Product
|
||||
description: >-
|
||||
|
||||
+481
-387
File diff suppressed because it is too large
Load Diff
@@ -3,5 +3,5 @@ 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.id);
|
||||
console.log(customer_groups.length);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
title: Address Fields
|
||||
description: Address fields used when creating/updating an address.
|
||||
x-resourceId: address
|
||||
properties:
|
||||
company:
|
||||
type: string
|
||||
description: Company name
|
||||
example: Acme
|
||||
first_name:
|
||||
type: string
|
||||
description: First name
|
||||
example: Arno
|
||||
last_name:
|
||||
type: string
|
||||
description: Last name
|
||||
example: Willms
|
||||
address_1:
|
||||
type: string
|
||||
description: Address line 1
|
||||
example: 14433 Kemmer Court
|
||||
address_2:
|
||||
type: string
|
||||
description: Address line 2
|
||||
example: Suite 369
|
||||
city:
|
||||
type: string
|
||||
description: City
|
||||
example: South Geoffreyview
|
||||
country_code:
|
||||
type: string
|
||||
description: The 2 character ISO code of the country in lower case
|
||||
externalDocs:
|
||||
url: >-
|
||||
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
description: See a list of codes.
|
||||
example: st
|
||||
province:
|
||||
type: string
|
||||
description: Province
|
||||
example: Kentucky
|
||||
postal_code:
|
||||
type: string
|
||||
description: Postal Code
|
||||
example: 72093
|
||||
phone:
|
||||
type: string
|
||||
description: Phone Number
|
||||
example: 16128234334802
|
||||
metadata:
|
||||
type: object
|
||||
description: An optional key-value map with additional details
|
||||
example:
|
||||
car: white
|
||||
@@ -0,0 +1,37 @@
|
||||
title: Product Variant Prices Fields
|
||||
description: Product Variants Prices Fields that are only available in some requests.
|
||||
x-resourceId: product_variant_prices_fields
|
||||
properties:
|
||||
original_price:
|
||||
type: number
|
||||
description: The original price of the variant without any discounted prices applied.
|
||||
calculated_price:
|
||||
type: number
|
||||
description: The calculated price of the variant. Can be a discounted price.
|
||||
original_price_incl_tax:
|
||||
type: number
|
||||
description: The original price of the variant including taxes.
|
||||
calculated_price_incl_tax:
|
||||
type: number
|
||||
description: The calculated price of the variant including taxes.
|
||||
original_tax:
|
||||
type: number
|
||||
description: The taxes applied on the original price.
|
||||
calculated_tax:
|
||||
type: number
|
||||
description: The taxes applied on the calculated price.
|
||||
tax_rates:
|
||||
type: array
|
||||
description: An array of applied tax rates
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
rate:
|
||||
type: number
|
||||
description: The tax rate value
|
||||
name:
|
||||
type: string
|
||||
description: The name of the tax rate
|
||||
code:
|
||||
type: string
|
||||
description: The code of the tax rate
|
||||
@@ -222,10 +222,10 @@ paths:
|
||||
$ref: paths/collections.yaml
|
||||
/collections/{id}:
|
||||
$ref: paths/collections_{id}.yaml
|
||||
/customers:
|
||||
$ref: paths/customers.yaml
|
||||
/customers/{id}:
|
||||
$ref: paths/customers_{id}.yaml
|
||||
/currencies:
|
||||
$ref: paths/currencies.yaml
|
||||
/currencies/{code}:
|
||||
$ref: paths/currencies_{code}.yaml
|
||||
/customer-groups/{id}/customers/batch:
|
||||
$ref: paths/customer-groups_{id}_customers_batch.yaml
|
||||
/customer-groups:
|
||||
@@ -234,10 +234,10 @@ paths:
|
||||
$ref: paths/customer-groups_{id}.yaml
|
||||
/customer-groups/{id}/customers:
|
||||
$ref: paths/customer-groups_{id}_customers.yaml
|
||||
/currencies:
|
||||
$ref: paths/currencies.yaml
|
||||
/currencies/{code}:
|
||||
$ref: paths/currencies_{code}.yaml
|
||||
/customers:
|
||||
$ref: paths/customers.yaml
|
||||
/customers/{id}:
|
||||
$ref: paths/customers_{id}.yaml
|
||||
/discounts/{id}/regions/{region_id}:
|
||||
$ref: paths/discounts_{id}_regions_{region_id}.yaml
|
||||
/discounts/{discount_id}/conditions:
|
||||
|
||||
@@ -31,10 +31,10 @@ post:
|
||||
format: email
|
||||
billing_address:
|
||||
description: The Address to be used for billing purposes.
|
||||
$ref: ../components/schemas/address.yaml
|
||||
$ref: ../components/schemas/address_fields.yaml
|
||||
shipping_address:
|
||||
description: The Address to be used for shipping.
|
||||
$ref: ../components/schemas/address.yaml
|
||||
$ref: ../components/schemas/address_fields.yaml
|
||||
discounts:
|
||||
description: An array of Discount codes to add to the Draft Order.
|
||||
type: array
|
||||
|
||||
@@ -25,10 +25,10 @@ post:
|
||||
format: email
|
||||
billing_address:
|
||||
description: The Address to be used for billing purposes.
|
||||
$ref: ../components/schemas/address.yaml
|
||||
$ref: ../components/schemas/address_fields.yaml
|
||||
shipping_address:
|
||||
description: The Address to be used for shipping.
|
||||
$ref: ../components/schemas/address.yaml
|
||||
$ref: ../components/schemas/address_fields.yaml
|
||||
items:
|
||||
description: The Line Items that have been received.
|
||||
type: array
|
||||
|
||||
@@ -68,11 +68,11 @@ post:
|
||||
billing_address:
|
||||
description: Billing address
|
||||
anyOf:
|
||||
- $ref: ../components/schemas/address.yaml
|
||||
- $ref: ../components/schemas/address_fields.yaml
|
||||
shipping_address:
|
||||
description: Shipping address
|
||||
anyOf:
|
||||
- $ref: ../components/schemas/address.yaml
|
||||
- $ref: ../components/schemas/address_fields.yaml
|
||||
items:
|
||||
description: The Line Items for the order
|
||||
type: array
|
||||
|
||||
+186
-60
@@ -1610,58 +1610,6 @@ paths:
|
||||
$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:
|
||||
properties:
|
||||
gift_card:
|
||||
$ref: '#/components/schemas/gift_card'
|
||||
'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
|
||||
@@ -1677,8 +1625,16 @@ paths:
|
||||
properties:
|
||||
address:
|
||||
description: The Address to add to the Customer.
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/address'
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/address_fields'
|
||||
- type: object
|
||||
required:
|
||||
- first_name
|
||||
- last_name
|
||||
- address_1
|
||||
- city
|
||||
- country_code
|
||||
- postal_code
|
||||
x-codeSamples:
|
||||
- lang: JavaScript
|
||||
label: JS Client
|
||||
@@ -1937,7 +1893,7 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/address'
|
||||
- $ref: '#/components/schemas/address_fields'
|
||||
x-codeSamples:
|
||||
- lang: JavaScript
|
||||
label: JS Client
|
||||
@@ -2069,7 +2025,7 @@ paths:
|
||||
billing_address:
|
||||
description: The Address to be used for billing purposes.
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/address'
|
||||
- $ref: '#/components/schemas/address_fields'
|
||||
description: The full billing address object
|
||||
- type: string
|
||||
description: The ID of an existing billing address
|
||||
@@ -2588,6 +2544,58 @@ paths:
|
||||
$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:
|
||||
properties:
|
||||
gift_card:
|
||||
$ref: '#/components/schemas/gift_card'
|
||||
'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
|
||||
@@ -2994,7 +3002,17 @@ paths:
|
||||
schema:
|
||||
properties:
|
||||
product:
|
||||
$ref: '#/components/schemas/product'
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/product'
|
||||
- type: object
|
||||
properties:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/product_variant'
|
||||
- $ref: >-
|
||||
#/components/schemas/product_variant_prices_fields
|
||||
'400':
|
||||
$ref: '#/components/responses/400_error'
|
||||
'404':
|
||||
@@ -3173,7 +3191,17 @@ paths:
|
||||
products:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/product'
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/product'
|
||||
- type: object
|
||||
properties:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/product_variant'
|
||||
- $ref: >-
|
||||
#/components/schemas/product_variant_prices_fields
|
||||
count:
|
||||
type: integer
|
||||
description: The total number of items available
|
||||
@@ -3975,7 +4003,9 @@ paths:
|
||||
schema:
|
||||
properties:
|
||||
variant:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/product_variant'
|
||||
- $ref: '#/components/schemas/product_variant_prices_fields'
|
||||
'400':
|
||||
$ref: '#/components/responses/400_error'
|
||||
'404':
|
||||
@@ -4071,7 +4101,9 @@ paths:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/product_variant'
|
||||
- $ref: '#/components/schemas/product_variant_prices_fields'
|
||||
'400':
|
||||
$ref: '#/components/responses/400_error'
|
||||
'404':
|
||||
@@ -4283,6 +4315,60 @@ components:
|
||||
|
||||
Where `{sid}` is the value of `connect.sid` that you copied.
|
||||
schemas:
|
||||
address_fields:
|
||||
title: Address Fields
|
||||
description: Address fields used when creating/updating an address.
|
||||
x-resourceId: address
|
||||
properties:
|
||||
company:
|
||||
type: string
|
||||
description: Company name
|
||||
example: Acme
|
||||
first_name:
|
||||
type: string
|
||||
description: First name
|
||||
example: Arno
|
||||
last_name:
|
||||
type: string
|
||||
description: Last name
|
||||
example: Willms
|
||||
address_1:
|
||||
type: string
|
||||
description: Address line 1
|
||||
example: 14433 Kemmer Court
|
||||
address_2:
|
||||
type: string
|
||||
description: Address line 2
|
||||
example: Suite 369
|
||||
city:
|
||||
type: string
|
||||
description: City
|
||||
example: South Geoffreyview
|
||||
country_code:
|
||||
type: string
|
||||
description: The 2 character ISO code of the country in lower case
|
||||
externalDocs:
|
||||
url: >-
|
||||
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
description: See a list of codes.
|
||||
example: st
|
||||
province:
|
||||
type: string
|
||||
description: Province
|
||||
example: Kentucky
|
||||
postal_code:
|
||||
type: string
|
||||
description: Postal Code
|
||||
example: 72093
|
||||
phone:
|
||||
type: string
|
||||
description: Phone Number
|
||||
example: 16128234334802
|
||||
metadata:
|
||||
type: object
|
||||
description: An optional key-value map with additional details
|
||||
example:
|
||||
car: white
|
||||
address:
|
||||
title: Address
|
||||
description: An address.
|
||||
@@ -7909,6 +7995,46 @@ components:
|
||||
description: An optional key-value map with additional details
|
||||
example:
|
||||
car: white
|
||||
product_variant_prices_fields:
|
||||
title: Product Variant Prices Fields
|
||||
description: Product Variants Prices Fields that are only available in some requests.
|
||||
x-resourceId: product_variant_prices_fields
|
||||
properties:
|
||||
original_price:
|
||||
type: number
|
||||
description: >-
|
||||
The original price of the variant without any discounted prices
|
||||
applied.
|
||||
calculated_price:
|
||||
type: number
|
||||
description: The calculated price of the variant. Can be a discounted price.
|
||||
original_price_incl_tax:
|
||||
type: number
|
||||
description: The original price of the variant including taxes.
|
||||
calculated_price_incl_tax:
|
||||
type: number
|
||||
description: The calculated price of the variant including taxes.
|
||||
original_tax:
|
||||
type: number
|
||||
description: The taxes applied on the original price.
|
||||
calculated_tax:
|
||||
type: number
|
||||
description: The taxes applied on the calculated price.
|
||||
tax_rates:
|
||||
type: array
|
||||
description: An array of applied tax rates
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
rate:
|
||||
type: number
|
||||
description: The tax rate value
|
||||
name:
|
||||
type: string
|
||||
description: The name of the tax rate
|
||||
code:
|
||||
type: string
|
||||
description: The code of the tax rate
|
||||
product:
|
||||
title: Product
|
||||
description: >-
|
||||
|
||||
+1616
-1490
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
title: Address Fields
|
||||
description: Address fields used when creating/updating an address.
|
||||
x-resourceId: address
|
||||
properties:
|
||||
company:
|
||||
type: string
|
||||
description: Company name
|
||||
example: Acme
|
||||
first_name:
|
||||
type: string
|
||||
description: First name
|
||||
example: Arno
|
||||
last_name:
|
||||
type: string
|
||||
description: Last name
|
||||
example: Willms
|
||||
address_1:
|
||||
type: string
|
||||
description: Address line 1
|
||||
example: 14433 Kemmer Court
|
||||
address_2:
|
||||
type: string
|
||||
description: Address line 2
|
||||
example: Suite 369
|
||||
city:
|
||||
type: string
|
||||
description: City
|
||||
example: South Geoffreyview
|
||||
country_code:
|
||||
type: string
|
||||
description: The 2 character ISO code of the country in lower case
|
||||
externalDocs:
|
||||
url: >-
|
||||
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
description: See a list of codes.
|
||||
example: st
|
||||
province:
|
||||
type: string
|
||||
description: Province
|
||||
example: Kentucky
|
||||
postal_code:
|
||||
type: string
|
||||
description: Postal Code
|
||||
example: 72093
|
||||
phone:
|
||||
type: string
|
||||
description: Phone Number
|
||||
example: 16128234334802
|
||||
metadata:
|
||||
type: object
|
||||
description: An optional key-value map with additional details
|
||||
example:
|
||||
car: white
|
||||
@@ -0,0 +1,37 @@
|
||||
title: Product Variant Prices Fields
|
||||
description: Product Variants Prices Fields that are only available in some requests.
|
||||
x-resourceId: product_variant_prices_fields
|
||||
properties:
|
||||
original_price:
|
||||
type: number
|
||||
description: The original price of the variant without any discounted prices applied.
|
||||
calculated_price:
|
||||
type: number
|
||||
description: The calculated price of the variant. Can be a discounted price.
|
||||
original_price_incl_tax:
|
||||
type: number
|
||||
description: The original price of the variant including taxes.
|
||||
calculated_price_incl_tax:
|
||||
type: number
|
||||
description: The calculated price of the variant including taxes.
|
||||
original_tax:
|
||||
type: number
|
||||
description: The taxes applied on the original price.
|
||||
calculated_tax:
|
||||
type: number
|
||||
description: The taxes applied on the calculated price.
|
||||
tax_rates:
|
||||
type: array
|
||||
description: An array of applied tax rates
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
rate:
|
||||
type: number
|
||||
description: The tax rate value
|
||||
name:
|
||||
type: string
|
||||
description: The name of the tax rate
|
||||
code:
|
||||
type: string
|
||||
description: The code of the tax rate
|
||||
+34
-34
@@ -149,40 +149,6 @@ paths:
|
||||
$ref: paths/auth.yaml
|
||||
/auth/{email}:
|
||||
$ref: paths/auth_{email}.yaml
|
||||
/gift-cards/{code}:
|
||||
$ref: paths/gift-cards_{code}.yaml
|
||||
/collections/{id}:
|
||||
$ref: paths/collections_{id}.yaml
|
||||
/collections:
|
||||
$ref: paths/collections.yaml
|
||||
/customers/me/addresses:
|
||||
$ref: paths/customers_me_addresses.yaml
|
||||
/customers:
|
||||
$ref: paths/customers.yaml
|
||||
/customers/me/addresses/{address_id}:
|
||||
$ref: paths/customers_me_addresses_{address_id}.yaml
|
||||
/customers/me:
|
||||
$ref: paths/customers_me.yaml
|
||||
/customers/me/payment-methods:
|
||||
$ref: paths/customers_me_payment-methods.yaml
|
||||
/customers/me/orders:
|
||||
$ref: paths/customers_me_orders.yaml
|
||||
/customers/password-token:
|
||||
$ref: paths/customers_password-token.yaml
|
||||
/customers/password-reset:
|
||||
$ref: paths/customers_password-reset.yaml
|
||||
/order-edits/{id}/complete:
|
||||
$ref: paths/order-edits_{id}_complete.yaml
|
||||
/order-edits/{id}/decline:
|
||||
$ref: paths/order-edits_{id}_decline.yaml
|
||||
/order-edits/{id}:
|
||||
$ref: paths/order-edits_{id}.yaml
|
||||
/orders/cart/{cart_id}:
|
||||
$ref: paths/orders_cart_{cart_id}.yaml
|
||||
/orders/{id}:
|
||||
$ref: paths/orders_{id}.yaml
|
||||
/orders:
|
||||
$ref: paths/orders.yaml
|
||||
/carts/{id}/shipping-methods:
|
||||
$ref: paths/carts_{id}_shipping-methods.yaml
|
||||
/carts/{id}/taxes:
|
||||
@@ -207,6 +173,40 @@ 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:
|
||||
$ref: paths/customers.yaml
|
||||
/customers/me/addresses/{address_id}:
|
||||
$ref: paths/customers_me_addresses_{address_id}.yaml
|
||||
/customers/me:
|
||||
$ref: paths/customers_me.yaml
|
||||
/customers/me/payment-methods:
|
||||
$ref: paths/customers_me_payment-methods.yaml
|
||||
/customers/me/orders:
|
||||
$ref: paths/customers_me_orders.yaml
|
||||
/customers/password-token:
|
||||
$ref: paths/customers_password-token.yaml
|
||||
/customers/password-reset:
|
||||
$ref: paths/customers_password-reset.yaml
|
||||
/gift-cards/{code}:
|
||||
$ref: paths/gift-cards_{code}.yaml
|
||||
/order-edits/{id}/complete:
|
||||
$ref: paths/order-edits_{id}_complete.yaml
|
||||
/order-edits/{id}/decline:
|
||||
$ref: paths/order-edits_{id}_decline.yaml
|
||||
/order-edits/{id}:
|
||||
$ref: paths/order-edits_{id}.yaml
|
||||
/orders/cart/{cart_id}:
|
||||
$ref: paths/orders_cart_{cart_id}.yaml
|
||||
/orders/{id}:
|
||||
$ref: paths/orders_{id}.yaml
|
||||
/orders:
|
||||
$ref: paths/orders.yaml
|
||||
/products/{id}:
|
||||
$ref: paths/products_{id}.yaml
|
||||
/products:
|
||||
|
||||
@@ -58,7 +58,7 @@ post:
|
||||
billing_address:
|
||||
description: The Address to be used for billing purposes.
|
||||
anyOf:
|
||||
- $ref: ../components/schemas/address.yaml
|
||||
- $ref: ../components/schemas/address_fields.yaml
|
||||
description: The full billing address object
|
||||
- type: string
|
||||
description: The ID of an existing billing address
|
||||
|
||||
@@ -12,8 +12,16 @@ post:
|
||||
properties:
|
||||
address:
|
||||
description: The Address to add to the Customer.
|
||||
anyOf:
|
||||
- $ref: ../components/schemas/address.yaml
|
||||
allOf:
|
||||
- $ref: ../components/schemas/address_fields.yaml
|
||||
- type: object
|
||||
required:
|
||||
- first_name
|
||||
- last_name
|
||||
- address_1
|
||||
- city
|
||||
- country_code
|
||||
- postal_code
|
||||
x-codeSamples:
|
||||
- lang: JavaScript
|
||||
label: JS Client
|
||||
|
||||
@@ -63,7 +63,7 @@ post:
|
||||
application/json:
|
||||
schema:
|
||||
anyOf:
|
||||
- $ref: ../components/schemas/address.yaml
|
||||
- $ref: ../components/schemas/address_fields.yaml
|
||||
x-codeSamples:
|
||||
- lang: JavaScript
|
||||
label: JS Client
|
||||
|
||||
@@ -155,7 +155,17 @@ get:
|
||||
products:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../components/schemas/product.yaml
|
||||
allOf:
|
||||
- $ref: ../components/schemas/product.yaml
|
||||
- type: object
|
||||
properties:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: ../components/schemas/product_variant.yaml
|
||||
- $ref: >-
|
||||
../components/schemas/product_variant_prices_fields.yaml
|
||||
count:
|
||||
type: integer
|
||||
description: The total number of items available
|
||||
|
||||
@@ -52,7 +52,17 @@ get:
|
||||
schema:
|
||||
properties:
|
||||
product:
|
||||
$ref: ../components/schemas/product.yaml
|
||||
allOf:
|
||||
- $ref: ../components/schemas/product.yaml
|
||||
- type: object
|
||||
properties:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: ../components/schemas/product_variant.yaml
|
||||
- $ref: >-
|
||||
../components/schemas/product_variant_prices_fields.yaml
|
||||
'400':
|
||||
$ref: ../components/responses/400_error.yaml
|
||||
'404':
|
||||
|
||||
@@ -79,7 +79,9 @@ get:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../components/schemas/product_variant.yaml
|
||||
allOf:
|
||||
- $ref: ../components/schemas/product_variant.yaml
|
||||
- $ref: ../components/schemas/product_variant_prices_fields.yaml
|
||||
'400':
|
||||
$ref: ../components/responses/400_error.yaml
|
||||
'404':
|
||||
|
||||
@@ -44,7 +44,9 @@ get:
|
||||
schema:
|
||||
properties:
|
||||
variant:
|
||||
$ref: ../components/schemas/product_variant.yaml
|
||||
allOf:
|
||||
- $ref: ../components/schemas/product_variant.yaml
|
||||
- $ref: ../components/schemas/product_variant_prices_fields.yaml
|
||||
'400':
|
||||
$ref: ../components/responses/400_error.yaml
|
||||
'404':
|
||||
|
||||
Reference in New Issue
Block a user