docs: Add request and error examples (#2109)
This commit is contained in:
1 parent
c0a002b262
commit
4961aece1c
246 files changed
+8566
-285
No files matched your search
@@ -1,173 +0,0 @@
|
|||||||
{
|
|
||||||
"openapi": "3.0.0",
|
|
||||||
"info": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"title": "Medusa Admin API",
|
|
||||||
"description": "API reference for Medusa's Admin endpoints. All endpoints are prefixed with `/admin`.",
|
|
||||||
"license": {
|
|
||||||
"name": "MIT",
|
|
||||||
"url": "https://github.com/medusajs/medusa/blob/master/LICENSE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
{
|
|
||||||
"name": "Auth",
|
|
||||||
"description": "Auth endpoints that allow authorization of admin Users and manages their sessions."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "App",
|
|
||||||
"description": "App endpoints that allow handling apps in Medusa.",
|
|
||||||
"x-resourceId": "OAuth"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Batch Job",
|
|
||||||
"description": "Batch Job endpoints that allow handling batch jobs in Medusa.",
|
|
||||||
"x-resourceId": "batch_job"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Claim",
|
|
||||||
"description": "Claim endpoints that allow handling claims in Medusa.",
|
|
||||||
"x-resourceId": "claim_order"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Collection",
|
|
||||||
"description": "Collection endpoints that allow handling collections in Medusa.",
|
|
||||||
"x-resourceId": "product_collection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Customer",
|
|
||||||
"description": "Customer endpoints that allow handling customers in Medusa.",
|
|
||||||
"x-resourceId": "customer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Customer Group",
|
|
||||||
"description": "Customer Group endpoints that allow handling customer groups in Medusa.",
|
|
||||||
"x-resourceId": "customer_group"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Discount",
|
|
||||||
"description": "Discount endpoints that allow handling discounts in Medusa.",
|
|
||||||
"x-resourceId": "discount"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Discount Condition",
|
|
||||||
"description": "Discount Condition endpoints that allow handling discount conditions in Medusa.",
|
|
||||||
"x-resourceId": "discount_condition"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Draft Order",
|
|
||||||
"description": "Draft Order endpoints that allow handling draft orders in Medusa.",
|
|
||||||
"x-resourceId": "draft-order"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Gift Card",
|
|
||||||
"description": "Gift Card endpoints that allow handling gift cards in Medusa.",
|
|
||||||
"x-resourceId": "gift_card"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Invite",
|
|
||||||
"description": "Invite endpoints that allow handling invites in Medusa.",
|
|
||||||
"x-resourceId": "invite"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Note",
|
|
||||||
"description": "Note endpoints that allow handling notes in Medusa.",
|
|
||||||
"x-resourceId": "note"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Notification",
|
|
||||||
"description": "Notification endpoints that allow handling notifications in Medusa.",
|
|
||||||
"x-resourceId": "notification"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Order",
|
|
||||||
"description": "Order endpoints that allow handling orders in Medusa.",
|
|
||||||
"x-resourceId": "order"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Price List",
|
|
||||||
"description": "Price List endpoints that allow handling price lists in Medusa.",
|
|
||||||
"x-resourceId": "price_list"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Product",
|
|
||||||
"description": "Product endpoints that allow handling products in Medusa.",
|
|
||||||
"x-resourceId": "product"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Product Tag",
|
|
||||||
"description": "Product Tag endpoints that allow handling product tags in Medusa.",
|
|
||||||
"x-resourceId": "product_tag"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Product Types",
|
|
||||||
"description": "Product Types endpoints that allow handling product types in Medusa.",
|
|
||||||
"x-resourceId": "product_type"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Product Variant",
|
|
||||||
"description": "Product Variant endpoints that allow handling product variants in Medusa.",
|
|
||||||
"x-resourceId": "product_variant"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Region",
|
|
||||||
"description": "Region endpoints that allow handling regions in Medusa.",
|
|
||||||
"x-resourceId": "region"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Return Reason",
|
|
||||||
"description": "Return Reason endpoints that allow handling return reasons in Medusa.",
|
|
||||||
"x-resourceId": "return_reason"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Return",
|
|
||||||
"description": "Return endpoints that allow handling returns in Medusa.",
|
|
||||||
"x-resourceId": "return"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sales Channel",
|
|
||||||
"description": "Sales Channel endpoints that allow handling sales channels in Medusa.",
|
|
||||||
"x-resourceId": "sales_channel"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Shipping Option",
|
|
||||||
"description": "Shipping Option endpoints that allow handling shipping options in Medusa.",
|
|
||||||
"x-resourceId": "shipping_option"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Shipping Profile",
|
|
||||||
"description": "Shipping Profile endpoints that allow handling shipping profiles in Medusa.",
|
|
||||||
"x-resourceId": "shipping_profile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Store",
|
|
||||||
"description": "Store endpoints that allow handling stores in Medusa.",
|
|
||||||
"x-resourceId": "store"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Swap",
|
|
||||||
"description": "Swap endpoints that allow handling swaps in Medusa.",
|
|
||||||
"x-resourceId": "swap"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Tax Rate",
|
|
||||||
"description": "Tax Rate endpoints that allow handling tax rates in Medusa.",
|
|
||||||
"x-resourceId": "tax_rate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Upload",
|
|
||||||
"description": "Upload endpoints that allow handling uploads in Medusa."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "User",
|
|
||||||
"description": "User endpoints that allow handling users in Medusa.",
|
|
||||||
"x-resourceId": "user"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"servers": [
|
|
||||||
{
|
|
||||||
"url": "https://api.medusa-commerce.com/admin"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paths": {}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,321 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
version: 1.0.0
|
||||||
|
title: Medusa Admin API
|
||||||
|
description: |
|
||||||
|
API reference for Medusa's Admin endpoints. All endpoints are prefixed with `/admin`.
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
There are two ways to send authenticated requests to the Medusa server: Using a user's API token, or using a Cookie Session ID.
|
||||||
|
|
||||||
|
<!-- ReDoc-Inject: <SecurityDefinitions> -->
|
||||||
|
license:
|
||||||
|
name: MIT
|
||||||
|
url: https://github.com/medusajs/medusa/blob/master/LICENSE
|
||||||
|
tags:
|
||||||
|
- name: Auth
|
||||||
|
description: Auth endpoints that allow authorization of admin Users and manages
|
||||||
|
their sessions.
|
||||||
|
- name: App
|
||||||
|
description: App endpoints that allow handling apps in Medusa.
|
||||||
|
x-resourceId: OAuth
|
||||||
|
- name: Batch Job
|
||||||
|
description: Batch Job endpoints that allow handling batch jobs in Medusa.
|
||||||
|
x-resourceId: batch_job
|
||||||
|
- name: Claim
|
||||||
|
description: Claim endpoints that allow handling claims in Medusa.
|
||||||
|
x-resourceId: claim_order
|
||||||
|
- name: Collection
|
||||||
|
description: Collection endpoints that allow handling collections in Medusa.
|
||||||
|
x-resourceId: product_collection
|
||||||
|
- name: Customer
|
||||||
|
description: Customer endpoints that allow handling customers in Medusa.
|
||||||
|
x-resourceId: customer
|
||||||
|
- name: Customer Group
|
||||||
|
description: Customer Group endpoints that allow handling customer groups in Medusa.
|
||||||
|
x-resourceId: customer_group
|
||||||
|
- name: Discount
|
||||||
|
description: Discount endpoints that allow handling discounts in Medusa.
|
||||||
|
x-resourceId: discount
|
||||||
|
- name: Discount Condition
|
||||||
|
description: Discount Condition endpoints that allow handling discount conditions
|
||||||
|
in Medusa.
|
||||||
|
x-resourceId: discount_condition
|
||||||
|
- name: Draft Order
|
||||||
|
description: Draft Order endpoints that allow handling draft orders in Medusa.
|
||||||
|
x-resourceId: draft-order
|
||||||
|
- name: Gift Card
|
||||||
|
description: Gift Card endpoints that allow handling gift cards in Medusa.
|
||||||
|
x-resourceId: gift_card
|
||||||
|
- name: Invite
|
||||||
|
description: Invite endpoints that allow handling invites in Medusa.
|
||||||
|
x-resourceId: invite
|
||||||
|
- name: Note
|
||||||
|
description: Note endpoints that allow handling notes in Medusa.
|
||||||
|
x-resourceId: note
|
||||||
|
- name: Notification
|
||||||
|
description: Notification endpoints that allow handling notifications in Medusa.
|
||||||
|
x-resourceId: notification
|
||||||
|
- name: Order
|
||||||
|
description: Order endpoints that allow handling orders in Medusa.
|
||||||
|
x-resourceId: order
|
||||||
|
- name: Price List
|
||||||
|
description: Price List endpoints that allow handling price lists in Medusa.
|
||||||
|
x-resourceId: price_list
|
||||||
|
- name: Product
|
||||||
|
description: Product endpoints that allow handling products in Medusa.
|
||||||
|
x-resourceId: product
|
||||||
|
- name: Product Tag
|
||||||
|
description: Product Tag endpoints that allow handling product tags in Medusa.
|
||||||
|
x-resourceId: product_tag
|
||||||
|
- name: Product Type
|
||||||
|
description: Product Types endpoints that allow handling product types in Medusa.
|
||||||
|
x-resourceId: product_type
|
||||||
|
- name: Product Variant
|
||||||
|
description: Product Variant endpoints that allow handling product variants in Medusa.
|
||||||
|
x-resourceId: product_variant
|
||||||
|
- name: Region
|
||||||
|
description: Region endpoints that allow handling regions in Medusa.
|
||||||
|
x-resourceId: region
|
||||||
|
- name: Return Reason
|
||||||
|
description: Return Reason endpoints that allow handling return reasons in Medusa.
|
||||||
|
x-resourceId: return_reason
|
||||||
|
- name: Return
|
||||||
|
description: Return endpoints that allow handling returns in Medusa.
|
||||||
|
x-resourceId: return
|
||||||
|
- name: Sales Channel
|
||||||
|
description: Sales Channel endpoints that allow handling sales channels in Medusa.
|
||||||
|
x-resourceId: sales_channel
|
||||||
|
- name: Shipping Option
|
||||||
|
description: Shipping Option endpoints that allow handling shipping options in Medusa.
|
||||||
|
x-resourceId: shipping_option
|
||||||
|
- name: Shipping Profile
|
||||||
|
description: Shipping Profile endpoints that allow handling shipping profiles in
|
||||||
|
Medusa.
|
||||||
|
x-resourceId: shipping_profile
|
||||||
|
- name: Store
|
||||||
|
description: Store endpoints that allow handling stores in Medusa.
|
||||||
|
x-resourceId: store
|
||||||
|
- name: Swap
|
||||||
|
description: Swap endpoints that allow handling swaps in Medusa.
|
||||||
|
x-resourceId: swap
|
||||||
|
- name: Tax Rate
|
||||||
|
description: Tax Rate endpoints that allow handling tax rates in Medusa.
|
||||||
|
x-resourceId: tax_rate
|
||||||
|
- name: Upload
|
||||||
|
description: Upload endpoints that allow handling uploads in Medusa.
|
||||||
|
- name: User
|
||||||
|
description: User endpoints that allow handling users in Medusa.
|
||||||
|
x-resourceId: user
|
||||||
|
servers:
|
||||||
|
- url: https://api.medusa-commerce.com/admin
|
||||||
|
paths: {}
|
||||||
|
components:
|
||||||
|
responses:
|
||||||
|
default_error:
|
||||||
|
description: Default Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
code: "unknown_error"
|
||||||
|
message: "An unknown error occurred."
|
||||||
|
type: "unknown_error"
|
||||||
|
invalid_state_error:
|
||||||
|
description: Invalid State Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
code: "unknown_error"
|
||||||
|
message: "The request conflicted with another request. You may retry the request with the provided Idempotency-Key."
|
||||||
|
type: "QueryRunnerAlreadyReleasedError"
|
||||||
|
invalid_request_error:
|
||||||
|
description: Invalid Request Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
code: "invalid_request_error"
|
||||||
|
message: "Discount with code TEST already exists."
|
||||||
|
type: "duplicate_error"
|
||||||
|
not_found_error:
|
||||||
|
description: Not Found Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
message: "Entity with id 1 was not found"
|
||||||
|
type: "not_found"
|
||||||
|
400_error:
|
||||||
|
description: Client Error or Multiple Errors
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
oneOf:
|
||||||
|
- $ref: "#/components/schemas/error"
|
||||||
|
- $ref: "#/components/schemas/multiple_errors"
|
||||||
|
examples:
|
||||||
|
not_allowed:
|
||||||
|
$ref: "#/components/examples/not_allowed_error"
|
||||||
|
invalid_data:
|
||||||
|
$ref: "#/components/examples/invalid_data_error"
|
||||||
|
multiple_errors:
|
||||||
|
$ref: "#/components/examples/multiple_errors"
|
||||||
|
500_error:
|
||||||
|
description: Server Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
examples:
|
||||||
|
database:
|
||||||
|
$ref: "#/components/examples/database_error"
|
||||||
|
unexpected_state:
|
||||||
|
$ref: "#/components/examples/unexpected_state_error"
|
||||||
|
invalid_argument:
|
||||||
|
$ref: "#/components/examples/invalid_argument_error"
|
||||||
|
default_error:
|
||||||
|
$ref: "#/components/examples/default_error"
|
||||||
|
unauthorized:
|
||||||
|
description: 'User is not authorized. Must log in first'
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: Unauthorized
|
||||||
|
example: Unauthorized
|
||||||
|
incorrect_credentials:
|
||||||
|
description: 'User does not exist or incorrect credentials'
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: Unauthorized
|
||||||
|
example: Unauthorized
|
||||||
|
examples:
|
||||||
|
not_allowed_error:
|
||||||
|
summary: Not Allowed Error
|
||||||
|
value:
|
||||||
|
message: "Discount must be set to dynamic"
|
||||||
|
type: "not_allowed"
|
||||||
|
invalid_data_error:
|
||||||
|
summary: Invalid Data Error
|
||||||
|
value:
|
||||||
|
message: "first_name must be a string"
|
||||||
|
type: "invalid_data"
|
||||||
|
multiple_errors:
|
||||||
|
summary: Multiple Errors
|
||||||
|
value:
|
||||||
|
message: "Provided request body contains errors. Please check the data and retry the request"
|
||||||
|
errors:
|
||||||
|
- message: "first_name must be a string"
|
||||||
|
type: "invalid_data"
|
||||||
|
- message: "Discount must be set to dynamic"
|
||||||
|
type: "not_allowed"
|
||||||
|
database_error:
|
||||||
|
summary: Database Error
|
||||||
|
value:
|
||||||
|
code: "api_error"
|
||||||
|
message: "An error occured while hashing password"
|
||||||
|
type: "database_error"
|
||||||
|
unexpected_state_error:
|
||||||
|
summary: Unexpected State Error
|
||||||
|
value:
|
||||||
|
message: "cart.total must be defined"
|
||||||
|
type: "unexpected_state"
|
||||||
|
invalid_argument_error:
|
||||||
|
summary: Invalid Argument Error
|
||||||
|
value:
|
||||||
|
message: "cart.total must be defined"
|
||||||
|
type: "unexpected_state"
|
||||||
|
default_error:
|
||||||
|
summary: Default Error
|
||||||
|
value:
|
||||||
|
code: "unknown_error"
|
||||||
|
message: "An unknown error occurred."
|
||||||
|
type: "unknown_error"
|
||||||
|
securitySchemes:
|
||||||
|
api_token:
|
||||||
|
type: http
|
||||||
|
x-displayName: API Token
|
||||||
|
description: |
|
||||||
|
Use a user's API Token to send authenticated requests.
|
||||||
|
|
||||||
|
### How to Add API Token to a User
|
||||||
|
|
||||||
|
At the moment, there's no direct way of adding an API Token for a user. The only way it can be done is through directly editing the database.
|
||||||
|
|
||||||
|
If you're using a PostgreSQL database, you can run the following commands in your command line to add API token:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
psql -d <DB_NAME> -U <DB_USER>
|
||||||
|
UPDATE public.user SET api_token='<API_TOKEN>' WHERE email='<USER_EMAIL>';
|
||||||
|
```
|
||||||
|
|
||||||
|
Where:
|
||||||
|
- `<DB_NAME>` is the name of the database schema you use for the Medusa server.
|
||||||
|
- `<DB_USER>` is the name of the user that has privileges over the database schema.
|
||||||
|
- `<API_TOKEN>` is the API token you want to associate with the user. You can use [this tool to generate a random token](https://randomkeygen.com/).
|
||||||
|
- `<USER_EMAIL>` is the email address of the admin user you want to have this API token.
|
||||||
|
|
||||||
|
### How to Use the API Token
|
||||||
|
|
||||||
|
The API token can be used for Bearer Authentication. It's passed in the `Authorization` header as the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
Authorization: Bearer {api_token}
|
||||||
|
```
|
||||||
|
|
||||||
|
In this API reference, you'll find in the cURL request samples the use of `{api_token}`. This is where you must pass the API token.
|
||||||
|
|
||||||
|
If you're alternatively following along with the JS Client request samples, you must provide the `apiKey` option when creating the Medusa client:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, apiKey: '{api_token}' })
|
||||||
|
```
|
||||||
|
scheme: bearer
|
||||||
|
cookie_auth:
|
||||||
|
type: apiKey
|
||||||
|
in: cookie
|
||||||
|
name: connect.sid
|
||||||
|
x-displayName: Cookie Session ID
|
||||||
|
description: |
|
||||||
|
Use a cookie session to send authenticated requests.
|
||||||
|
|
||||||
|
### How to Obtain the Cookie Session
|
||||||
|
|
||||||
|
If you're sending requests through a browser, using JS Client, or using tools like Postman, the cookie session should be automatically set when the admin user is logged in.
|
||||||
|
|
||||||
|
If you're sending requests using cURL, you must set the Session ID in the cookie manually.
|
||||||
|
|
||||||
|
To do that, send a request to [authenticate the user](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -v --location --request POST 'https://medusa-url.com/admin/auth' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{
|
||||||
|
"email": "user@example.com",
|
||||||
|
"password": "supersecret"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
The headers will be logged in the terminal as well as the response. You should find in the headers a Cookie header similar to this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Set-Cookie: connect.sid=s%3A2Bu8BkaP9JUfHu9rG59G16Ma0QZf6Gj1.WT549XqX37PN8n0OecqnMCq798eLjZC5IT7yiDCBHPM;
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy the value after `connect.sid` (without the `;` at the end) and pass it as a cookie in subsequent requests as the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request GET 'https://medusa-url.com/admin/products' \
|
||||||
|
--header 'Cookie: connect.sid={sid}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Where `{sid}` is the value of `connect.sid` that you copied.
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
{
|
|
||||||
"openapi": "3.0.0",
|
|
||||||
"info": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"title": "Medusa Storefront API",
|
|
||||||
"description": "API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`.",
|
|
||||||
"license": {
|
|
||||||
"name": "MIT",
|
|
||||||
"url": "https://github.com/medusajs/medusa/blob/master/LICENSE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
{
|
|
||||||
"name": "Auth",
|
|
||||||
"description": "Auth endpoints that allow authorization of customers and manages their sessions."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Cart",
|
|
||||||
"description": "Cart endpoints that allow handling carts in Medusa.",
|
|
||||||
"x-resourceId": "cart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Collection",
|
|
||||||
"description": "Collection endpoints that allow handling collections in Medusa.",
|
|
||||||
"x-resourceId": "product_collection"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Customer",
|
|
||||||
"description": "Customer endpoints that allow handling customers in Medusa.",
|
|
||||||
"x-resourceId": "customer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Gift Card",
|
|
||||||
"description": "Gift Card endpoints that allow handling gift cards in Medusa.",
|
|
||||||
"x-resourceId": "gift_card"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Order",
|
|
||||||
"description": "Order endpoints that allow handling orders in Medusa.",
|
|
||||||
"x-resourceId": "order"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Product",
|
|
||||||
"description": "Product endpoints that allow handling products in Medusa.",
|
|
||||||
"x-resourceId": "product"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Product Variant",
|
|
||||||
"description": "Product Variant endpoints that allow handling product variants in Medusa.",
|
|
||||||
"x-resourceId": "product_variant"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Region",
|
|
||||||
"description": "Region endpoints that allow handling regions in Medusa.",
|
|
||||||
"x-resourceId": "region"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Return Reason",
|
|
||||||
"description": "Return Reason endpoints that allow handling return reasons in Medusa.",
|
|
||||||
"x-resourceId": "return_reason"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Return",
|
|
||||||
"description": "Return endpoints that allow handling returns in Medusa.",
|
|
||||||
"x-resourceId": "return"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Shipping Option",
|
|
||||||
"description": "Shipping Option endpoints that allow handling shipping options in Medusa.",
|
|
||||||
"x-resourceId": "shipping_option"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Swap",
|
|
||||||
"description": "Swap endpoints that allow handling swaps in Medusa.",
|
|
||||||
"x-resourceId": "swap"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"servers": [
|
|
||||||
{
|
|
||||||
"url": "https://api.medusa-commerce.com/store"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paths": {}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
version: 1.0.0
|
||||||
|
title: Medusa Storefront API
|
||||||
|
description: |
|
||||||
|
API reference for Medusa's Storefront endpoints. All endpoints are prefixed with `/store`.
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
To send requests as an authenticated customer, you must use the Cookie Session ID.
|
||||||
|
|
||||||
|
<!-- ReDoc-Inject: <SecurityDefinitions> -->
|
||||||
|
license:
|
||||||
|
name: MIT
|
||||||
|
url: https://github.com/medusajs/medusa/blob/master/LICENSE
|
||||||
|
tags:
|
||||||
|
- name: Auth
|
||||||
|
description: Auth endpoints that allow authorization of customers and manages their
|
||||||
|
sessions.
|
||||||
|
- name: Cart
|
||||||
|
description: Cart endpoints that allow handling carts in Medusa.
|
||||||
|
x-resourceId: cart
|
||||||
|
- name: Collection
|
||||||
|
description: Collection endpoints that allow handling collections in Medusa.
|
||||||
|
x-resourceId: product_collection
|
||||||
|
- name: Customer
|
||||||
|
description: Customer endpoints that allow handling customers in Medusa.
|
||||||
|
x-resourceId: customer
|
||||||
|
- name: Gift Card
|
||||||
|
description: Gift Card endpoints that allow handling gift cards in Medusa.
|
||||||
|
x-resourceId: gift_card
|
||||||
|
- name: Order
|
||||||
|
description: Order endpoints that allow handling orders in Medusa.
|
||||||
|
x-resourceId: order
|
||||||
|
- name: Product
|
||||||
|
description: Product endpoints that allow handling products in Medusa.
|
||||||
|
x-resourceId: product
|
||||||
|
- name: Product Variant
|
||||||
|
description: Product Variant endpoints that allow handling product variants in Medusa.
|
||||||
|
x-resourceId: product_variant
|
||||||
|
- name: Region
|
||||||
|
description: Region endpoints that allow handling regions in Medusa.
|
||||||
|
x-resourceId: region
|
||||||
|
- name: Return Reason
|
||||||
|
description: Return Reason endpoints that allow handling return reasons in Medusa.
|
||||||
|
x-resourceId: return_reason
|
||||||
|
- name: Return
|
||||||
|
description: Return endpoints that allow handling returns in Medusa.
|
||||||
|
x-resourceId: return
|
||||||
|
- name: Shipping Option
|
||||||
|
description: Shipping Option endpoints that allow handling shipping options in Medusa.
|
||||||
|
x-resourceId: shipping_option
|
||||||
|
- name: Swap
|
||||||
|
description: Swap endpoints that allow handling swaps in Medusa.
|
||||||
|
x-resourceId: swap
|
||||||
|
servers:
|
||||||
|
- url: https://api.medusa-commerce.com/store
|
||||||
|
paths: {}
|
||||||
|
components:
|
||||||
|
responses:
|
||||||
|
default_error:
|
||||||
|
description: Default Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
code: "unknown_error"
|
||||||
|
message: "An unknown error occurred."
|
||||||
|
type: "unknown_error"
|
||||||
|
invalid_state_error:
|
||||||
|
description: Invalid State Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
code: "unknown_error"
|
||||||
|
message: "The request conflicted with another request. You may retry the request with the provided Idempotency-Key."
|
||||||
|
type: "QueryRunnerAlreadyReleasedError"
|
||||||
|
invalid_request_error:
|
||||||
|
description: Invalid Request Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
code: "invalid_request_error"
|
||||||
|
message: "Discount with code TEST already exists."
|
||||||
|
type: "duplicate_error"
|
||||||
|
not_found_error:
|
||||||
|
description: Not Found Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
example:
|
||||||
|
message: "Entity with id 1 was not found"
|
||||||
|
type: "not_found"
|
||||||
|
400_error:
|
||||||
|
description: Client Error or Multiple Errors
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
oneOf:
|
||||||
|
- $ref: "#/components/schemas/error"
|
||||||
|
- $ref: "#/components/schemas/multiple_errors"
|
||||||
|
examples:
|
||||||
|
not_allowed:
|
||||||
|
$ref: "#/components/examples/not_allowed_error"
|
||||||
|
invalid_data:
|
||||||
|
$ref: "#/components/examples/invalid_data_error"
|
||||||
|
multiple_errors:
|
||||||
|
$ref: "#/components/examples/multiple_errors"
|
||||||
|
500_error:
|
||||||
|
description: Server Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/error"
|
||||||
|
examples:
|
||||||
|
database:
|
||||||
|
$ref: "#/components/examples/database_error"
|
||||||
|
unexpected_state:
|
||||||
|
$ref: "#/components/examples/unexpected_state_error"
|
||||||
|
invalid_argument:
|
||||||
|
$ref: "#/components/examples/invalid_argument_error"
|
||||||
|
default_error:
|
||||||
|
$ref: "#/components/examples/default_error"
|
||||||
|
unauthorized:
|
||||||
|
description: 'User is not authorized. Must log in first'
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: Unauthorized
|
||||||
|
example: Unauthorized
|
||||||
|
incorrect_credentials:
|
||||||
|
description: 'User does not exist or incorrect credentials'
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: Unauthorized
|
||||||
|
example: Unauthorized
|
||||||
|
examples:
|
||||||
|
not_allowed_error:
|
||||||
|
summary: Not Allowed Error
|
||||||
|
value:
|
||||||
|
message: "Discount must be set to dynamic"
|
||||||
|
type: "not_allowed"
|
||||||
|
invalid_data_error:
|
||||||
|
summary: Invalid Data Error
|
||||||
|
value:
|
||||||
|
message: "first_name must be a string"
|
||||||
|
type: "invalid_data"
|
||||||
|
multiple_errors:
|
||||||
|
summary: Multiple Errors
|
||||||
|
value:
|
||||||
|
message: "Provided request body contains errors. Please check the data and retry the request"
|
||||||
|
errors:
|
||||||
|
- message: "first_name must be a string"
|
||||||
|
type: "invalid_data"
|
||||||
|
- message: "Discount must be set to dynamic"
|
||||||
|
type: "not_allowed"
|
||||||
|
database_error:
|
||||||
|
summary: Database Error
|
||||||
|
value:
|
||||||
|
code: "api_error"
|
||||||
|
message: "An error occured while hashing password"
|
||||||
|
type: "database_error"
|
||||||
|
unexpected_state_error:
|
||||||
|
summary: Unexpected State Error
|
||||||
|
value:
|
||||||
|
message: "cart.total must be defined"
|
||||||
|
type: "unexpected_state"
|
||||||
|
invalid_argument_error:
|
||||||
|
summary: Invalid Argument Error
|
||||||
|
value:
|
||||||
|
message: "cart.total must be defined"
|
||||||
|
type: "unexpected_state"
|
||||||
|
default_error:
|
||||||
|
summary: Default Error
|
||||||
|
value:
|
||||||
|
code: "unknown_error"
|
||||||
|
message: "An unknown error occurred."
|
||||||
|
type: "unknown_error"
|
||||||
|
securitySchemes:
|
||||||
|
cookie_auth:
|
||||||
|
type: apiKey
|
||||||
|
x-displayName: Cookie Session ID
|
||||||
|
in: cookie
|
||||||
|
name: connect.sid
|
||||||
|
description: |
|
||||||
|
Use a cookie session to send authenticated requests.
|
||||||
|
|
||||||
|
### How to Obtain the Cookie Session
|
||||||
|
|
||||||
|
If you're sending requests through a browser, using JS Client, or using tools like Postman, the cookie session should be automatically set when the customer is logged in.
|
||||||
|
|
||||||
|
If you're sending requests using cURL, you must set the Session ID in the cookie manually.
|
||||||
|
|
||||||
|
To do that, send a request to [authenticate the customer](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -v --location --request POST 'https://medusa-url.com/store/auth' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{
|
||||||
|
"email": "user@example.com",
|
||||||
|
"password": "supersecret"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
The headers will be logged in the terminal as well as the response. You should find in the headers a Cookie header similar to this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Set-Cookie: connect.sid=s%3A2Bu8BkaP9JUfHu9rG59G16Ma0QZf6Gj1.WT549XqX37PN8n0OecqnMCq798eLjZC5IT7yiDCBHPM;
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy the value after `connect.sid` (without the `;` at the end) and pass it as a cookie in subsequent requests as the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request GET 'https://medusa-url.com/store/customers/me/orders' \
|
||||||
|
--header 'Cookie: connect.sid={sid}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Where `{sid}` is the value of `connect.sid` that you copied.
|
||||||
@@ -15,3 +15,18 @@ export default (fn: handler): RequestHandler => {
|
|||||||
return fn(req, res).catch(next)
|
return fn(req, res).catch(next)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema multiple_errors
|
||||||
|
* title: "Multiple Errors"
|
||||||
|
* x-resourceId: multiple_errors
|
||||||
|
* properties:
|
||||||
|
* errors:
|
||||||
|
* type: array
|
||||||
|
* description: Array of errors
|
||||||
|
* items:
|
||||||
|
* $ref: "#/components/schemas/error"
|
||||||
|
* message:
|
||||||
|
* type: string
|
||||||
|
* default: "Provided request body contains errors. Please check the data and retry the request"
|
||||||
|
*/
|
||||||
@@ -67,3 +67,19 @@ export default () => {
|
|||||||
res.status(statusCode).json(errObj)
|
res.status(statusCode).json(errObj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema error
|
||||||
|
* title: "Response Error"
|
||||||
|
* x-resourceId: error
|
||||||
|
* properties:
|
||||||
|
* code:
|
||||||
|
* type: string
|
||||||
|
* description: A slug code to indicate the type of the error.
|
||||||
|
* message:
|
||||||
|
* type: string
|
||||||
|
* description: Description of the error that occurred.
|
||||||
|
* type:
|
||||||
|
* type: string
|
||||||
|
* description: A slug indicating the type of the error.
|
||||||
|
*/
|
||||||
@@ -27,6 +27,21 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* code:
|
* code:
|
||||||
* type: string
|
* type: string
|
||||||
* description: The code for the generated token.
|
* description: The code for the generated token.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/apps/authorizations' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "application_name": "example",
|
||||||
|
* "state": "ready",
|
||||||
|
* "code": "token"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - App
|
* - App
|
||||||
* responses:
|
* responses:
|
||||||
@@ -38,6 +53,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* apps:
|
* apps:
|
||||||
* $ref: "#/components/schemas/OAuth"
|
* $ref: "#/components/schemas/OAuth"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminPostAppsReq, req.body)
|
const validated = await validator(AdminPostAppsReq, req.body)
|
||||||
|
|||||||
@@ -6,6 +6,15 @@ import { OauthService } from "../../../../services"
|
|||||||
* summary: "List applications"
|
* summary: "List applications"
|
||||||
* description: "Retrieve a list of applications."
|
* description: "Retrieve a list of applications."
|
||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/apps' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - App
|
* - App
|
||||||
* responses:
|
* responses:
|
||||||
@@ -19,6 +28,18 @@ import { OauthService } from "../../../../services"
|
|||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* $ref: "#/components/schemas/OAuth"
|
* $ref: "#/components/schemas/OAuth"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const oauthService: OauthService = req.scope.resolve("oauthService")
|
const oauthService: OauthService = req.scope.resolve("oauthService")
|
||||||
|
|||||||
@@ -32,6 +32,27 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* type: string
|
* type: string
|
||||||
* description: The User's password.
|
* description: The User's password.
|
||||||
* format: password
|
* format: 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:
|
* tags:
|
||||||
* - Auth
|
* - Auth
|
||||||
* responses:
|
* responses:
|
||||||
@@ -43,8 +64,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* user:
|
* user:
|
||||||
* $ref: "#/components/schemas/user"
|
* $ref: "#/components/schemas/user"
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
* description: The user doesn't exist or the credentials are incorrect.
|
* $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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { projectConfig: { jwt_secret } } = req.scope.resolve('configModule')
|
const { projectConfig: { jwt_secret } } = req.scope.resolve('configModule')
|
||||||
|
|||||||
@@ -4,11 +4,39 @@
|
|||||||
* summary: "Delete Session"
|
* summary: "Delete Session"
|
||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* description: "Deletes the current session for the logged in user."
|
* 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:
|
* tags:
|
||||||
* - Auth
|
* - Auth
|
||||||
* responses:
|
* responses:
|
||||||
* "200":
|
* "200":
|
||||||
* description: OK
|
* 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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
req.session.destroy()
|
req.session.destroy()
|
||||||
|
|||||||
@@ -7,6 +7,25 @@ import _ from "lodash"
|
|||||||
* summary: "Get Session"
|
* summary: "Get Session"
|
||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* description: "Gets the currently logged in User."
|
* 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:
|
* tags:
|
||||||
* - Auth
|
* - Auth
|
||||||
* responses:
|
* responses:
|
||||||
@@ -19,7 +38,17 @@ import _ from "lodash"
|
|||||||
* user:
|
* user:
|
||||||
* $ref: "#/components/schemas/user"
|
* $ref: "#/components/schemas/user"
|
||||||
* "400":
|
* "400":
|
||||||
* description: An error occurred.
|
* $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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the batch job.
|
* - (path) id=* {string} The ID of the batch job.
|
||||||
|
* 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.batchJobs.cancel(batch_job_id)
|
||||||
|
* .then(({ batch_job }) => {
|
||||||
|
* console.log(batch_job.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/batch-jobs/{id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Batch Job
|
* - Batch Job
|
||||||
* responses:
|
* responses:
|
||||||
@@ -20,6 +39,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* batch_job:
|
* batch_job:
|
||||||
* $ref: "#/components/schemas/batch_job"
|
* $ref: "#/components/schemas/batch_job"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
let batch_job = req.batch_job
|
let batch_job = req.batch_job
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the batch job.
|
* - (path) id=* {string} The ID of the batch job.
|
||||||
|
* 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.batchJobs.confirm(batch_job_id)
|
||||||
|
* .then(({ batch_job }) => {
|
||||||
|
* console.log(batch_job.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/batch-jobs/{id}/confirm' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Batch Job
|
* - Batch Job
|
||||||
* responses:
|
* responses:
|
||||||
@@ -20,6 +39,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* batch_job:
|
* batch_job:
|
||||||
* $ref: "#/components/schemas/batch_job"
|
* $ref: "#/components/schemas/batch_job"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
let batch_job = req.batch_job
|
let batch_job = req.batch_job
|
||||||
|
|||||||
@@ -46,6 +46,33 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications.
|
* description: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications.
|
||||||
* default: false
|
* default: false
|
||||||
|
* 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.batchJobs.create({
|
||||||
|
* type: 'product-export',
|
||||||
|
* context: {},
|
||||||
|
* dry_run: false
|
||||||
|
* }).then((({ batch_job }) => {
|
||||||
|
* console.log(batch_job.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/batch-jobs' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "type": "product-export",
|
||||||
|
* "context": { }
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Batch Job
|
* - Batch Job
|
||||||
* responses:
|
* responses:
|
||||||
@@ -57,6 +84,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* batch_job:
|
* batch_job:
|
||||||
* $ref: "#/components/schemas/batch_job"
|
* $ref: "#/components/schemas/batch_job"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminPostBatchesReq, req.body)
|
const validated = await validator(AdminPostBatchesReq, req.body)
|
||||||
|
|||||||
@@ -6,6 +6,25 @@
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Batch Job
|
* - (path) id=* {string} The ID of the Batch Job
|
||||||
|
* 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.batchJobs.retrieve(batch_job_id)
|
||||||
|
* .then(({ batch_job }) => {
|
||||||
|
* console.log(batch_job.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/batch-jobs/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Batch Job
|
* - Batch Job
|
||||||
* responses:
|
* responses:
|
||||||
@@ -17,6 +36,18 @@
|
|||||||
* properties:
|
* properties:
|
||||||
* batch_job:
|
* batch_job:
|
||||||
* $ref: "#/components/schemas/batch_job"
|
* $ref: "#/components/schemas/batch_job"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const batch_job = req.batch_job
|
const batch_job = req.batch_job
|
||||||
|
|||||||
@@ -210,6 +210,25 @@ import { isDefined } from "../../../../utils"
|
|||||||
* type: string
|
* type: string
|
||||||
* description: filter by dates greater than or equal to this date
|
* description: filter by dates greater than or equal to this date
|
||||||
* format: date
|
* format: date
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.batchJobs.list()
|
||||||
|
* .then(({ batch_jobs, limit, offset, count }) => {
|
||||||
|
* console.log(batch_jobs.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/batch-jobs' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Batch Job
|
* - Batch Job
|
||||||
* responses:
|
* responses:
|
||||||
@@ -232,6 +251,18 @@ import { isDefined } from "../../../../utils"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res) => {
|
export default async (req: Request, res) => {
|
||||||
const batchService: BatchJobService = req.scope.resolve("batchJobService")
|
const batchService: BatchJobService = req.scope.resolve("batchJobService")
|
||||||
|
|||||||
@@ -25,6 +25,21 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* items:
|
* items:
|
||||||
* description: "The ID of a Product to add to the Product Collection."
|
* description: "The ID of a Product to add to the Product Collection."
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/collections/{id}/products/batch' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "product_ids": [
|
||||||
|
* "prod_01G1G5V2MBA328390B5AXJ610F"
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -36,6 +51,18 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* properties:
|
* properties:
|
||||||
* collection:
|
* collection:
|
||||||
* $ref: "#/components/schemas/product_collection"
|
* $ref: "#/components/schemas/product_collection"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -25,6 +25,31 @@ import { EntityManager } from "typeorm"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.collections.create({
|
||||||
|
* title: 'New Collection'
|
||||||
|
* })
|
||||||
|
* .then(({ collection }) => {
|
||||||
|
* console.log(collection.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/collections' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "title": "New Collection"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -36,6 +61,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* collection:
|
* collection:
|
||||||
* $ref: "#/components/schemas/product_collection"
|
* $ref: "#/components/schemas/product_collection"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { validatedBody } = req as { validatedBody: AdminPostCollectionsReq }
|
const { validatedBody } = req as { validatedBody: AdminPostCollectionsReq }
|
||||||
|
|||||||
@@ -11,6 +11,25 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Collection.
|
* - (path) id=* {string} The ID of the Collection.
|
||||||
|
* 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.collections.delete(collection_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/collections/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -31,6 +50,18 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether the collection was deleted successfully or not.
|
* description: Whether the collection was deleted successfully or not.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -10,6 +10,25 @@ import { defaultAdminCollectionsRelations } from "."
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Product Collection
|
* - (path) id=* {string} The ID of the Product Collection
|
||||||
|
* 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.collections.retrieve(collection_id)
|
||||||
|
* .then(({ collection }) => {
|
||||||
|
* console.log(collection.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/collections/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -21,6 +40,18 @@ import { defaultAdminCollectionsRelations } from "."
|
|||||||
* properties:
|
* properties:
|
||||||
* collection:
|
* collection:
|
||||||
* $ref: "#/components/schemas/product_collection"
|
* $ref: "#/components/schemas/product_collection"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -84,6 +84,25 @@ import { Type } from "class-transformer"
|
|||||||
* type: string
|
* type: string
|
||||||
* description: filter by dates greater than or equal to this date
|
* description: filter by dates greater than or equal to this date
|
||||||
* format: date
|
* format: date
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.collections.list()
|
||||||
|
* .then(({ collections, limit, offset, count }) => {
|
||||||
|
* console.log(collections.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/collections' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -106,6 +125,18 @@ import { Type } from "class-transformer"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const productCollectionService: ProductCollectionService = req.scope.resolve(
|
const productCollectionService: ProductCollectionService = req.scope.resolve(
|
||||||
|
|||||||
@@ -25,6 +25,21 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* items:
|
* items:
|
||||||
* description: "The ID of a Product to add to the Product Collection."
|
* description: "The ID of a Product to add to the Product Collection."
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/collections/{id}/products/batch' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "product_ids": [
|
||||||
|
* "prod_01G1G5V2MBA328390B5AXJ610F"
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -47,6 +62,18 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* items:
|
* items:
|
||||||
* description: "The ID of a Product to add to the Product Collection."
|
* description: "The ID of a Product to add to the Product Collection."
|
||||||
* type: string
|
* type: string
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -25,6 +25,31 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.collections.update(collection_id, {
|
||||||
|
* title: 'New Collection'
|
||||||
|
* })
|
||||||
|
* .then(({ collection }) => {
|
||||||
|
* console.log(collection.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/collections/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "title": "New Collection"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Collection
|
* - Collection
|
||||||
* responses:
|
* responses:
|
||||||
@@ -36,6 +61,18 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* properties:
|
* properties:
|
||||||
* collection:
|
* collection:
|
||||||
* $ref: "#/components/schemas/product_collection"
|
* $ref: "#/components/schemas/product_collection"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -32,6 +32,39 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* id:
|
* id:
|
||||||
* description: ID of the customer
|
* description: ID of the customer
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.addCustomers(customer_group_id, {
|
||||||
|
* customer_ids: [
|
||||||
|
* {
|
||||||
|
* id: customer_id
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ customer_group }) => {
|
||||||
|
* console.log(customer_group.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/customer-groups/{id}/customers/batch' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "customer_ids": [
|
||||||
|
* {
|
||||||
|
* "id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2"
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -43,6 +76,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer_group:
|
* customer_group:
|
||||||
* $ref: "#/components/schemas/customer_group"
|
* $ref: "#/components/schemas/customer_group"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -14,6 +14,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (body) name=* {string} Name of the customer group
|
* - (body) name=* {string} Name of the customer group
|
||||||
* - (body) metadata {object} Metadata for the customer.
|
* - (body) metadata {object} Metadata for the customer.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.create({
|
||||||
|
* name: 'VIP'
|
||||||
|
* })
|
||||||
|
* .then(({ customer_group }) => {
|
||||||
|
* console.log(customer_group.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/customer-groups' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "name": "VIP"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -25,6 +50,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer_group:
|
* customer_group:
|
||||||
* $ref: "#/components/schemas/customer_group"
|
* $ref: "#/components/schemas/customer_group"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -11,6 +11,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Customer Group
|
* - (path) id=* {string} The ID of the Customer Group
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.delete(customer_group_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/customer-groups/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -31,6 +50,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether the customer group was deleted successfully or not.
|
* description: Whether the customer group was deleted successfully or not.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -32,6 +32,39 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* id:
|
* id:
|
||||||
* description: ID of the customer
|
* description: ID of the customer
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.removeCustomers(customer_group_id, {
|
||||||
|
* customer_ids: [
|
||||||
|
* {
|
||||||
|
* id: customer_id
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ customer_group }) => {
|
||||||
|
* console.log(customer_group.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/customer-groups/{id}/customers/batch' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "customer_ids": [
|
||||||
|
* {
|
||||||
|
* "id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2"
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -43,6 +76,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer_group:
|
* customer_group:
|
||||||
* $ref: "#/components/schemas/customer_group"
|
* $ref: "#/components/schemas/customer_group"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -10,6 +10,25 @@ import CustomerController from "../../../../controllers/customers"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the customer group.
|
* - (path) id=* {string} The ID of the customer group.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.listCustomers(customer_group_id)
|
||||||
|
* .then(({ customers }) => {
|
||||||
|
* console.log(customers.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/customer-groups/{id}/customers' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -32,6 +51,18 @@ import CustomerController from "../../../../controllers/customers"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ import { FindParams } from "../../../../types/common"
|
|||||||
* - (path) id=* {string} The ID of the Customer Group.
|
* - (path) id=* {string} The ID of the Customer Group.
|
||||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in the customer group.
|
* - (query) expand {string} (Comma separated) Which fields should be expanded in the customer group.
|
||||||
* - (query) fields {string} (Comma separated) Which fields should be included in the customer group.
|
* - (query) fields {string} (Comma separated) Which fields should be included in the customer group.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.retrieve(customer_group_id)
|
||||||
|
* .then(({ customer_group }) => {
|
||||||
|
* console.log(customer_group.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/customer-groups/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -24,6 +43,18 @@ import { FindParams } from "../../../../types/common"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer_group:
|
* customer_group:
|
||||||
* $ref: "#/components/schemas/customer_group"
|
* $ref: "#/components/schemas/customer_group"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -99,7 +99,25 @@ import { Type } from "class-transformer"
|
|||||||
* format: date
|
* format: date
|
||||||
* - (query) limit=10 {integer} Limit the number of customer groups returned.
|
* - (query) limit=10 {integer} Limit the number of customer groups returned.
|
||||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer groups of the result.
|
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer groups of the result.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.list()
|
||||||
|
* .then(({ customer_groups, limit, offset, count }) => {
|
||||||
|
* console.log(customer_groups.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/customer-groups' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -122,6 +140,18 @@ import { Type } from "class-transformer"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const customerGroupService: CustomerGroupService = req.scope.resolve(
|
const customerGroupService: CustomerGroupService = req.scope.resolve(
|
||||||
|
|||||||
@@ -26,6 +26,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: "Metadata for the customer."
|
* description: "Metadata for the customer."
|
||||||
* type: object
|
* type: object
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customerGroups.update(customer_group_id, {
|
||||||
|
* name: 'VIP'
|
||||||
|
* })
|
||||||
|
* .then(({ customer_group }) => {
|
||||||
|
* console.log(customer_group.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/customer-groups/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "name": "VIP"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer Group
|
* - Customer Group
|
||||||
* responses:
|
* responses:
|
||||||
@@ -37,6 +62,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer_group:
|
* customer_group:
|
||||||
* $ref: "#/components/schemas/customer_group"
|
* $ref: "#/components/schemas/customer_group"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -42,6 +42,37 @@ import { EntityManager } from "typeorm"
|
|||||||
* type: object
|
* type: object
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer
|
* - Customer
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customers.create({
|
||||||
|
* email: 'user@example.com',
|
||||||
|
* first_name: 'Caterina',
|
||||||
|
* last_name: 'Yost',
|
||||||
|
* password: 'supersecret'
|
||||||
|
* })
|
||||||
|
* .then(({ customer }) => {
|
||||||
|
* console.log(customer.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/customers' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "email": "user@example.com",
|
||||||
|
* "first_name": "Caterina",
|
||||||
|
* "last_name": "Yost",
|
||||||
|
* "password": "supersecret"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* responses:
|
* responses:
|
||||||
* 201:
|
* 201:
|
||||||
* description: OK
|
* description: OK
|
||||||
@@ -51,6 +82,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer:
|
* customer:
|
||||||
* $ref: "#/components/schemas/customer"
|
* $ref: "#/components/schemas/customer"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminPostCustomersReq, req.body)
|
const validated = await validator(AdminPostCustomersReq, req.body)
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (path) id=* {string} The ID of the Customer.
|
* - (path) id=* {string} The ID of the Customer.
|
||||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in the customer.
|
* - (query) expand {string} (Comma separated) Which fields should be expanded in the customer.
|
||||||
* - (query) fields {string} (Comma separated) Which fields should be included in the customer.
|
* - (query) fields {string} (Comma separated) Which fields should be included in the customer.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customers.retrieve(customer_id)
|
||||||
|
* .then(({ customer }) => {
|
||||||
|
* console.log(customer.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/customers/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer
|
* - Customer
|
||||||
* responses:
|
* responses:
|
||||||
@@ -24,6 +43,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer:
|
* customer:
|
||||||
* $ref: "#/components/schemas/customer"
|
* $ref: "#/components/schemas/customer"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -16,6 +16,25 @@ import customerController from "../../../../controllers/customers"
|
|||||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer.
|
* - (query) expand {string} (Comma separated) Which fields should be expanded in each customer.
|
||||||
* - (query) q {string} a search term to search email, first_name, and last_name.
|
* - (query) q {string} a search term to search email, first_name, and last_name.
|
||||||
* - (query) groups[] {string} group IDs to search customers by.
|
* - (query) groups[] {string} group IDs to search customers by.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customers.list()
|
||||||
|
* .then(({ customers, limit, offset, count }) => {
|
||||||
|
* console.log(customers.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/customers' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer
|
* - Customer
|
||||||
* responses:
|
* responses:
|
||||||
@@ -38,6 +57,18 @@ import customerController from "../../../../controllers/customers"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const result = await customerController.listAndCount(
|
const result = await customerController.listAndCount(
|
||||||
|
|||||||
@@ -60,6 +60,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.customers.update(customer_id, {
|
||||||
|
* first_name: 'Dolly'
|
||||||
|
* })
|
||||||
|
* .then(({ customer }) => {
|
||||||
|
* console.log(customer.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/customers/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "first_name": "Dolly"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Customer
|
* - Customer
|
||||||
* responses:
|
* responses:
|
||||||
@@ -71,6 +96,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* customer:
|
* customer:
|
||||||
* $ref: "#/components/schemas/customer"
|
* $ref: "#/components/schemas/customer"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Discount.
|
* - (path) id=* {string} The ID of the Discount.
|
||||||
* - (path) region_id=* {string} The ID of the Region.
|
* - (path) region_id=* {string} The ID of the Region.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.addRegion(discount_id, region_id)
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -24,6 +43,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id, region_id } = req.params
|
const { discount_id, region_id } = req.params
|
||||||
|
|||||||
@@ -55,7 +55,32 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||||
* items:
|
* items:
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* import { DiscountConditionOperator } from "@medusajs/medusa"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.createCondition(discount_id, {
|
||||||
|
* operator: DiscountConditionOperator.IN
|
||||||
|
* })
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}/conditions' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "operator": "in"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount Condition
|
* - Discount Condition
|
||||||
* responses:
|
* responses:
|
||||||
@@ -67,6 +92,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id } = req.params
|
const { discount_id } = req.params
|
||||||
|
|||||||
@@ -139,6 +139,44 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* import { AllocationType, DiscountRuleType } from "@medusajs/medusa"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.create({
|
||||||
|
* code: 'TEST',
|
||||||
|
* rule: {
|
||||||
|
* type: DiscountRuleType.FIXED,
|
||||||
|
* value: 10,
|
||||||
|
* allocation: AllocationType.ITEM
|
||||||
|
* },
|
||||||
|
* is_dynamic: false,
|
||||||
|
* is_disabled: false
|
||||||
|
* })
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/discounts' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "code": "TEST",
|
||||||
|
* "rule": {
|
||||||
|
* "type": "fixed",
|
||||||
|
* "value": 10,
|
||||||
|
* "allocation": "item"
|
||||||
|
* }
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -150,6 +188,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -22,6 +22,32 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (body) code=* {string} The unique code that will be used to redeem the Discount.
|
* - (body) code=* {string} The unique code that will be used to redeem the Discount.
|
||||||
* - (body) usage_limit=1 {number} amount of times the discount can be applied.
|
* - (body) usage_limit=1 {number} amount of times the discount can be applied.
|
||||||
* - (body) metadata {object} An optional set of key-value paris to hold additional information.
|
* - (body) metadata {object} An optional set of key-value paris to hold additional information.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.createDynamicCode(discount_id, {
|
||||||
|
* code: 'TEST',
|
||||||
|
* usage_limit: 1
|
||||||
|
* })
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "code": "TEST"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -33,6 +59,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id } = req.params
|
const { discount_id } = req.params
|
||||||
|
|||||||
@@ -20,6 +20,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (path) condition_id=* {string} The ID of the DiscountCondition
|
* - (path) condition_id=* {string} The ID of the DiscountCondition
|
||||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||||
* - (query) fields {string} Comma separated list of fields to include in the results.
|
* - (query) fields {string} Comma separated list of fields to include in the results.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.deleteCondition(discount_id, condition_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount Condition
|
* - Discount Condition
|
||||||
* responses:
|
* responses:
|
||||||
@@ -43,6 +62,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* discount:
|
* discount:
|
||||||
* description: The Discount to which the condition used to belong
|
* description: The Discount to which the condition used to belong
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id, condition_id } = req.params
|
const { discount_id, condition_id } = req.params
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Discount
|
* - (path) id=* {string} The ID of the Discount
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.delete(discount_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -29,6 +48,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether the discount was deleted successfully or not.
|
* description: Whether the discount was deleted successfully or not.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id } = req.params
|
const { discount_id } = req.params
|
||||||
|
|||||||
@@ -12,6 +12,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Discount
|
* - (path) id=* {string} The ID of the Discount
|
||||||
* - (path) code=* {string} The ID of the Discount
|
* - (path) code=* {string} The ID of the Discount
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.deleteDynamicCode(discount_id, code)
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/dynamic-codes/{code}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -23,6 +42,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id, code } = req.params
|
const { discount_id, code } = req.params
|
||||||
|
|||||||
@@ -15,14 +15,32 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* @oas [get] /discounts/{discount_id}/conditions/{condition_id}
|
* @oas [get] /discounts/{discount_id}/conditions/{condition_id}
|
||||||
* operationId: "GetDiscountsDiscountConditionsCondition"
|
* operationId: "GetDiscountsDiscountConditionsCondition"
|
||||||
* summary: "Gets a DiscountCondition"
|
* summary: "Gets a DiscountCondition"
|
||||||
|
* description: "Gets a DiscountCondition"
|
||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) discount_id=* {string} The ID of the Discount.
|
* - (path) discount_id=* {string} The ID of the Discount.
|
||||||
* - (path) condition_id=* {string} The ID of the DiscountCondition.
|
* - (path) condition_id=* {string} The ID of the DiscountCondition.
|
||||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||||
* - (query) fields {string} Comma separated list of fields to include in the results.
|
* - (query) fields {string} Comma separated list of fields to include in the results.
|
||||||
* description: "Gets a DiscountCondition"
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.getCondition(discount_id, condition_id)
|
||||||
|
* .then(({ discount_condition }) => {
|
||||||
|
* console.log(discount_condition.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount Condition
|
* - Discount Condition
|
||||||
* responses:
|
* responses:
|
||||||
@@ -34,6 +52,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount_condition:
|
* discount_condition:
|
||||||
* $ref: "#/components/schemas/discount_condition"
|
* $ref: "#/components/schemas/discount_condition"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -15,6 +15,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (path) code=* {string} The code of the Discount
|
* - (path) code=* {string} The code of the Discount
|
||||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||||
* - (query) fields {string} Comma separated list of fields to include in the results.
|
* - (query) fields {string} Comma separated list of fields to include in the results.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.retrieveByCode(code)
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/discounts/code/{code}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -26,6 +45,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { code } = req.params
|
const { code } = req.params
|
||||||
|
|||||||
@@ -15,6 +15,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (path) id=* {string} The ID of the Discount
|
* - (path) id=* {string} The ID of the Discount
|
||||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||||
* - (query) fields {string} Comma separated list of fields to include in the results.
|
* - (query) fields {string} Comma separated list of fields to include in the results.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.retrieve(discount_id)
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/discounts/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -26,6 +45,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id } = req.params
|
const { discount_id } = req.params
|
||||||
|
|||||||
@@ -43,6 +43,25 @@ import { isDefined } from "../../../../utils"
|
|||||||
* - (query) limit=20 {number} The number of items in the response
|
* - (query) limit=20 {number} The number of items in the response
|
||||||
* - (query) offset=0 {number} The offset of items in response
|
* - (query) offset=0 {number} The offset of items in response
|
||||||
* - (query) expand {string} Comma separated list of relations to include in the results.
|
* - (query) expand {string} Comma separated list of relations to include in the results.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.list()
|
||||||
|
* .then(({ discounts, limit, offset, count }) => {
|
||||||
|
* console.log(discounts.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/discounts' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -65,6 +84,18 @@ import { isDefined } from "../../../../utils"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminGetDiscountsParams, req.query)
|
const validated = await validator(AdminGetDiscountsParams, req.query)
|
||||||
|
|||||||
@@ -12,6 +12,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Discount.
|
* - (path) id=* {string} The ID of the Discount.
|
||||||
* - (path) region_id=* {string} The ID of the Region.
|
* - (path) region_id=* {string} The ID of the Region.
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.removeRegion(discount_id, region_id)
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -23,6 +42,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id, region_id } = req.params
|
const { discount_id, region_id } = req.params
|
||||||
|
|||||||
@@ -50,6 +50,35 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* description: list of customer group IDs if the condition is applied on customer groups.
|
* description: list of customer group IDs if the condition is applied on customer groups.
|
||||||
* items:
|
* items:
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.updateCondition(discount_id, condition_id, {
|
||||||
|
* products: [
|
||||||
|
* product_id
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "products": [
|
||||||
|
* "prod_01G1G5V2MBA328390B5AXJ610F"
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -61,6 +90,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -127,6 +127,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An object containing metadata of the discount
|
* description: An object containing metadata of the discount
|
||||||
* type: object
|
* type: object
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.discounts.update(discount_id, {
|
||||||
|
* code: 'TEST'
|
||||||
|
* })
|
||||||
|
* .then(({ discount }) => {
|
||||||
|
* console.log(discount.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "code": "TEST"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Discount
|
* - Discount
|
||||||
* responses:
|
* responses:
|
||||||
@@ -138,6 +163,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* discount:
|
* discount:
|
||||||
* $ref: "#/components/schemas/discount"
|
* $ref: "#/components/schemas/discount"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { discount_id } = req.params
|
const { discount_id } = req.params
|
||||||
|
|||||||
@@ -116,6 +116,53 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: The optional key-value map with additional details about the Draft Order.
|
* description: The optional key-value map with additional details about the Draft Order.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.draftOrders.create({
|
||||||
|
* email: 'user@example.com',
|
||||||
|
* region_id,
|
||||||
|
* items: [
|
||||||
|
* {
|
||||||
|
* quantity: 1
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* shipping_methods: [
|
||||||
|
* {
|
||||||
|
* option_id
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* })
|
||||||
|
* .then(({ draft_order }) => {
|
||||||
|
* console.log(draft_order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/draft-orders' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "email": "user@example.com",
|
||||||
|
* "region_id": "{region_id}"
|
||||||
|
* "items": [
|
||||||
|
* {
|
||||||
|
* "quantity": 1
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* "shipping_methods": [
|
||||||
|
* {
|
||||||
|
* "option_id": "{option_id}"
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -127,6 +174,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* draft_order:
|
* draft_order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -52,6 +52,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: The optional key-value map with additional details about the Line Item.
|
* description: The optional key-value map with additional details about the Line Item.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.draftOrders.addLineItem(draft_order_id, {
|
||||||
|
* quantity: 1
|
||||||
|
* })
|
||||||
|
* .then(({ draft_order }) => {
|
||||||
|
* console.log(draft_order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/draft-orders/{id}/line-items' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "quantity": 1
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -63,6 +88,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* draft_order:
|
* draft_order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Draft Order.
|
* - (path) id=* {string} The ID of the Draft Order.
|
||||||
|
* 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.draftOrders.delete(draft_order_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/draft-orders/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -28,6 +47,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether the draft order was deleted successfully or not.
|
* description: Whether the draft order was deleted successfully or not.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -18,6 +18,25 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Draft Order.
|
* - (path) id=* {string} The ID of the Draft Order.
|
||||||
* - (path) line_id=* {string} The ID of the Draft Order.
|
* - (path) line_id=* {string} The ID of the Draft Order.
|
||||||
|
* 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.draftOrders.removeLineItem(draft_order_id, item_id)
|
||||||
|
* .then(({ draft_order }) => {
|
||||||
|
* console.log(draft_order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -29,6 +48,18 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* properties:
|
* properties:
|
||||||
* draft_order:
|
* draft_order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -16,6 +16,25 @@ import { DraftOrder } from "../../../.."
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Draft Order.
|
* - (path) id=* {string} The ID of the Draft Order.
|
||||||
|
* 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.draftOrders.retrieve(draft_order_id)
|
||||||
|
* .then(({ draft_order }) => {
|
||||||
|
* console.log(draft_order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/draft-orders/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -27,6 +46,18 @@ import { DraftOrder } from "../../../.."
|
|||||||
* properties:
|
* properties:
|
||||||
* draft_order:
|
* draft_order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -21,6 +21,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (query) offset=0 {number} The number of items to skip before the results.
|
* - (query) offset=0 {number} The number of items to skip before the results.
|
||||||
* - (query) limit=50 {number} Limit the number of items returned.
|
* - (query) limit=50 {number} Limit the number of items returned.
|
||||||
* - (query) q {string} a search term to search emails in carts associated with draft orders and display IDs of draft orders
|
* - (query) q {string} a search term to search emails in carts associated with draft orders and display IDs of draft orders
|
||||||
|
* 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.draftOrders.list()
|
||||||
|
* .then(({ draft_orders, limit, offset, count }) => {
|
||||||
|
* console.log(draft_orders.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/draft-orders' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -43,6 +62,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -19,6 +19,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {String} The Draft Order id.
|
* - (path) id=* {String} The Draft Order id.
|
||||||
|
* 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.draftOrders.markPaid(draft_order_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/draft-orders/{id}/pay' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -30,6 +49,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -68,6 +68,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* customer_id:
|
* customer_id:
|
||||||
* description: "The ID of the Customer to associate the Draft Order with."
|
* description: "The ID of the Customer to associate the Draft Order with."
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.draftOrders.update(draft_order_id, {
|
||||||
|
* email: "user@example.com"
|
||||||
|
* })
|
||||||
|
* .then(({ draft_order }) => {
|
||||||
|
* console.log(draft_order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/draft-orders/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "email": "user@example.com"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -79,6 +104,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* draft_order:
|
* draft_order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -38,6 +38,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: The optional key-value map with additional details about the Line Item.
|
* description: The optional key-value map with additional details about the Line Item.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.draftOrders.updateLineItem(draft_order_id, line_id, {
|
||||||
|
* quantity: 1
|
||||||
|
* })
|
||||||
|
* .then(({ draft_order }) => {
|
||||||
|
* console.log(draft_order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "quantity": 1
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Draft Order
|
* - Draft Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -49,6 +74,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* draft_order:
|
* draft_order:
|
||||||
* $ref: "#/components/schemas/draft-order"
|
* $ref: "#/components/schemas/draft-order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -35,6 +35,31 @@ import { EntityManager } from "typeorm"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.giftCards.create({
|
||||||
|
* region_id
|
||||||
|
* })
|
||||||
|
* .then(({ gift_card }) => {
|
||||||
|
* console.log(gift_card.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/gift-cards' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "region_id": "{region_id}"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Gift Card
|
* - Gift Card
|
||||||
* responses:
|
* responses:
|
||||||
@@ -46,6 +71,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* gift_card:
|
* gift_card:
|
||||||
* $ref: "#/components/schemas/gift_card"
|
* $ref: "#/components/schemas/gift_card"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminPostGiftCardsReq, req.body)
|
const validated = await validator(AdminPostGiftCardsReq, req.body)
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Gift Card to delete.
|
* - (path) id=* {string} The ID of the Gift Card to delete.
|
||||||
|
* 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.giftCards.delete(gift_card_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/gift-cards/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Gift Card
|
* - Gift Card
|
||||||
* responses:
|
* responses:
|
||||||
@@ -28,6 +47,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether the gift card was deleted successfully or not.
|
* description: Whether the gift card was deleted successfully or not.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "./"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Gift Card.
|
* - (path) id=* {string} The ID of the Gift Card.
|
||||||
|
* 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.giftCards.retrieve(gift_card_id)
|
||||||
|
* .then(({ gift_card }) => {
|
||||||
|
* console.log(gift_card.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/gift-cards/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Gift Card
|
* - Gift Card
|
||||||
* responses:
|
* responses:
|
||||||
@@ -19,6 +38,18 @@ import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "./"
|
|||||||
* properties:
|
* properties:
|
||||||
* gift_card:
|
* gift_card:
|
||||||
* $ref: "#/components/schemas/gift_card"
|
* $ref: "#/components/schemas/gift_card"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -16,6 +16,25 @@ import { isDefined } from "../../../../utils"
|
|||||||
* - (query) offset=0 {number} The number of items to skip before the results.
|
* - (query) offset=0 {number} The number of items to skip before the results.
|
||||||
* - (query) limit=50 {number} Limit the number of items returned.
|
* - (query) limit=50 {number} Limit the number of items returned.
|
||||||
* - (query) q {string} a search term to search by code or display ID
|
* - (query) q {string} a search term to search by code or display ID
|
||||||
|
* 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.giftCards.list()
|
||||||
|
* .then(({ gift_cards, limit, offset, count }) => {
|
||||||
|
* console.log(gift_cards.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/gift-cards' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Gift Card
|
* - Gift Card
|
||||||
* responses:
|
* responses:
|
||||||
@@ -38,6 +57,18 @@ import { isDefined } from "../../../../utils"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminGetGiftCardsParams, req.query)
|
const validated = await validator(AdminGetGiftCardsParams, req.query)
|
||||||
|
|||||||
@@ -35,6 +35,31 @@ import { EntityManager } from "typeorm"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.giftCards.update(gift_card_id, {
|
||||||
|
* region_id
|
||||||
|
* })
|
||||||
|
* .then(({ gift_card }) => {
|
||||||
|
* console.log(gift_card.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/gift-cards/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "region_id": "{region_id}"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Gift Card
|
* - Gift Card
|
||||||
* responses:
|
* responses:
|
||||||
@@ -46,6 +71,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* gift_card:
|
* gift_card:
|
||||||
* $ref: "#/components/schemas/gift_card"
|
* $ref: "#/components/schemas/gift_card"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -39,11 +39,61 @@ import { EntityManager } from "typeorm"
|
|||||||
* description: The desired password for the User
|
* description: The desired password for the User
|
||||||
* type: string
|
* type: string
|
||||||
* format: password
|
* format: 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 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.invites.accept({
|
||||||
|
* token,
|
||||||
|
* user: {
|
||||||
|
* first_name: 'Brigitte',
|
||||||
|
* last_name: 'Collier',
|
||||||
|
* password: 'supersecret'
|
||||||
|
* }
|
||||||
|
* })
|
||||||
|
* .then(() => {
|
||||||
|
* // successful
|
||||||
|
* })
|
||||||
|
* .catch(() => {
|
||||||
|
* // an error occurred
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/invites/accept' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "token": "{token}",
|
||||||
|
* "user": {
|
||||||
|
* "first_name": "Brigitte",
|
||||||
|
* "last_name": "Collier",
|
||||||
|
* "password": "supersecret"
|
||||||
|
* }
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Invite
|
* - Invite
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* 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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminPostInvitesInviteAcceptReq, req.body)
|
const validated = await validator(AdminPostInvitesInviteAcceptReq, req.body)
|
||||||
|
|||||||
@@ -27,11 +27,53 @@ import { EntityManager } from "typeorm"
|
|||||||
* description: "The role of the user to be created."
|
* description: "The role of the user to be created."
|
||||||
* type: string
|
* type: string
|
||||||
* enum: [admin, member, developer]
|
* enum: [admin, member, developer]
|
||||||
|
* 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.invites.create({
|
||||||
|
* user: "user@example.com",
|
||||||
|
* role: "admin"
|
||||||
|
* })
|
||||||
|
* .then(() => {
|
||||||
|
* // successful
|
||||||
|
* })
|
||||||
|
* .catch(() => {
|
||||||
|
* // an error occurred
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/invites' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "user": "user@example.com",
|
||||||
|
* "role": "admin"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Invite
|
* - Invite
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* 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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminPostInvitesReq, req.body)
|
const validated = await validator(AdminPostInvitesReq, req.body)
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import InviteService from "../../../../services/invite"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) invite_id=* {string} The ID of the Invite
|
* - (path) invite_id=* {string} The ID of the Invite
|
||||||
|
* 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.invites.delete(invite_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/invites/{invite_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Invite
|
* - Invite
|
||||||
* responses:
|
* responses:
|
||||||
@@ -29,6 +48,18 @@ import InviteService from "../../../../services/invite"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether or not the Invite was deleted.
|
* description: Whether or not the Invite was deleted.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { invite_id } = req.params
|
const { invite_id } = req.params
|
||||||
|
|||||||
@@ -6,6 +6,25 @@ import InviteService from "../../../../services/invite"
|
|||||||
* summary: "Lists all Invites"
|
* summary: "Lists all Invites"
|
||||||
* description: "Lists all Invites"
|
* description: "Lists all Invites"
|
||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
|
* 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.invites.list()
|
||||||
|
* .then(({ invites }) => {
|
||||||
|
* console.log(invites.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/invites' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Invite
|
* - Invite
|
||||||
* responses:
|
* responses:
|
||||||
@@ -19,6 +38,18 @@ import InviteService from "../../../../services/invite"
|
|||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* $ref: "#/components/schemas/invite"
|
* $ref: "#/components/schemas/invite"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const inviteService: InviteService = req.scope.resolve("inviteService")
|
const inviteService: InviteService = req.scope.resolve("inviteService")
|
||||||
|
|||||||
@@ -9,11 +9,45 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) invite_id=* {string} The ID of the Invite
|
* - (path) invite_id=* {string} The ID of the Invite
|
||||||
|
* 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.invites.resend(invite_id)
|
||||||
|
* .then(() => {
|
||||||
|
* // successful
|
||||||
|
* })
|
||||||
|
* .catch(() => {
|
||||||
|
* // an error occurred
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/invites/{invite_id}/resend' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Invite
|
* - Invite
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* 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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { invite_id } = req.params
|
const { invite_id } = req.params
|
||||||
|
|||||||
@@ -28,6 +28,35 @@ import { EntityManager } from "typeorm"
|
|||||||
* value:
|
* value:
|
||||||
* type: string
|
* type: string
|
||||||
* description: The content of the Note to create.
|
* description: The content of the Note to create.
|
||||||
|
* 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.notes.create({
|
||||||
|
* resource_id,
|
||||||
|
* resource_type: 'order',
|
||||||
|
* value: 'We delivered this order'
|
||||||
|
* })
|
||||||
|
* .then(({ note }) => {
|
||||||
|
* console.log(note.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/notes' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "resource_id": "{resource_id}",
|
||||||
|
* "resource_type": "order",
|
||||||
|
* "value": "We delivered this order"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Note
|
* - Note
|
||||||
* responses:
|
* responses:
|
||||||
@@ -39,6 +68,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* note:
|
* note:
|
||||||
* $ref: "#/components/schemas/note"
|
* $ref: "#/components/schemas/note"
|
||||||
|
* "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"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import NoteService from "../../../../services/note"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Note to delete.
|
* - (path) id=* {string} The ID of the Note to delete.
|
||||||
|
* 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.notes.delete(note_id)
|
||||||
|
* .then(({ id, object, deleted }) => {
|
||||||
|
* console.log(id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request DELETE 'https://medusa-url.com/admin/notes/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Note
|
* - Note
|
||||||
* responses:
|
* responses:
|
||||||
@@ -29,6 +48,18 @@ import NoteService from "../../../../services/note"
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* description: Whether or not the Note was deleted.
|
* description: Whether or not the Note was deleted.
|
||||||
* default: true
|
* default: true
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ import NoteService from "../../../../services/note"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the note to retrieve.
|
* - (path) id=* {string} The ID of the note to retrieve.
|
||||||
|
* 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.notes.retrieve(note_id)
|
||||||
|
* .then(({ note }) => {
|
||||||
|
* console.log(note.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/notes/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Note
|
* - Note
|
||||||
* responses:
|
* responses:
|
||||||
@@ -19,6 +38,18 @@ import NoteService from "../../../../services/note"
|
|||||||
* properties:
|
* properties:
|
||||||
* note:
|
* note:
|
||||||
* $ref: "#/components/schemas/note"
|
* $ref: "#/components/schemas/note"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -15,6 +15,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (query) limit=50 {number} The number of notes to get
|
* - (query) limit=50 {number} The number of notes to get
|
||||||
* - (query) offset=0 {number} The offset at which to get notes
|
* - (query) offset=0 {number} The offset at which to get notes
|
||||||
* - (query) resource_id {string} The ID which the notes belongs to
|
* - (query) resource_id {string} The ID which the notes belongs to
|
||||||
|
* 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.notes.list()
|
||||||
|
* .then(({ notes, limit, offset, count }) => {
|
||||||
|
* console.log(notes.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/notes' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Note
|
* - Note
|
||||||
* responses:
|
* responses:
|
||||||
@@ -37,6 +56,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const validated = await validator(AdminGetNotesParams, req.query)
|
const validated = await validator(AdminGetNotesParams, req.query)
|
||||||
|
|||||||
@@ -21,6 +21,31 @@ import { EntityManager } from "typeorm"
|
|||||||
* value:
|
* value:
|
||||||
* type: string
|
* type: string
|
||||||
* description: The updated description of the Note.
|
* description: The updated description of the Note.
|
||||||
|
* 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.notes.update(note_id, {
|
||||||
|
* value: 'We delivered this order'
|
||||||
|
* })
|
||||||
|
* .then(({ note }) => {
|
||||||
|
* console.log(note.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/notes/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "value": "We delivered this order"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Note
|
* - Note
|
||||||
* responses:
|
* responses:
|
||||||
@@ -32,7 +57,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* note:
|
* note:
|
||||||
* $ref: "#/components/schemas/note"
|
* $ref: "#/components/schemas/note"
|
||||||
*
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -27,6 +27,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* - (query) resource_id {string} The ID of the resource that the Notification refers to.
|
* - (query) resource_id {string} The ID of the resource that the Notification refers to.
|
||||||
* - (query) to {string} The address that the Notification was sent to. This will usually be an email address, but represent other addresses such as a chat bot user id
|
* - (query) to {string} The address that the Notification was sent to. This will usually be an email address, but represent other addresses such as a chat bot user id
|
||||||
* - (query) include_resends {string} A boolean indicating whether the result set should include resent notifications or not
|
* - (query) include_resends {string} A boolean indicating whether the result set should include resent notifications or not
|
||||||
|
* 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.notifications.list()
|
||||||
|
* .then(({ notifications }) => {
|
||||||
|
* console.log(notifications.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/notifications' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Notification
|
* - Notification
|
||||||
* responses:
|
* responses:
|
||||||
@@ -40,6 +59,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* $ref: "#/components/schemas/notification"
|
* $ref: "#/components/schemas/notification"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const notificationService: NotificationService = req.scope.resolve(
|
const notificationService: NotificationService = req.scope.resolve(
|
||||||
|
|||||||
@@ -26,6 +26,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* to:
|
* to:
|
||||||
* description: "A new address or user identifier that the Notification should be sent to"
|
* description: "A new address or user identifier that the Notification should be sent to"
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.notifications.resend(notification_id)
|
||||||
|
* .then(({ notification }) => {
|
||||||
|
* console.log(notification.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/notifications/{id}/resend' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Notification
|
* - Notification
|
||||||
* responses:
|
* responses:
|
||||||
@@ -37,6 +56,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* notification:
|
* notification:
|
||||||
* $ref: "#/components/schemas/notification"
|
* $ref: "#/components/schemas/notification"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -22,6 +22,33 @@ import { EntityManager } from "typeorm"
|
|||||||
* - (body) price=* {integer} The price (excluding VAT) that should be charged for the Shipping Method
|
* - (body) price=* {integer} The price (excluding VAT) that should be charged for the Shipping Method
|
||||||
* - (body) option_id=* {string} The ID of the Shipping Option to create the Shipping Method from.
|
* - (body) option_id=* {string} The ID of the Shipping Option to create the Shipping Method from.
|
||||||
* - (body) data {object} The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider.
|
* - (body) data {object} The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider.
|
||||||
|
* 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.orders.addShippingMethod(order_id, {
|
||||||
|
* price: 1000,
|
||||||
|
* option_id
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/shipping-methods' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "price": 1000,
|
||||||
|
* "option_id": "{option_id}"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -33,6 +60,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
|
* 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.orders.archive(order_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/archive' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -20,6 +39,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
* - (path) claim_id=* {string} The ID of the Claim.
|
* - (path) claim_id=* {string} The ID of the Claim.
|
||||||
|
* 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.orders.cancelClaim(order_id, claim_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Claim
|
* - Claim
|
||||||
* responses:
|
* responses:
|
||||||
@@ -24,6 +43,18 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, claim_id } = req.params
|
const { id, claim_id } = req.params
|
||||||
|
|||||||
@@ -18,6 +18,25 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* - (path) id=* {string} The ID of the Order which the Claim relates to.
|
* - (path) id=* {string} The ID of the Order which the Claim relates to.
|
||||||
* - (path) claim_id=* {string} The ID of the Claim which the Fulfillment relates to.
|
* - (path) claim_id=* {string} The ID of the Claim which the Fulfillment relates to.
|
||||||
* - (path) fulfillment_id=* {string} The ID of the Fulfillment.
|
* - (path) fulfillment_id=* {string} The ID of the Fulfillment.
|
||||||
|
* 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.orders.cancelClaimFulfillment(order_id, claim_id, fulfillment_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Fulfillment
|
* - Fulfillment
|
||||||
* responses:
|
* responses:
|
||||||
@@ -29,6 +48,18 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, claim_id, fulfillment_id } = req.params
|
const { id, claim_id, fulfillment_id } = req.params
|
||||||
|
|||||||
@@ -18,6 +18,25 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* - (path) id=* {string} The ID of the Order which the Swap relates to.
|
* - (path) id=* {string} The ID of the Order which the Swap relates to.
|
||||||
* - (path) swap_id=* {string} The ID of the Swap which the Fulfillment relates to.
|
* - (path) swap_id=* {string} The ID of the Swap which the Fulfillment relates to.
|
||||||
* - (path) fulfillment_id=* {string} The ID of the Fulfillment.
|
* - (path) fulfillment_id=* {string} The ID of the Fulfillment.
|
||||||
|
* 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.orders.cancelSwapFulfillment(order_id, swap_id, fulfillment_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Fulfillment
|
* - Fulfillment
|
||||||
* responses:
|
* responses:
|
||||||
@@ -29,6 +48,18 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, swap_id, fulfillment_id } = req.params
|
const { id, swap_id, fulfillment_id } = req.params
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order which the Fulfillment relates to.
|
* - (path) id=* {string} The ID of the Order which the Fulfillment relates to.
|
||||||
* - (path) fulfillment_id=* {string} The ID of the Fulfillment
|
* - (path) fulfillment_id=* {string} The ID of the Fulfillment
|
||||||
|
* 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.orders.cancelFulfillment(order_id, fulfillment_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/fulfillments/{fulfillment_id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Fulfillment
|
* - Fulfillment
|
||||||
* responses:
|
* responses:
|
||||||
@@ -24,6 +43,18 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, fulfillment_id } = req.params
|
const { id, fulfillment_id } = req.params
|
||||||
|
|||||||
@@ -11,6 +11,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
|
* 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.orders.cancel(order_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -22,6 +41,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
* - (path) swap_id=* {string} The ID of the Swap.
|
* - (path) swap_id=* {string} The ID of the Swap.
|
||||||
|
* 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.orders.cancelSwap(order_id, swap_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{order_id}/swaps/{swap_id}/cancel' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Swap
|
* - Swap
|
||||||
* responses:
|
* responses:
|
||||||
@@ -24,6 +43,18 @@ import { MedusaError } from "medusa-core-utils"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, swap_id } = req.params
|
const { id, swap_id } = req.params
|
||||||
|
|||||||
@@ -11,6 +11,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
|
* 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.orders.capturePayment(order_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/capture' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -22,6 +41,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
|
* 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.orders.complete(order_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/complete' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -20,6 +39,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -29,6 +29,31 @@ import { EntityManager } from "typeorm"
|
|||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* type: string
|
* type: string
|
||||||
|
* x-codeSamples:
|
||||||
|
* - lang: JavaScript
|
||||||
|
* label: JS Client
|
||||||
|
* source: |
|
||||||
|
* import Medusa from "@medusajs/medusa-js"
|
||||||
|
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||||
|
* // must be previously logged in or use api token
|
||||||
|
* medusa.admin.orders.createClaimShipment(order_id, claim_id, {
|
||||||
|
* fulfillment_id
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/shipments' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "fulfillment_id": "{fulfillment_id}"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Claim
|
* - Claim
|
||||||
* responses:
|
* responses:
|
||||||
@@ -40,6 +65,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, claim_id } = req.params
|
const { id, claim_id } = req.params
|
||||||
|
|||||||
@@ -126,6 +126,43 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.orders.createClaim(order_id, {
|
||||||
|
* type: 'refund',
|
||||||
|
* claim_items: [
|
||||||
|
* {
|
||||||
|
* item_id,
|
||||||
|
* quantity: 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "type": "refund",
|
||||||
|
* "claim_items": [
|
||||||
|
* {
|
||||||
|
* "item_id": "asdsd",
|
||||||
|
* "quantity": 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Claim
|
* - Claim
|
||||||
* responses:
|
* responses:
|
||||||
@@ -137,6 +174,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
@@ -50,6 +50,41 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.orders.createFulfillment(order_id, {
|
||||||
|
* items: [
|
||||||
|
* {
|
||||||
|
* item_id,
|
||||||
|
* quantity: 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/fulfillment' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "items": [
|
||||||
|
* {
|
||||||
|
* "item_id": "{item_id}",
|
||||||
|
* "quantity": 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Fulfillment
|
* - Fulfillment
|
||||||
* responses:
|
* responses:
|
||||||
@@ -61,6 +96,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -38,6 +38,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* no_notification:
|
* no_notification:
|
||||||
* description: If set to true no notification will be send related to this Shipment.
|
* description: If set to true no notification will be send related to this Shipment.
|
||||||
* type: boolean
|
* type: boolean
|
||||||
|
* 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.orders.createShipment(order_id, {
|
||||||
|
* fulfillment_id
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/shipment' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "fulfillment_id": "{fulfillment_id}"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -49,6 +74,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -38,6 +38,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* no_notification:
|
* no_notification:
|
||||||
* description: If set to true no notification will be send related to this Claim.
|
* description: If set to true no notification will be send related to this Claim.
|
||||||
* type: boolean
|
* type: boolean
|
||||||
|
* 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.orders.createSwapShipment(order_id, swap_id, {
|
||||||
|
* fulfillment_id
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/shipments' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "fulfillment_id": "{fulfillment_id}"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Swap
|
* - Swap
|
||||||
* responses:
|
* responses:
|
||||||
@@ -49,6 +74,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, swap_id } = req.params
|
const { id, swap_id } = req.params
|
||||||
|
|||||||
@@ -105,6 +105,41 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* description: If true, swaps can be completed with items out of stock
|
* description: If true, swaps can be completed with items out of stock
|
||||||
* type: boolean
|
* type: boolean
|
||||||
* default: true
|
* default: true
|
||||||
|
* 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.orders.createSwap(order_id, {
|
||||||
|
* return_items: [
|
||||||
|
* {
|
||||||
|
* item_id,
|
||||||
|
* quantity: 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "return_items": [
|
||||||
|
* {
|
||||||
|
* "item_id": "asfasf",
|
||||||
|
* "quantity": 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Swap
|
* - Swap
|
||||||
* responses:
|
* responses:
|
||||||
@@ -116,6 +151,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -25,6 +25,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* no_notification:
|
* no_notification:
|
||||||
* description: If set to true no notification will be send related to this Claim.
|
* description: If set to true no notification will be send related to this Claim.
|
||||||
* type: boolean
|
* type: boolean
|
||||||
|
* 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.orders.fulfillClaim(order_id, claim_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Fulfillment
|
* - Fulfillment
|
||||||
* responses:
|
* responses:
|
||||||
@@ -36,6 +55,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, claim_id } = req.params
|
const { id, claim_id } = req.params
|
||||||
|
|||||||
@@ -25,6 +25,25 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* no_notification:
|
* no_notification:
|
||||||
* description: If set to true no notification will be send related to this Claim.
|
* description: If set to true no notification will be send related to this Claim.
|
||||||
* type: boolean
|
* type: boolean
|
||||||
|
* 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.orders.fulfillSwap(order_id, swap_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Fulfillment
|
* - Fulfillment
|
||||||
* responses:
|
* responses:
|
||||||
@@ -36,6 +55,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, swap_id } = req.params
|
const { id, swap_id } = req.params
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ import { OrderService } from "../../../../services"
|
|||||||
* x-authenticated: true
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
|
* 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.orders.retrieve(order_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/orders/{id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -19,6 +38,18 @@ import { OrderService } from "../../../../services"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -153,6 +153,25 @@ import { pick } from "lodash"
|
|||||||
* - (query) limit=50 {integer} Limit the number of orders returned.
|
* - (query) limit=50 {integer} Limit the number of orders returned.
|
||||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each order of the result.
|
* - (query) expand {string} (Comma separated) Which fields should be expanded in each order of the result.
|
||||||
* - (query) fields {string} (Comma separated) Which fields should be included in each order of the result.
|
* - (query) fields {string} (Comma separated) Which fields should be included in each order of the result.
|
||||||
|
* 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.orders.list()
|
||||||
|
* .then(({ orders, limit, offset, count }) => {
|
||||||
|
* console.log(orders.length);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request GET 'https://medusa-url.com/admin/orders' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -175,6 +194,18 @@ import { pick } from "lodash"
|
|||||||
* limit:
|
* limit:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The number of items per page
|
* description: The number of items per page
|
||||||
|
* "400":
|
||||||
|
* $ref: "#/components/responses/400_error"
|
||||||
|
* "401":
|
||||||
|
* $ref: "#/components/responses/unauthorized"
|
||||||
|
* "404":
|
||||||
|
* $ref: "#/components/responses/not_found_error"
|
||||||
|
* "409":
|
||||||
|
* $ref: "#/components/responses/invalid_state_error"
|
||||||
|
* "422":
|
||||||
|
* $ref: "#/components/responses/invalid_request_error"
|
||||||
|
* "500":
|
||||||
|
* $ref: "#/components/responses/500_error"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const orderService: OrderService = req.scope.resolve("orderService")
|
const orderService: OrderService = req.scope.resolve("orderService")
|
||||||
|
|||||||
@@ -12,6 +12,25 @@ import { EntityManager } from "typeorm"
|
|||||||
* parameters:
|
* parameters:
|
||||||
* - (path) id=* {string} The ID of the Order.
|
* - (path) id=* {string} The ID of the Order.
|
||||||
* - (path) swap_id=* {string} The ID of the Swap.
|
* - (path) swap_id=* {string} The ID of the Swap.
|
||||||
|
* 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.orders.processSwapPayment(order_id, swap_id)
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/process-payment' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Swap
|
* - Swap
|
||||||
* responses:
|
* responses:
|
||||||
@@ -23,6 +42,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, swap_id } = req.params
|
const { id, swap_id } = req.params
|
||||||
|
|||||||
@@ -39,6 +39,33 @@ import { EntityManager } from "typeorm"
|
|||||||
* no_notification:
|
* no_notification:
|
||||||
* description: If set to true no notification will be send related to this Refund.
|
* description: If set to true no notification will be send related to this Refund.
|
||||||
* type: boolean
|
* type: boolean
|
||||||
|
* 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.orders.refundPayment(order_id, {
|
||||||
|
* amount: 1000,
|
||||||
|
* reason: 'Do not like it'
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/adasda/refund' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "amount": 1000,
|
||||||
|
* "reason": "Do not like it"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -50,6 +77,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -79,6 +79,41 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* refund:
|
* refund:
|
||||||
* description: The amount to refund.
|
* description: The amount to refund.
|
||||||
* type: integer
|
* type: integer
|
||||||
|
* 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.orders.requestReturn(order_id, {
|
||||||
|
* items: [
|
||||||
|
* {
|
||||||
|
* item_id,
|
||||||
|
* quantity: 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/return' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "items": [
|
||||||
|
* {
|
||||||
|
* "item_id": "{item_id}",
|
||||||
|
* "quantity": 1
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Return
|
* - Return
|
||||||
* - Order
|
* - Order
|
||||||
@@ -91,6 +126,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|||||||
@@ -105,6 +105,31 @@ import { EntityManager } from "typeorm"
|
|||||||
* metadata:
|
* metadata:
|
||||||
* description: An optional set of key-value pairs to hold additional information.
|
* description: An optional set of key-value pairs to hold additional information.
|
||||||
* type: object
|
* type: object
|
||||||
|
* 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.orders.updateClaim(order_id, claim_id, {
|
||||||
|
* no_notification: true
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "no_notification": true
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Claim
|
* - Claim
|
||||||
* responses:
|
* responses:
|
||||||
@@ -116,6 +141,18 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, claim_id } = req.params
|
const { id, claim_id } = req.params
|
||||||
|
|||||||
@@ -90,6 +90,31 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* no_notification:
|
* no_notification:
|
||||||
* description: A flag to indicate if no notifications should be emitted related to the updated order.
|
* description: A flag to indicate if no notifications should be emitted related to the updated order.
|
||||||
* type: boolean
|
* type: boolean
|
||||||
|
* 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.orders.update(order_id, {
|
||||||
|
* email: 'user@example.com'
|
||||||
|
* })
|
||||||
|
* .then(({ order }) => {
|
||||||
|
* console.log(order.id);
|
||||||
|
* });
|
||||||
|
* - lang: Shell
|
||||||
|
* label: cURL
|
||||||
|
* source: |
|
||||||
|
* curl --location --request POST 'https://medusa-url.com/admin/orders/adasda' \
|
||||||
|
* --header 'Authorization: Bearer {api_token}' \
|
||||||
|
* --header 'Content-Type: application/json' \
|
||||||
|
* --data-raw '{
|
||||||
|
* "email": "user@example.com"
|
||||||
|
* }'
|
||||||
|
* security:
|
||||||
|
* - api_token: []
|
||||||
|
* - cookie_auth: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Order
|
* - Order
|
||||||
* responses:
|
* responses:
|
||||||
@@ -101,6 +126,18 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* properties:
|
* properties:
|
||||||
* order:
|
* order:
|
||||||
* $ref: "#/components/schemas/order"
|
* $ref: "#/components/schemas/order"
|
||||||
|
* "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"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
|
|||||||
Loaded 100 of 246 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user