diff --git a/.github/workflows/generate-api-reference.yml b/.github/workflows/generate-api-reference.yml new file mode 100644 index 0000000000..a1dd8a12d6 --- /dev/null +++ b/.github/workflows/generate-api-reference.yml @@ -0,0 +1,51 @@ +name: Generate API Reference +on: + pull_request: + types: + - closed + branches: + - "master" + paths: + - packages/medusa/src/api/routes/** + - '!packages/medusa/src/api/routes/**/index.ts' + - '!packages/medusa/src/api/routes/**/index.js' +jobs: + api: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v2.3.5 + with: + token: ${{ secrets.REFERENCE_PAT }} + fetch-depth: 0 + + - name: Setup Node.js environment + uses: actions/setup-node@v2.4.1 + with: + node-version: "14" + cache: "yarn" + + - name: Install dependencies + uses: ./.github/actions/cache-deps + with: + extension: reference + + - name: Build Packages + run: yarn build + + - name: Generate API Reference + run: yarn openapi:generate + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: 'chore(docs): Generated API Reference' + base: 'master' + title: 'chore(docs): Updated API Reference' + labels: 'type: chore' + add-paths: docs/api/* diff --git a/.github/workflows/generate-js-reference.yml b/.github/workflows/generate-js-reference.yml index e3d626d2a2..0e122f01b4 100644 --- a/.github/workflows/generate-js-reference.yml +++ b/.github/workflows/generate-js-reference.yml @@ -46,8 +46,8 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: - commit-message: 'docs: Generated JS Client Reference (automated)' + commit-message: 'chore(docs): Generated JS Client Reference (automated)' base: 'master' - title: 'docs: Generated JS Client Reference (automated)' - labels: 'type: docs' + title: 'chore(docs): Updated API Reference' + labels: 'type: chore' add-paths: docs/content/references/js-client/** diff --git a/.github/workflows/generate-reference.yml b/.github/workflows/generate-reference.yml index 629dc50173..5de3c78839 100644 --- a/.github/workflows/generate-reference.yml +++ b/.github/workflows/generate-reference.yml @@ -46,8 +46,8 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: - commit-message: 'docs: Generated Services Reference (automated)' + commit-message: 'chore(docs): Generated Services Reference (automated)' base: 'master' - title: 'docs: Generated Services Reference (automated)' - labels: 'type: docs' + title: 'chore(docs): Generated Services Reference (automated)' + labels: 'type: chore' add-paths: docs/content/references/services/** diff --git a/.github/workflows/oas-test.yml b/.github/workflows/oas-test.yml new file mode 100644 index 0000000000..bf71dbe3f0 --- /dev/null +++ b/.github/workflows/oas-test.yml @@ -0,0 +1,34 @@ +name: OAS Comments Format Validation +on: + pull_request: + paths: + - packages/medusa/src/api/routes/** + +jobs: + docs-test: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v2.3.5 + with: + fetch-depth: 0 + + - name: Setup Node.js environment + uses: actions/setup-node@v2.4.1 + with: + node-version: "14" + cache: "yarn" + + - name: Install dependencies + uses: ./.github/actions/cache-deps + with: + extension: oas + + - name: Build OAS + run: | + yarn openapi:generate diff --git a/.gitignore b/.gitignore index b1aabe88b2..a71537084f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,4 @@ lerna-debug.log .idea .turbo -build/** +build/** \ No newline at end of file diff --git a/docs/api/admin-spec3-base.json b/docs/api/admin-spec3-base.json index f809364d5b..8cfc3c2283 100644 --- a/docs/api/admin-spec3-base.json +++ b/docs/api/admin-spec3-base.json @@ -3,70 +3,165 @@ "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" + "name": "MIT", + "url": "https://github.com/medusajs/medusa/blob/master/LICENSE" } }, "tags": [ { "name": "Auth", - "description": "Auth endpoints allows authorization of admin Users and manages their sessions." + "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": "Product Variant", - "x-resourceId": "product_variant" + "name": "Tax Rate", + "description": "Tax Rate endpoints that allow handling tax rates in Medusa.", + "x-resourceId": "tax_rate" }, { - "name": "OAuth", - "x-resourceId": "OAuth" + "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": [ diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index 782008c052..a494f08980 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -3,70 +3,165 @@ "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" + "name": "MIT", + "url": "https://github.com/medusajs/medusa/blob/master/LICENSE" } }, "tags": [ { "name": "Auth", - "description": "Auth endpoints allows authorization of admin Users and manages their sessions." + "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": "Product Variant", - "x-resourceId": "product_variant" + "name": "Tax Rate", + "description": "Tax Rate endpoints that allow handling tax rates in Medusa.", + "x-resourceId": "tax_rate" }, { - "name": "OAuth", - "x-resourceId": "OAuth" + "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": [ @@ -75,7 +170,7 @@ } ], "paths": { - "/apps": { + "/apps/authorizations": { "post": { "operationId": "PostApps", "summary": "Generates a token for an application.", @@ -109,7 +204,7 @@ } }, "tags": [ - "Apps" + "App" ], "responses": { "200": { @@ -127,14 +222,16 @@ } } } - }, + } + }, + "/apps": { "get": { "operationId": "GetApps", "summary": "List applications", "description": "Retrieve a list of applications.", "x-authenticated": true, "tags": [ - "Apps" + "App" ], "responses": { "200": { @@ -143,84 +240,11 @@ "application/json": { "schema": { "properties": { - "collection": { - "$ref": "#/components/schemas/OAuth" - } - } - } - } - } - } - } - } - }, - "/auth": { - "post": { - "operationId": "PostAuth", - "summary": "Authenticate a User", - "x-authenticated": false, - "description": "Logs a User in and authorizes them to manage Store settings.", - "parameters": [], - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "password" - ], - "properties": { - "email": { - "type": "string", - "description": "The User's email." - }, - "password": { - "type": "string", - "description": "The User's password." - } - } - } - } - } - } - }, - "get": { - "operationId": "GetAuth", - "summary": "Get Session", - "x-authenticated": true, - "description": "Gets the currently logged in User.", - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" + "apps": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OAuth" + } } } } @@ -241,7 +265,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the batch job.", + "description": "The ID of the batch job.", "schema": { "type": "string" } @@ -279,7 +303,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the batch job.", + "description": "The ID of the batch job.", "schema": { "type": "string" } @@ -312,7 +336,58 @@ "summary": "Create a Batch Job", "description": "Creates a Batch Job.", "x-authenticated": true, - "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "type", + "context" + ], + "properties": { + "type": { + "type": "string", + "description": "The type of batch job to start.", + "example": "product-export" + }, + "context": { + "type": "object", + "description": "Additional infomration regarding the batch to be used for processing.", + "example": { + "shape": { + "prices": [ + { + "region": null, + "currency_code": "eur" + } + ], + "dynamicImageColumnCount": 4, + "dynamicOptionColumnCount": 2 + }, + "list_config": { + "skip": 0, + "take": 50, + "order": { + "created_at": "DESC" + }, + "relations": [ + "variants", + "variant.prices", + "images" + ] + } + } + }, + "dry_run": { + "type": "boolean", + "description": "Set a batch job in dry_run mode to get some information on what will be done without applying any modifications.", + "default": false + } + } + } + } + } + }, "tags": [ "Batch Job" ], @@ -331,34 +406,6 @@ } } } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "type", - "context", - "dry_run" - ], - "properties": { - "type": { - "type": "string", - "description": "The type of batch job to start." - }, - "context": { - "type": "string", - "description": "Additional infomration regarding the batch to be used for processing." - }, - "dry_run": { - "type": "boolean", - "description": "Set a batch job in dry_run mode to get some information on what will be done without applying any modifications." - } - } - } - } - } } }, "get": { @@ -370,17 +417,41 @@ { "in": "query", "name": "limit", - "description": "The number of collections to return.", + "description": "The number of batch jobs to return.", "schema": { - "type": "string" + "type": "integer", + "default": 10 } }, { "in": "query", "name": "offset", - "description": "The offset of collections to return.", + "description": "The number of batch jobs to skip before results.", "schema": { - "type": "string" + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "id", + "style": "form", + "explode": false, + "description": "Filter by the batch ID", + "schema": { + "oneOf": [ + { + "type": "string", + "description": "batch job ID" + }, + { + "type": "array", + "description": "multiple batch job IDs", + "items": { + "type": "string" + } + } + ] } }, { @@ -404,7 +475,28 @@ "description": "Date comparison for when resulting collections was confirmed, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -415,7 +507,28 @@ "description": "Date comparison for when resulting collections was pre processed, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -426,7 +539,28 @@ "description": "Date comparison for when resulting collections was completed, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -437,7 +571,28 @@ "description": "Date comparison for when resulting collections was failed, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -448,26 +603,52 @@ "description": "Date comparison for when resulting collections was canceled, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { "in": "query", "name": "order", - "description": "Order used when retrieving batch jobs", + "description": "Field used to order retrieved batch jobs", "schema": { "type": "string" } }, { "in": "query", - "name": "deleted_at", - "style": "form", - "explode": false, - "description": "Date comparison for when resulting collections was deleted, i.e. less than, greater than etc.", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each order of the result.", "schema": { - "type": "object", - "nullable": true + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in each order of the result.", + "schema": { + "type": "string" } }, { @@ -478,7 +659,28 @@ "description": "Date comparison for when resulting collections was created, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -489,7 +691,28 @@ "description": "Date comparison for when resulting collections was updated, i.e. less than, greater than etc.", "schema": { "type": "object", - "nullable": true + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } } ], @@ -503,8 +726,23 @@ "application/json": { "schema": { "properties": { - "batch_job": { - "$ref": "#/components/schemas/batch_job" + "batch_jobs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/batch_job" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -525,7 +763,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Batch Job", + "description": "The ID of the Batch Job", "schema": { "type": "string" } @@ -552,6 +790,102 @@ } } }, + "/auth": { + "post": { + "operationId": "PostAuth", + "summary": "Authenticate a User", + "x-authenticated": false, + "description": "Logs a User in and authorizes them to manage Store settings.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "type": "string", + "description": "The User's email." + }, + "password": { + "type": "string", + "description": "The User's password." + } + } + } + } + } + }, + "tags": [ + "Auth" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "user": { + "$ref": "#/components/schemas/user" + } + } + } + } + } + }, + "401": { + "description": "The user doesn't exist or the credentials are incorrect." + } + } + }, + "delete": { + "operationId": "DeleteAuth", + "summary": "Delete Session", + "x-authenticated": true, + "description": "Deletes the current session for the logged in user.", + "tags": [ + "Auth" + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "get": { + "operationId": "GetAuth", + "summary": "Get Session", + "x-authenticated": true, + "description": "Gets the currently logged in User.", + "tags": [ + "Auth" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "user": { + "$ref": "#/components/schemas/user" + } + } + } + } + } + }, + "400": { + "description": "An error occurred." + } + } + } + }, "/collections/{id}/products/batch": { "post": { "operationId": "PostProductsToCollection", @@ -563,7 +897,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Collection.", + "description": "The ID of the Collection.", "schema": { "type": "string" } @@ -573,17 +907,16 @@ "content": { "application/json": { "schema": { + "required": [ + "product_ids" + ], "properties": { "product_ids": { "description": "An array of Product IDs to add to the Product Collection.", "type": "array", "items": { - "properties": { - "id": { - "description": "The ID of a Product to add to the Product Collection.", - "type": "string" - } - } + "description": "The ID of a Product to add to the Product Collection.", + "type": "string" } } } @@ -596,7 +929,18 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "collection": { + "$ref": "#/components/schemas/product_collection" + } + } + } + } + } } } }, @@ -610,7 +954,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Collection.", + "description": "The ID of the Collection.", "schema": { "type": "string" } @@ -620,17 +964,16 @@ "content": { "application/json": { "schema": { + "required": [ + "product_ids" + ], "properties": { "product_ids": { "description": "An array of Product IDs to remove from the Product Collection.", "type": "array", "items": { - "properties": { - "id": { - "description": "The ID of a Product to remove from the Product Collection.", - "type": "string" - } - } + "description": "The ID of a Product to add to the Product Collection.", + "type": "string" } } } @@ -643,7 +986,32 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the collection" + }, + "object": { + "type": "string", + "description": "The type of object the removal was executed on", + "default": "product-collection" + }, + "removed_products": { + "description": "The IDs of the products removed from the collection", + "type": "array", + "items": { + "description": "The ID of a Product to add to the Product Collection.", + "type": "string" + } + } + } + } + } + } } } } @@ -710,15 +1078,17 @@ "name": "limit", "description": "The number of collections to return.", "schema": { - "type": "string" + "type": "integer", + "default": 10 } }, { "in": "query", "name": "offset", - "description": "The offset of collections to return.", + "description": "The number of collections to skip before the results.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { @@ -739,26 +1109,100 @@ }, { "in": "query", - "name": "deleted_at", - "description": "Date comparison for when resulting collections was deleted, i.e. less than, greater than etc.", + "name": "q", + "description": "a search term to search titles and handles.", "schema": { - "type": "object" + "type": "string" } }, { "in": "query", "name": "created_at", - "description": "Date comparison for when resulting collections was created, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting collections were created.", "schema": { - "type": "object" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { "in": "query", "name": "updated_at", - "description": "Date comparison for when resulting collections was updated, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting collections were updated.", "schema": { - "type": "object" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "deleted_at", + "description": "Date comparison for when resulting collections were deleted.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } } ], @@ -772,8 +1216,23 @@ "application/json": { "schema": { "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" + "collections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/product_collection" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -794,7 +1253,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Collection.", + "description": "The ID of the Collection.", "schema": { "type": "string" } @@ -812,14 +1271,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Collection" + "description": "The ID of the deleted Collection" }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "product-collection" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the collection was deleted successfully or not.", + "default": true } } } @@ -838,7 +1300,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product Collection", + "description": "The ID of the Product Collection", "schema": { "type": "string" } @@ -874,7 +1336,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Collection.", + "description": "The ID of the Collection.", "schema": { "type": "string" } @@ -929,12 +1391,53 @@ "summary": "Create a Customer", "description": "Creates a Customer.", "x-authenticated": true, - "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "email", + "first_name", + "last_name", + "password" + ], + "properties": { + "email": { + "type": "string", + "description": "The customer's email.", + "format": "email" + }, + "first_name": { + "type": "string", + "description": "The customer's first name." + }, + "last_name": { + "type": "string", + "description": "The customer's last name." + }, + "password": { + "type": "string", + "description": "The customer's password.", + "format": "password" + }, + "phone": { + "type": "string", + "description": "The customer's phone number." + }, + "metadata": { + "description": "An optional set of key-value pairs to hold additional information.", + "type": "object" + } + } + } + } + } + }, "tags": [ "Customer" ], "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -948,42 +1451,6 @@ } } } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "first_name", - "last_name" - ], - "properties": { - "email": { - "type": "string", - "description": "The Customer's email address." - }, - "first_name": { - "type": "string", - "description": "The Customer's first name." - }, - "last_name": { - "type": "string", - "description": "The Customer's last name." - }, - "phone": { - "type": "string", - "description": "The Customer's phone number." - }, - "metadata": { - "type": "object", - "description": "Metadata for the customer." - } - } - } - } - } } }, "get": { @@ -991,6 +1458,42 @@ "summary": "List Customers", "description": "Retrieves a list of Customers.", "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "The number of items to return.", + "schema": { + "type": "integer", + "default": 50 + } + }, + { + "in": "query", + "name": "offset", + "description": "The items to skip before result.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each customer.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "q", + "description": "a search term to search email, first_name, and last_name.", + "schema": { + "type": "string" + } + } + ], "tags": [ "Customer" ], @@ -1001,8 +1504,23 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "customers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/customer" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -1023,7 +1541,23 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Customer.", + "description": "The ID of the Customer.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in the customer.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in the customer.", "schema": { "type": "string" } @@ -1059,7 +1593,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Customer.", + "description": "The ID of the Customer.", "schema": { "type": "string" } @@ -1067,13 +1601,17 @@ { "in": "query", "name": "expand", - "style": "form", - "explode": false, + "description": "(Comma separated) Which fields should be expanded in each customer.", "schema": { - "type": "array", - "items": { - "type": "string" - } + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be retrieved in each customer.", + "schema": { + "type": "string" } } ], @@ -1084,7 +1622,8 @@ "properties": { "email": { "type": "string", - "description": "The Customer's email. Only providable if user not registered." + "description": "The Customer's email.", + "format": "email" }, "first_name": { "type": "string", @@ -1100,7 +1639,8 @@ }, "password": { "type": "string", - "description": "The Customer's password." + "description": "The Customer's password.", + "format": "password" }, "groups": { "type": "array", @@ -1110,7 +1650,7 @@ ], "properties": { "id": { - "description": "The id of a customer group", + "description": "The ID of a customer group", "type": "string" } } @@ -1118,8 +1658,8 @@ "description": "A list of customer groups to which the customer belongs." }, "metadata": { - "type": "object", - "description": "Metadata for the customer." + "description": "An optional set of key-value pairs to hold additional information.", + "type": "object" } } } @@ -1147,6 +1687,596 @@ } } }, + "/customer-groups/{id}/customers/batch": { + "post": { + "operationId": "PostCustomerGroupsGroupCustomersBatch", + "summary": "Add a list of customers to a customer group ", + "description": "Adds a list of customers, represented by id's, to a customer group.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the customer group.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "customer_ids" + ], + "properties": { + "customer_ids": { + "description": "The ids of the customers to add", + "type": "array", + "items": { + "required": [ + "id" + ], + "properties": { + "id": { + "description": "ID of the customer", + "type": "string" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer_group": { + "$ref": "#/components/schemas/customer_group" + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "DeleteCustomerGroupsGroupCustomerBatch", + "summary": "Remove a list of customers from a customer group ", + "description": "Removes a list of customers, represented by id's, from a customer group.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the customer group.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "customer_ids" + ], + "properties": { + "customer_ids": { + "description": "The ids of the customers to remove", + "type": "array", + "items": { + "required": [ + "id" + ], + "properties": { + "id": { + "description": "ID of the customer", + "type": "string" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer_group": { + "$ref": "#/components/schemas/customer_group" + } + } + } + } + } + } + } + } + }, + "/customer-groups": { + "post": { + "operationId": "PostCustomerGroups", + "summary": "Create a CustomerGroup", + "description": "Creates a CustomerGroup.", + "x-authenticated": true, + "parameters": [], + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer_group": { + "$ref": "#/components/schemas/customer_group" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the customer group" + }, + "metadata": { + "type": "object", + "description": "Metadata for the customer." + } + } + } + } + } + } + }, + "get": { + "operationId": "GetCustomerGroups", + "summary": "Retrieve a list of customer groups", + "description": "Retrieve a list of customer groups.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "q", + "description": "Query used for searching customer group names.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "offset", + "description": "How many groups to skip in the result.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "order", + "description": "the field used to order the customer groups.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "id", + "style": "form", + "explode": false, + "description": "Filter by the customer group ID", + "schema": { + "oneOf": [ + { + "type": "string", + "description": "customer group ID" + }, + { + "type": "array", + "description": "multiple customer group IDs", + "items": { + "type": "string" + } + }, + { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by IDs less than this ID" + }, + "gt": { + "type": "string", + "description": "filter by IDs greater than this ID" + }, + "lte": { + "type": "string", + "description": "filter by IDs less than or equal to this ID" + }, + "gte": { + "type": "string", + "description": "filter by IDs greater than or equal to this ID" + } + } + } + ] + } + }, + { + "in": "query", + "name": "name", + "style": "form", + "explode": false, + "description": "Filter by the customer group name", + "schema": { + "type": "array", + "description": "multiple customer group names", + "items": { + "type": "string", + "description": "customer group name" + } + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting customer groups were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting customer groups were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of customer groups returned.", + "schema": { + "type": "integer", + "default": 10 + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each customer groups of the result.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer_groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/customer_group" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, + "/customer-groups/{id}": { + "delete": { + "operationId": "DeleteCustomerGroupsCustomerGroup", + "summary": "Delete a CustomerGroup", + "description": "Deletes a CustomerGroup.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Customer Group", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the deleted customer group." + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted.", + "default": "customer_group" + }, + "deleted": { + "type": "boolean", + "description": "Whether the customer group was deleted successfully or not.", + "default": true + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetCustomerGroupsGroup", + "summary": "Retrieve a CustomerGroup", + "description": "Retrieves a Customer Group.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Customer Group.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in the customer group.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in the customer group.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer_group": { + "$ref": "#/components/schemas/customer_group" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCustomerGroupsGroup", + "summary": "Update a CustomerGroup", + "description": "Update a CustomerGroup.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the customer group.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "Name of the customer group", + "type": "string" + }, + "metadata": { + "description": "Metadata for the customer.", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer_group": { + "$ref": "#/components/schemas/customer_group" + } + } + } + } + } + } + } + } + }, + "/customer-groups/{id}/customers": { + "get": { + "operationId": "GetCustomerGroupsGroupCustomers", + "summary": "List Customers", + "description": "Retrieves a list of customers in a customer group", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the customer group.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer Group" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/customer" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, "/discounts/{id}/regions/{region_id}": { "post": { "operationId": "PostDiscountsDiscountRegionsRegion", @@ -1158,7 +2288,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount.", + "description": "The ID of the Discount.", "schema": { "type": "string" } @@ -1167,7 +2297,7 @@ "in": "path", "name": "region_id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -1203,7 +2333,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount.", + "description": "The ID of the Discount.", "schema": { "type": "string" } @@ -1212,7 +2342,7 @@ "in": "path", "name": "region_id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -1242,14 +2372,14 @@ "/discounts/{discount_id}/conditions": { "post": { "operationId": "PostDiscountsDiscountConditions", - "summary": "Creates a DiscountCondition", + "summary": "Creates a DiscountCondition. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided.", "x-authenticated": true, "parameters": [ { "in": "path", "name": "discount_id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -1276,33 +2406,51 @@ "content": { "application/json": { "schema": { + "required": [ + "operator" + ], "properties": { "operator": { "description": "Operator of the condition", - "type": "string" + "type": "string", + "enum": [ + "in", + "not_in" + ] }, - "items": { - "properties": { - "products": { - "type": "array", - "description": "list of products" - }, - "product_types": { - "type": "array", - "description": "list of product types" - }, - "product_collections": { - "type": "array", - "description": "list of product collections" - }, - "product_tags": { - "type": "array", - "description": "list of product tags" - }, - "customer_groups": { - "type": "array", - "description": "list of customer_groups" - } + "products": { + "type": "array", + "description": "list of product IDs if the condition is applied on products.", + "items": { + "type": "string" + } + }, + "product_types": { + "type": "array", + "description": "list of product type IDs if the condition is applied on product types.", + "items": { + "type": "string" + } + }, + "product_collections": { + "type": "array", + "description": "list of product collection IDs if the condition is applied on product collections.", + "items": { + "type": "string" + } + }, + "product_tags": { + "type": "array", + "description": "list of product tag IDs if the condition is applied on product tags.", + "items": { + "type": "string" + } + }, + "customer_groups": { + "type": "array", + "description": "list of customer group IDs if the condition is applied on customer groups.", + "items": { + "type": "string" } } } @@ -1311,7 +2459,7 @@ } }, "tags": [ - "Discount" + "Discount Condition" ], "responses": { "200": { @@ -1337,6 +2485,24 @@ "summary": "Creates a Discount", "x-authenticated": true, "description": "Creates a Discount with a given set of rules that define how the Discount behaves.", + "parameters": [ + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each customer.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be retrieved in each customer.", + "schema": { + "type": "string" + } + } + ], "requestBody": { "content": { "application/json": { @@ -1351,20 +2517,105 @@ "description": "A unique code that will be used to redeem the Discount" }, "is_dynamic": { - "type": "string", - "description": "Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules." + "type": "boolean", + "description": "Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules.", + "default": false }, "rule": { "description": "The Discount Rule that defines how Discounts are calculated", - "oneOf": [ - { - "$ref": "#/components/schemas/discount_rule" + "type": "object", + "required": [ + "type", + "value", + "allocation" + ], + "properties": { + "description": { + "type": "string", + "description": "A short description of the discount" + }, + "type": { + "type": "string", + "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers.", + "enum": [ + "fixed", + "percentage", + "free_shipping" + ] + }, + "value": { + "type": "number", + "description": "The value that the discount represents; this will depend on the type of the discount" + }, + "allocation": { + "type": "string", + "description": "The scope that the discount should apply to.", + "enum": [ + "total", + "item" + ] + }, + "conditions": { + "type": "array", + "description": "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided.", + "items": { + "type": "object", + "required": [ + "operator" + ], + "properties": { + "operator": { + "type": "string", + "description": "Operator of the condition", + "enum": [ + "in", + "not_in" + ] + }, + "products": { + "type": "array", + "description": "list of product IDs if the condition is applied on products.", + "items": { + "type": "string" + } + }, + "product_types": { + "type": "array", + "description": "list of product type IDs if the condition is applied on product types.", + "items": { + "type": "string" + } + }, + "product_collections": { + "type": "array", + "description": "list of product collection IDs if the condition is applied on product collections.", + "items": { + "type": "string" + } + }, + "product_tags": { + "type": "array", + "description": "list of product tag IDs if the condition is applied on product tags.", + "items": { + "type": "string" + } + }, + "customer_groups": { + "type": "array", + "description": "list of customer group IDs if the condition is applied on customer groups.", + "items": { + "type": "string" + } + } + } + } } - ] + } }, "is_disabled": { "type": "boolean", - "description": "Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers." + "description": "Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers.", + "default": false }, "starts_at": { "type": "string", @@ -1376,6 +2627,11 @@ "format": "date-time", "description": "The time at which the Discount should no longer be available." }, + "valid_duration": { + "type": "string", + "description": "Duration the discount runs between", + "example": "P3Y6M4DT12H30M5S" + }, "regions": { "description": "A list of Region ids representing the Regions in which the Discount can be used.", "type": "array", @@ -1425,11 +2681,38 @@ { "in": "query", "name": "q", - "description": "Search query applied on results.", + "description": "Search query applied on the code field.", "schema": { "type": "string" } }, + { + "in": "query", + "name": "rule", + "description": "Discount Rules filters to apply on the search", + "schema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "fixed", + "percentage", + "free_shipping" + ], + "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers." + }, + "allocation": { + "type": "string", + "enum": [ + "total", + "item" + ], + "description": "The value that the discount represents; this will depend on the type of the discount" + } + } + } + }, { "in": "query", "name": "is_dynamic", @@ -1451,7 +2734,8 @@ "name": "limit", "description": "The number of items in the response", "schema": { - "type": "number" + "type": "number", + "default": "20" } }, { @@ -1459,7 +2743,8 @@ "name": "offset", "description": "The offset of items in response", "schema": { - "type": "number" + "type": "number", + "default": "0" } }, { @@ -1481,8 +2766,23 @@ "application/json": { "schema": { "properties": { - "discount": { - "$ref": "#/components/schemas/discount" + "discounts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/discount" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -1503,7 +2803,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount to create the dynamic code from.\"", + "description": "The ID of the Discount to create the dynamic code from.\"", "schema": { "type": "string" } @@ -1534,8 +2834,7 @@ "schema": { "type": "object", "required": [ - "code", - "usage_limit" + "code" ], "properties": { "code": { @@ -1544,7 +2843,8 @@ }, "usage_limit": { "type": "number", - "description": "amount of times the discount can be applied" + "default": "1", + "description": "amount of times the discount can be applied." }, "metadata": { "type": "object", @@ -1566,9 +2866,9 @@ "parameters": [ { "in": "path", - "name": "id", + "name": "discount_id", "required": true, - "description": "The id of the Discount", + "description": "The ID of the Discount", "schema": { "type": "string" } @@ -1577,14 +2877,30 @@ "in": "path", "name": "condition_id", "required": true, - "description": "The id of the DiscountCondition", + "description": "The ID of the DiscountCondition", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "expand", + "description": "Comma separated list of relations to include in the results.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "Comma separated list of fields to include in the results.", "schema": { "type": "string" } } ], "tags": [ - "Discount" + "Discount Condition" ], "responses": { "200": { @@ -1595,18 +2911,21 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted DiscountCondition" + "description": "The ID of the deleted DiscountCondition" }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "discount-condition" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the discount condition was deleted successfully or not.", + "default": true }, "discount": { - "type": "object", - "description": "The Discount to which the condition used to belong" + "description": "The Discount to which the condition used to belong", + "$ref": "#/components/schemas/discount" } } } @@ -1624,7 +2943,7 @@ "in": "path", "name": "discount_id", "required": true, - "description": "The id of the Discount.", + "description": "The ID of the Discount.", "schema": { "type": "string" } @@ -1633,7 +2952,7 @@ "in": "path", "name": "condition_id", "required": true, - "description": "The id of the DiscountCondition.", + "description": "The ID of the DiscountCondition.", "schema": { "type": "string" } @@ -1657,7 +2976,7 @@ ], "description": "Gets a DiscountCondition", "tags": [ - "DiscountCondition" + "Discount Condition" ], "responses": { "200": { @@ -1678,14 +2997,23 @@ }, "post": { "operationId": "PostDiscountsDiscountConditionsCondition", - "summary": "Updates a DiscountCondition", + "summary": "Updates a DiscountCondition. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided.", "x-authenticated": true, "parameters": [ { "in": "path", "name": "discount_id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "condition_id", + "required": true, + "description": "The ID of the DiscountCondition.", "schema": { "type": "string" } @@ -1693,7 +3021,7 @@ { "in": "query", "name": "expand", - "description": "(Comma separated) Which fields should be expanded in each product of the result.", + "description": "(Comma separated) Which fields should be expanded in each item of the result.", "schema": { "type": "string" } @@ -1701,7 +3029,7 @@ { "in": "query", "name": "fields", - "description": "(Comma separated) Which fields should be included in each product of the result.", + "description": "(Comma separated) Which fields should be included in each item of the result.", "schema": { "type": "string" } @@ -1712,32 +3040,40 @@ "content": { "application/json": { "schema": { - "required": [ - "id" - ], "properties": { - "items": { - "properties": { - "products": { - "type": "array", - "description": "list of products" - }, - "product_types": { - "type": "array", - "description": "list of product types" - }, - "product_collections": { - "type": "array", - "description": "list of product collections" - }, - "product_tags": { - "type": "array", - "description": "list of product tags" - }, - "customer_groups": { - "type": "array", - "description": "list of customer_groups" - } + "products": { + "type": "array", + "description": "list of product IDs if the condition is applied on products.", + "items": { + "type": "string" + } + }, + "product_types": { + "type": "array", + "description": "list of product type IDs if the condition is applied on product types.", + "items": { + "type": "string" + } + }, + "product_collections": { + "type": "array", + "description": "list of product collection IDs if the condition is applied on product collections.", + "items": { + "type": "string" + } + }, + "product_tags": { + "type": "array", + "description": "list of product tag IDs if the condition is applied on product tags.", + "items": { + "type": "string" + } + }, + "customer_groups": { + "type": "array", + "description": "list of customer group IDs if the condition is applied on customer groups.", + "items": { + "type": "string" } } } @@ -1777,7 +3113,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount", + "description": "The ID of the Discount", "schema": { "type": "string" } @@ -1795,14 +3131,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Discount" + "description": "The ID of the deleted Discount" }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "discount" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the discount was deleted successfully or not.", + "default": true } } } @@ -1821,7 +3160,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount", + "description": "The ID of the Discount", "schema": { "type": "string" } @@ -1873,7 +3212,23 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount.", + "description": "The ID of the Discount.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each item of the result.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in each item of the result.", "schema": { "type": "string" } @@ -1890,11 +3245,91 @@ }, "rule": { "description": "The Discount Rule that defines how Discounts are calculated", - "oneOf": [ - { - "$ref": "#/components/schemas/discount_rule" + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the Rule" + }, + "description": { + "type": "string", + "description": "A short description of the discount" + }, + "value": { + "type": "number", + "description": "The value that the discount represents; this will depend on the type of the discount" + }, + "allocation": { + "type": "string", + "description": "The scope that the discount should apply to.", + "enum": [ + "total", + "item" + ] + }, + "conditions": { + "type": "array", + "description": "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided.", + "items": { + "type": "object", + "required": [ + "operator" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the Rule" + }, + "operator": { + "type": "string", + "description": "Operator of the condition", + "enum": [ + "in", + "not_in" + ] + }, + "products": { + "type": "array", + "description": "list of product IDs if the condition is applied on products.", + "items": { + "type": "string" + } + }, + "product_types": { + "type": "array", + "description": "list of product type IDs if the condition is applied on product types.", + "items": { + "type": "string" + } + }, + "product_collections": { + "type": "array", + "description": "list of product collection IDs if the condition is applied on product collections.", + "items": { + "type": "string" + } + }, + "product_tags": { + "type": "array", + "description": "list of product tag IDs if the condition is applied on product tags.", + "items": { + "type": "string" + } + }, + "customer_groups": { + "type": "array", + "description": "list of customer group IDs if the condition is applied on customer groups.", + "items": { + "type": "string" + } + } + } + } } - ] + } }, "is_disabled": { "type": "boolean", @@ -1910,6 +3345,15 @@ "format": "date-time", "description": "The time at which the Discount should no longer be available." }, + "valid_duration": { + "type": "string", + "description": "Duration the discount runs between", + "example": "P3Y6M4DT12H30M5S" + }, + "usage_limit": { + "type": "number", + "description": "Maximum times the discount can be used" + }, "regions": { "description": "A list of Region ids representing the Regions in which the Discount can be used.", "type": "array", @@ -1958,7 +3402,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Discount", + "description": "The ID of the Discount", "schema": { "type": "string" } @@ -1967,7 +3411,7 @@ "in": "path", "name": "code", "required": true, - "description": "The id of the Discount", + "description": "The ID of the Discount", "schema": { "type": "string" } @@ -2009,6 +3453,22 @@ "schema": { "type": "string" } + }, + { + "in": "query", + "name": "expand", + "description": "Comma separated list of relations to include in the results.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "Comma separated list of fields to include in the results.", + "schema": { + "type": "string" + } } ], "tags": [ @@ -2032,449 +3492,6 @@ } } }, - "/customer-groups/{id}/customers/batch": { - "post": { - "operationId": "PostCustomerGroupsGroupCustomersBatch", - "summary": "Add a list of customers to a customer group ", - "description": "Adds a list of customers, represented by id's, to a customer group.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the customer group.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "customers": { - "description": "The ids of the customers to add", - "type": "array", - "items": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "Id of the customer", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customerGroup": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "DeleteCustomerGroupsGroupCustomerBatch", - "summary": "Remove a list of customers from a customer group ", - "description": "Removes a list of customers, represented by id's, from a customer group.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the customer group.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "customers": { - "description": "The ids of the customers to remove", - "type": "array", - "items": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "Id of the customer", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customerGroup": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - } - }, - "/customer-groups": { - "post": { - "operationId": "PostCustomerGroups", - "summary": "Create a CustomerGroup", - "description": "Creates a CustomerGroup.", - "x-authenticated": true, - "parameters": [], - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the customer group" - }, - "metadata": { - "type": "object", - "description": "Metadata for the customer." - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCustomerGroups", - "summary": "Retrieve a list of customer groups", - "description": "Retrieve a list of customer groups.", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "q", - "description": "Query used for searching user group names.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "offset", - "description": "How many groups to skip in the result.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "id", - "description": "Ids of the groups to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "order", - "description": "to retrieve customer groups in.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "created_at", - "description": "Date comparison for when resulting customer group was created, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "updated_at", - "description": "Date comparison for when resulting ustomer group was updated, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "limit", - "description": "Limit the number of customer groups returned.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "expand", - "description": "(Comma separated) Which fields should be expanded in each customer groups of the result.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customerGroup": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - } - }, - "/customer-groups/{id}": { - "delete": { - "operationId": "DeleteCustomerGroupsCustomerGroup", - "summary": "Delete a CustomerGroup", - "description": "Deletes a CustomerGroup.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer Group", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "id": { - "type": "string", - "description": "The id of the deleted customer group." - }, - "object": { - "type": "string", - "description": "The type of the object that was deleted." - }, - "deleted": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCustomerGroupsGroup", - "summary": "Retrieve a CustomerGroup", - "description": "Retrieves a Customer Group.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer Group.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCustomerGroupsGroup", - "summary": "Update a CustomerGroup", - "description": "Update a CustomerGroup.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the customer group.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "CustomerGroup" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer_group": { - "$ref": "#/components/schemas/customer_group" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the customer group" - }, - "metadata": { - "type": "object", - "description": "Metadata for the customer." - } - } - } - } - } - } - } - }, - "/customer-groups/{id}/customers": { - "get": { - "operationId": "GetCustomerGroupsGroupCustomers", - "summary": "List Customers", - "description": "Retrieves a list of Customers.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the customer group.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, "/draft-orders": { "post": { "operationId": "PostDraftOrders", @@ -2494,35 +3511,36 @@ "properties": { "status": { "description": "The status of the draft order", - "type": "string" + "type": "string", + "enum": [ + "open", + "completed" + ] }, "email": { "description": "The email of the customer of the draft order", - "type": "string" + "type": "string", + "format": "email" }, "billing_address": { "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "$ref": "#/components/schemas/address" }, "shipping_address": { "description": "The Address to be used for shipping.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "$ref": "#/components/schemas/address" }, "items": { "description": "The Line Items that have been received.", "type": "array", "items": { + "type": "object", + "required": [ + "quantity" + ], "properties": { "variant_id": { - "description": "The id of the Product Variant to generate the Line Item from.", + "description": "The ID of the Product Variant to generate the Line Item from.", "type": "string" }, "unit_price": { @@ -2545,13 +3563,17 @@ } }, "region_id": { - "description": "The id of the region for the draft order", + "description": "The ID of the region for the draft order", "type": "string" }, "discounts": { "description": "The discounts to add on the draft order", "type": "array", "items": { + "type": "object", + "required": [ + "code" + ], "properties": { "code": { "description": "The code of the discount to apply", @@ -2561,7 +3583,7 @@ } }, "customer_id": { - "description": "The id of the customer to add on the draft order", + "description": "The ID of the customer to add on the draft order", "type": "string" }, "no_notification_order": { @@ -2572,9 +3594,13 @@ "description": "The shipping methods for the draft order", "type": "array", "items": { + "type": "object", + "required": [ + "option_id" + ], "properties": { "option_id": { - "description": "The id of the shipping option in use", + "description": "The ID of the shipping option in use", "type": "string" }, "data": { @@ -2622,6 +3648,34 @@ "summary": "List Draft Orders", "description": "Retrieves an list of Draft Orders", "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "offset", + "description": "The number of items to skip before the results.", + "schema": { + "type": "number", + "default": "0" + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of items returned.", + "schema": { + "type": "number", + "default": "50" + } + }, + { + "in": "query", + "name": "q", + "description": "a search term to search emails in carts associated with draft orders and display IDs of draft orders", + "schema": { + "type": "string" + } + } + ], "tags": [ "Draft Order" ], @@ -2632,8 +3686,23 @@ "application/json": { "schema": { "properties": { - "draft_order": { - "$ref": "#/components/schemas/draft-order" + "draft_orders": { + "type": "array", + "items": { + "$ref": "#/components/schemas/draft-order" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -2654,7 +3723,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2669,7 +3738,7 @@ ], "properties": { "variant_id": { - "description": "The id of the Product Variant to generate the Line Item from.", + "description": "The ID of the Product Variant to generate the Line Item from.", "type": "string" }, "unit_price": { @@ -2678,7 +3747,8 @@ }, "title": { "description": "The potential custom title of the item.", - "type": "string" + "type": "string", + "default": "Custom item" }, "quantity": { "description": "The quantity of the Line Item.", @@ -2725,7 +3795,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2743,14 +3813,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Draft Order." + "description": "The ID of the deleted Draft Order." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "draft-order" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the draft order was deleted successfully or not.", + "default": true } } } @@ -2769,7 +3842,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2807,7 +3880,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2816,7 +3889,7 @@ "in": "path", "name": "line_id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2852,7 +3925,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2861,7 +3934,7 @@ "in": "path", "name": "line_id", "required": true, - "description": "The id of the Line Item.", + "description": "The ID of the Line Item.", "schema": { "type": "string" } @@ -2914,7 +3987,7 @@ } } }, - "/draft-orders/{id}/register-payment": { + "/draft-orders/{id}/pay": { "post": { "summary": "Registers a payment for a Draft Order", "operationId": "PostDraftOrdersDraftOrderRegisterPayment", @@ -2941,7 +4014,7 @@ "application/json": { "schema": { "properties": { - "draft_order": { + "order": { "$ref": "#/components/schemas/draft-order" } } @@ -2963,7 +4036,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Draft Order.", + "description": "The ID of the Draft Order.", "schema": { "type": "string" } @@ -2976,32 +4049,37 @@ "properties": { "region_id": { "type": "string", - "description": "The id of the Region to create the Draft Order in." + "description": "The ID of the Region to create the Draft Order in." + }, + "country_code": { + "type": "string", + "description": "The 2 character ISO code for the Country.", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "email": { "type": "string", - "description": "An email to be used on the Draft Order." + "description": "An email to be used on the Draft Order.", + "format": "email" }, "billing_address": { "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "$ref": "#/components/schemas/address" }, "shipping_address": { "description": "The Address to be used for shipping.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "$ref": "#/components/schemas/address" }, "discounts": { "description": "An array of Discount codes to add to the Draft Order.", "type": "array", "items": { + "type": "object", + "required": [ + "code" + ], "properties": { "code": { "description": "The code that a Discount is identifed by.", @@ -3015,7 +4093,7 @@ "type": "boolean" }, "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" } } @@ -3054,6 +4132,9 @@ "content": { "application/json": { "schema": { + "required": [ + "region_id" + ], "properties": { "value": { "type": "integer", @@ -3069,11 +4150,8 @@ "description": "The time at which the Gift Card should no longer be available." }, "region_id": { - "description": "The id of the Region in which the Gift Card can be used.", - "type": "array", - "items": { - "type": "string" - } + "description": "The ID of the Region in which the Gift Card can be used.", + "type": "string" }, "metadata": { "description": "An optional set of key-value pairs to hold additional information.", @@ -3109,6 +4187,34 @@ "summary": "List Gift Cards", "description": "Retrieves a list of Gift Cards.", "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "offset", + "description": "The number of items to skip before the results.", + "schema": { + "type": "number", + "default": "0" + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of items returned.", + "schema": { + "type": "number", + "default": "50" + } + }, + { + "in": "query", + "name": "q", + "description": "a search term to search by code or display ID", + "schema": { + "type": "string" + } + } + ], "tags": [ "Gift Card" ], @@ -3124,6 +4230,18 @@ "items": { "$ref": "#/components/schemas/gift_card" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -3144,7 +4262,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Gift Card to delete.", + "description": "The ID of the Gift Card to delete.", "schema": { "type": "string" } @@ -3162,14 +4280,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Gift Card" + "description": "The ID of the deleted Gift Card" }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "gift-card" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the gift card was deleted successfully or not.", + "default": true } } } @@ -3188,7 +4309,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Gift Card.", + "description": "The ID of the Gift Card.", "schema": { "type": "string" } @@ -3224,7 +4345,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Gift Card.", + "description": "The ID of the Gift Card.", "schema": { "type": "string" } @@ -3249,11 +4370,8 @@ "description": "The time at which the Gift Card should no longer be available." }, "region_id": { - "description": "The id of the Region in which the Gift Card can be used.", - "type": "array", - "items": { - "type": "string" - } + "description": "The ID of the Region in which the Gift Card can be used.", + "type": "string" }, "metadata": { "description": "An optional set of key-value pairs to hold additional information.", @@ -3322,7 +4440,8 @@ }, "password": { "description": "The desired password for the User", - "type": "string" + "type": "string", + "format": "password" } } } @@ -3332,7 +4451,7 @@ } }, "tags": [ - "Invites" + "Invite" ], "responses": { "200": { @@ -3358,11 +4477,17 @@ "properties": { "user": { "description": "The email for the user to be created.", - "type": "string" + "type": "string", + "format": "email" }, "role": { "description": "The role of the user to be created.", - "type": "string" + "type": "string", + "enum": [ + "admin", + "member", + "developer" + ] } } } @@ -3370,7 +4495,7 @@ } }, "tags": [ - "Invites" + "Invite" ], "responses": { "200": { @@ -3384,7 +4509,7 @@ "description": "Lists all Invites", "x-authenticated": true, "tags": [ - "Invites" + "Invite" ], "responses": { "200": { @@ -3418,18 +4543,40 @@ "in": "path", "name": "invite_id", "required": true, - "description": "The id of the Invite", + "description": "The ID of the Invite", "schema": { "type": "string" } } ], "tags": [ - "Invites" + "Invite" ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the deleted Invite." + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted.", + "format": "invite" + }, + "deleted": { + "type": "boolean", + "description": "Whether or not the Invite was deleted.", + "default": true + } + } + } + } + } } } } @@ -3445,14 +4592,14 @@ "in": "path", "name": "invite_id", "required": true, - "description": "The id of the Invite", + "description": "The ID of the Invite", "schema": { "type": "string" } } ], "tags": [ - "Invites" + "Invite" ], "responses": { "200": { @@ -3461,6 +4608,164 @@ } } }, + "/notifications": { + "get": { + "operationId": "GetNotifications", + "summary": "List Notifications", + "description": "Retrieves a list of Notifications.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "offset", + "description": "The number of notifications to skip before starting to collect the notifications set", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "limit", + "description": "The number of notifications to return", + "schema": { + "type": "integer", + "default": 50 + } + }, + { + "in": "query", + "name": "fields", + "description": "Comma separated fields to include in the result set", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "expand", + "description": "Comma separated fields to populate", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "event_name", + "description": "The name of the event that the notification was sent for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "resource_type", + "description": "The type of resource that the Notification refers to.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "resource_id", + "description": "The ID of the resource that the Notification refers to.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "to", + "description": "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", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "include_resends", + "description": "A boolean indicating whether the result set should include resent notifications or not", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Notification" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "notifications": { + "type": "array", + "items": { + "$ref": "#/components/schemas/notification" + } + } + } + } + } + } + } + } + } + }, + "/notifications/{id}/resend": { + "post": { + "operationId": "PostNotificationsNotificationResend", + "summary": "Resend Notification", + "description": "Resends a previously sent notifications, with the same data but optionally to a different address", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Notification", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "to": { + "description": "A new address or user identifier that the Notification should be sent to", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Notification" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "notification": { + "$ref": "#/components/schemas/notification" + } + } + } + } + } + } + } + } + }, "/notes": { "post": { "operationId": "PostNotes", @@ -3471,10 +4776,15 @@ "content": { "application/json": { "schema": { + "required": [ + "resource_id", + "resource_type", + "value" + ], "properties": { "resource_id": { "type": "string", - "description": "The id of the resource which the Note relates to." + "description": "The ID of the resource which the Note relates to." }, "resource_type": { "type": "string", @@ -3516,33 +4826,29 @@ "description": "Retrieves a list of notes", "parameters": [ { - "in": "path", + "in": "query", "name": "limit", - "required": true, "description": "The number of notes to get", "schema": { "type": "number", - "default": "" + "default": "50" } }, { - "in": "path", + "in": "query", "name": "offset", - "required": true, "description": "The offset at which to get notes", "schema": { "type": "number", - "default": "" + "default": "0" } }, { - "in": "path", + "in": "query", "name": "resource_id", - "required": true, - "description": "The id which the notes belongs to", + "description": "The ID which the notes belongs to", "schema": { - "type": "string", - "default": "" + "type": "string" } } ], @@ -3561,6 +4867,18 @@ "items": { "$ref": "#/components/schemas/note" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -3581,7 +4899,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Note to delete.", + "description": "The ID of the Note to delete.", "schema": { "type": "string" } @@ -3599,11 +4917,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Note." + "description": "The ID of the deleted Note." + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted.", + "default": "note" }, "deleted": { "type": "boolean", - "description": "Whether or not the Note was deleted." + "description": "Whether or not the Note was deleted.", + "default": true } } } @@ -3622,7 +4946,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the note to retrieve.", + "description": "The ID of the note to retrieve.", "schema": { "type": "string" } @@ -3658,7 +4982,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Note to update", + "description": "The ID of the Note to update", "schema": { "type": "string" } @@ -3702,160 +5026,6 @@ } } }, - "/notifications": { - "get": { - "operationId": "GetNotifications", - "summary": "List Notifications", - "description": "Retrieves a list of Notifications.", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "offset", - "description": "The number of notifications to skip before starting to collect the notifications set", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "in": "query", - "name": "limit", - "description": "The number of notifications to return", - "schema": { - "type": "integer", - "default": 50 - } - }, - { - "in": "query", - "name": "fields", - "description": "The fields to include in the result set", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "expand", - "description": "The fields to populate", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "event_name", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "resource_type", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "resource_id", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "to", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "include_resends", - "description": "Whether the result set should include resent notifications or not", - "schema": { - "type": "boolean" - } - } - ], - "tags": [ - "Notification" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "notifications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/notification" - } - } - } - } - } - } - } - } - } - }, - "/notifications/{id}/resend": { - "post": { - "operationId": "PostNotificationsNotificationResend", - "summary": "Resend Notification", - "description": "Resends a previously sent notifications, with the same data but optionally to a different address", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Notification", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "to": { - "description": "The address or user identifier that the Notification was sent to", - "type": "string" - } - } - } - } - } - }, - "tags": [ - "Notification" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "notification": { - "$ref": "#/components/schemas/notification" - } - } - } - } - } - } - } - } - }, "/orders/{id}/shipping-methods": { "post": { "operationId": "PostOrdersOrderShippingMethods", @@ -3867,7 +5037,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -3899,8 +5069,7 @@ "type": "object", "required": [ "price", - "option_id", - "data" + "option_id" ], "properties": { "price": { @@ -3909,7 +5078,7 @@ }, "option_id": { "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." + "description": "The ID of the Shipping Option to create the Shipping Method from." }, "data": { "type": "object", @@ -3933,7 +5102,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -3971,7 +5140,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -3980,7 +5149,7 @@ "in": "path", "name": "claim_id", "required": true, - "description": "The id of the Claim.", + "description": "The ID of the Claim.", "schema": { "type": "string" } @@ -3997,7 +5166,7 @@ "schema": { "properties": { "order": { - "$ref": "#/components/schemas/claim_order" + "$ref": "#/components/schemas/order" } } } @@ -4018,7 +5187,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order which the Claim relates to.", + "description": "The ID of the Order which the Claim relates to.", "schema": { "type": "string" } @@ -4027,7 +5196,7 @@ "in": "path", "name": "claim_id", "required": true, - "description": "The id of the Claim which the Fulfillment relates to.", + "description": "The ID of the Claim which the Fulfillment relates to.", "schema": { "type": "string" } @@ -4036,7 +5205,7 @@ "in": "path", "name": "fulfillment_id", "required": true, - "description": "The id of the Fulfillment.", + "description": "The ID of the Fulfillment.", "schema": { "type": "string" } @@ -4052,8 +5221,8 @@ "application/json": { "schema": { "properties": { - "fulfillment": { - "$ref": "#/components/schemas/fulfillment" + "order": { + "$ref": "#/components/schemas/order" } } } @@ -4074,7 +5243,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order which the Swap relates to.", + "description": "The ID of the Order which the Swap relates to.", "schema": { "type": "string" } @@ -4083,7 +5252,7 @@ "in": "path", "name": "swap_id", "required": true, - "description": "The id of the Swap which the Fulfillment relates to.", + "description": "The ID of the Swap which the Fulfillment relates to.", "schema": { "type": "string" } @@ -4092,7 +5261,7 @@ "in": "path", "name": "fulfillment_id", "required": true, - "description": "The id of the Fulfillment.", + "description": "The ID of the Fulfillment.", "schema": { "type": "string" } @@ -4108,8 +5277,8 @@ "application/json": { "schema": { "properties": { - "fulfillment": { - "$ref": "#/components/schemas/fulfillment" + "order": { + "$ref": "#/components/schemas/order" } } } @@ -4130,7 +5299,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order which the Fulfillment relates to.", + "description": "The ID of the Order which the Fulfillment relates to.", "schema": { "type": "string" } @@ -4139,7 +5308,7 @@ "in": "path", "name": "fulfillment_id", "required": true, - "description": "The id of the Fulfillment", + "description": "The ID of the Fulfillment", "schema": { "type": "string" } @@ -4155,8 +5324,8 @@ "application/json": { "schema": { "properties": { - "fulfillment": { - "$ref": "#/components/schemas/fulfillment" + "order": { + "$ref": "#/components/schemas/order" } } } @@ -4177,7 +5346,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4215,7 +5384,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4224,7 +5393,7 @@ "in": "path", "name": "swap_id", "required": true, - "description": "The id of the Swap.", + "description": "The ID of the Swap.", "schema": { "type": "string" } @@ -4241,7 +5410,7 @@ "schema": { "properties": { "order": { - "$ref": "#/components/schemas/swap" + "$ref": "#/components/schemas/order" } } } @@ -4262,7 +5431,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4300,7 +5469,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4338,7 +5507,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4347,7 +5516,7 @@ "in": "path", "name": "claim_id", "required": true, - "description": "The id of the Claim.", + "description": "The ID of the Claim.", "schema": { "type": "string" } @@ -4362,7 +5531,7 @@ ], "properties": { "fulfillment_id": { - "description": "The id of the Fulfillment.", + "description": "The ID of the Fulfillment.", "type": "string" }, "tracking_numbers": { @@ -4378,7 +5547,7 @@ } }, "tags": [ - "Order" + "Claim" ], "responses": { "200": { @@ -4409,7 +5578,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4436,9 +5605,13 @@ "description": "The Claim Items that the Claim will consist of.", "type": "array", "items": { + "required": [ + "item_id", + "quantity" + ], "properties": { "item_id": { - "description": "The id of the Line Item that will be claimed.", + "description": "The ID of the Line Item that will be claimed.", "type": "string" }, "quantity": { @@ -4481,7 +5654,7 @@ "properties": { "option_id": { "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." + "description": "The ID of the Shipping Option to create the Shipping Method from." }, "price": { "type": "integer", @@ -4493,9 +5666,13 @@ "description": "The new items to send to the Customer when the Claim type is Replace.", "type": "array", "items": { + "required": [ + "variant_id", + "quantity" + ], "properties": { "variant_id": { - "description": "The id of the Product Variant to ship.", + "description": "The ID of the Product Variant to ship.", "type": "string" }, "quantity": { @@ -4511,11 +5688,11 @@ "items": { "properties": { "id": { - "description": "The id of an existing Shipping Method", + "description": "The ID of an existing Shipping Method", "type": "string" }, "option_id": { - "description": "The id of the Shipping Option to create a Shipping Method from", + "description": "The ID of the Shipping Option to create a Shipping Method from", "type": "string" }, "price": { @@ -4527,7 +5704,8 @@ }, "shipping_address": { "type": "object", - "description": "An optional shipping address to send the claim to. Defaults to the parent order's shipping address" + "description": "An optional shipping address to send the claim to. Defaults to the parent order's shipping address", + "$ref": "#/components/schemas/address" }, "refund_amount": { "description": "The amount to refund the Customer when the Claim type is `refund`.", @@ -4547,7 +5725,7 @@ } }, "tags": [ - "Order" + "Claim" ], "responses": { "200": { @@ -4567,7 +5745,7 @@ } } }, - "/orders/{id}/fulfillments": { + "/orders/{id}/fulfillment": { "post": { "operationId": "PostOrdersOrderFulfillments", "summary": "Create a Fulfillment", @@ -4578,7 +5756,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -4596,9 +5774,13 @@ "description": "The Line Items to include in the Fulfillment.", "type": "array", "items": { + "required": [ + "item_id", + "quantity" + ], "properties": { "item_id": { - "description": "The id of Line Item to fulfill.", + "description": "The ID of Line Item to fulfill.", "type": "string" }, "quantity": { @@ -4622,7 +5804,7 @@ } }, "tags": [ - "Order" + "Fulfillment" ], "responses": { "200": { @@ -4642,341 +5824,6 @@ } } }, - "/orders": { - "post": { - "operationId": "PostOrders", - "summary": "Create an order", - "description": "Creates and order", - "x-authenticated": true, - "requestBody": { - "content": { - "application/json": { - "schema": { - "required": [ - "email", - "billing_address", - "shipping_address", - "items", - "region", - "customer_id", - "payment_method", - "shipping_method" - ], - "properties": { - "status": { - "description": "status of the order", - "type": "string" - }, - "email": { - "description": "the email for the order", - "type": "string" - }, - "billing_address": { - "description": "Billing address", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address": { - "description": "Shipping address", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "items": { - "description": "The Line Items for the order", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "region": { - "description": "Region where the order belongs", - "type": "string" - }, - "discounts": { - "description": "Discounts applied to the order", - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "customer_id": { - "description": "id of the customer", - "type": "string" - }, - "payment_method": { - "description": "payment method chosen for the order", - "type": "object", - "required": [ - "provider_id" - ], - "properties": { - "provider_id": { - "type": "string", - "description": "id of the payment provider" - }, - "data": { - "description": "Data relevant for the given payment method", - "type": "object" - } - } - }, - "shipping_method": { - "description": "The Shipping Method used for shipping the order.", - "type": "object", - "required": [ - "provider_id", - "profile_id", - "price" - ], - "properties": { - "provider_id": { - "type": "string", - "description": "The id of the shipping provider." - }, - "profile_id": { - "type": "string", - "description": "The id of the shipping profile." - }, - "price": { - "type": "integer", - "description": "The price of the shipping." - }, - "data": { - "type": "object", - "description": "Data relevant to the specific shipping method." - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - }, - "description": "Items to ship" - } - } - }, - "no_notification": { - "description": "A flag to indicate if no notifications should be emitted related to the updated order.", - "type": "boolean" - } - } - } - } - } - }, - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetOrders", - "summary": "List Orders", - "description": "Retrieves a list of Orders", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "q", - "description": "Query used for searching orders.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "id", - "description": "Id of the order to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "status", - "style": "form", - "explode": false, - "description": "Status to search for", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "in": "query", - "name": "fulfillment_status", - "description": "Fulfillment status to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "payment_status", - "description": "Payment status to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "display_id", - "description": "Display id to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "cart_id", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "customer_id", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "email", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "region_id", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "currency_code", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "tax_rate", - "description": "to search for.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "cancelled_at", - "description": "Date comparison for when resulting orders was cancelled, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "created_at", - "description": "Date comparison for when resulting orders was created, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "updated_at", - "description": "Date comparison for when resulting orders was updated, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "offset", - "description": "How many orders to skip in the result.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "limit", - "description": "Limit the number of orders returned.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "expand", - "description": "(Comma separated) Which fields should be expanded in each order of the result.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "fields", - "description": "(Comma separated) Which fields should be included in each order of the result.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "orders": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - } - }, "/orders/{id}/shipment": { "post": { "operationId": "PostOrdersOrderShipment", @@ -4988,7 +5835,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5003,7 +5850,7 @@ ], "properties": { "fulfillment_id": { - "description": "The id of the Fulfillment.", + "description": "The ID of the Fulfillment.", "type": "string" }, "tracking_numbers": { @@ -5054,7 +5901,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5063,7 +5910,7 @@ "in": "path", "name": "swap_id", "required": true, - "description": "The id of the Swap.", + "description": "The ID of the Swap.", "schema": { "type": "string" } @@ -5078,7 +5925,7 @@ ], "properties": { "fulfillment_id": { - "description": "The id of the Fulfillment.", + "description": "The ID of the Fulfillment.", "type": "string" }, "tracking_numbers": { @@ -5098,7 +5945,7 @@ } }, "tags": [ - "Order" + "Swap" ], "responses": { "200": { @@ -5129,7 +5976,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5153,12 +6000,20 @@ ], "properties": { "item_id": { - "description": "The id of the Line Item that will be claimed.", + "description": "The ID of the Line Item that will be claimed.", "type": "string" }, "quantity": { "description": "The number of items that will be returned", "type": "integer" + }, + "reason_id": { + "description": "The ID of the Return Reason to use.", + "type": "string" + }, + "note": { + "description": "An optional note with information about the Return.", + "type": "string" } } } @@ -5166,10 +6021,13 @@ "return_shipping": { "description": "How the Swap will be returned.", "type": "object", + "required": [ + "option_id" + ], "properties": { "option_id": { "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." + "description": "The ID of the Shipping Option to create the Shipping Method from." }, "price": { "type": "integer", @@ -5187,7 +6045,7 @@ ], "properties": { "variant_id": { - "description": "The id of the Product Variant to ship.", + "description": "The ID of the Product Variant to ship.", "type": "string" }, "quantity": { @@ -5207,7 +6065,7 @@ ], "properties": { "option_id": { - "description": "The id of the Shipping Option to override with a custom price.", + "description": "The ID of the Shipping Option to override with a custom price.", "type": "string" }, "price": { @@ -5223,7 +6081,8 @@ }, "allow_backorder": { "description": "If true, swaps can be completed with items out of stock", - "type": "boolean" + "type": "boolean", + "default": true } } } @@ -5231,54 +6090,7 @@ } }, "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/order/{id}/metadata/{key}": { - "delete": { - "operationId": "DeleteOrdersOrderMetadataKey", - "summary": "Delete Metadata", - "description": "Deletes a metadata key.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Order.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "key", - "required": true, - "description": "The metadata key.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Order" + "Swap" ], "responses": { "200": { @@ -5309,7 +6121,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5318,7 +6130,7 @@ "in": "path", "name": "claim_id", "required": true, - "description": "The id of the Claim.", + "description": "The ID of the Claim.", "schema": { "type": "string" } @@ -5343,7 +6155,7 @@ } }, "tags": [ - "Order" + "Fulfillment" ], "responses": { "200": { @@ -5374,7 +6186,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5383,7 +6195,7 @@ "in": "path", "name": "swap_id", "required": true, - "description": "The id of the Swap.", + "description": "The ID of the Swap.", "schema": { "type": "string" } @@ -5408,7 +6220,7 @@ } }, "tags": [ - "Order" + "Fulfillment" ], "responses": { "200": { @@ -5439,7 +6251,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5475,7 +6287,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5514,18 +6326,18 @@ } }, "region": { - "description": "Region where the order belongs", + "description": "ID of the region where the order belongs", "type": "string" }, "discounts": { "description": "Discounts applied to the order", "type": "array", "items": { - "$ref": "#/components/schemas/line_item" + "$ref": "#/components/schemas/discount" } }, "customer_id": { - "description": "id of the customer", + "description": "ID of the customer", "type": "string" }, "payment_method": { @@ -5534,7 +6346,7 @@ "properties": { "provider_id": { "type": "string", - "description": "id of the payment provider" + "description": "ID of the payment provider" }, "data": { "description": "Data relevant for the given payment method", @@ -5548,11 +6360,11 @@ "properties": { "provider_id": { "type": "string", - "description": "The id of the shipping provider." + "description": "The ID of the shipping provider." }, "profile_id": { "type": "string", - "description": "The id of the shipping profile." + "description": "The ID of the shipping profile." }, "price": { "type": "integer", @@ -5601,6 +6413,346 @@ } } }, + "/orders": { + "get": { + "operationId": "GetOrders", + "summary": "List Orders", + "description": "Retrieves a list of Orders", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "q", + "description": "Query used for searching orders by shipping address first name, orders' email, and orders' display ID", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "id", + "description": "ID of the order to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "status", + "style": "form", + "explode": false, + "description": "Status to search for", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "pending", + "completed", + "archived", + "canceled", + "requires_action" + ] + } + } + }, + { + "in": "query", + "name": "fulfillment_status", + "style": "form", + "explode": false, + "description": "Fulfillment status to search for.", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "not_fulfilled", + "fulfilled", + "partially_fulfilled", + "shipped", + "partially_shipped", + "canceled", + "returned", + "partially_returned", + "requires_action" + ] + } + } + }, + { + "in": "query", + "name": "payment_status", + "style": "form", + "explode": false, + "description": "Payment status to search for.", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "captured", + "awaiting", + "not_paid", + "refunded", + "partially_refunded", + "canceled", + "requires_action" + ] + } + } + }, + { + "in": "query", + "name": "display_id", + "description": "Display ID to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "cart_id", + "description": "to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "customer_id", + "description": "to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "email", + "description": "to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "region_id", + "style": "form", + "explode": false, + "description": "Regions to search orders by", + "schema": { + "oneOf": [ + { + "type": "string", + "description": "ID of a Region." + }, + { + "type": "array", + "items": { + "type": "string", + "description": "ID of a Region." + } + } + ] + } + }, + { + "in": "query", + "name": "currency_code", + "style": "form", + "explode": false, + "description": "Currency code to search for", + "schema": { + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + } + }, + { + "in": "query", + "name": "tax_rate", + "description": "to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting orders were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting orders were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "canceled_at", + "description": "Date comparison for when resulting orders were canceled.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "sales_channel_id", + "style": "form", + "explode": false, + "description": "Filter by Sales Channels", + "schema": { + "type": "array", + "items": { + "type": "string", + "description": "The ID of a Sales Channel" + } + } + }, + { + "in": "query", + "name": "offset", + "description": "How many orders to skip before the results.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of orders returned.", + "schema": { + "type": "integer", + "default": 50 + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each order of the result.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in each order of the result.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Order" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "orders": { + "type": "array", + "items": { + "$ref": "#/components/schemas/order" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, "/orders/{id}/swaps/{swap_id}/process-payment": { "post": { "operationId": "PostOrdersOrderSwapsSwapProcessPayment", @@ -5612,7 +6764,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5621,14 +6773,14 @@ "in": "path", "name": "swap_id", "required": true, - "description": "The id of the Swap.", + "description": "The ID of the Swap.", "schema": { "type": "string" } } ], "tags": [ - "Order" + "Swap" ], "responses": { "200": { @@ -5648,7 +6800,7 @@ } } }, - "/orders/{id}/refunds": { + "/orders/{id}/refund": { "post": { "operationId": "PostOrdersOrderRefunds", "summary": "Create a Refund", @@ -5659,7 +6811,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5683,7 +6835,7 @@ "type": "string" }, "note": { - "description": "A not with additional details about the Refund.", + "description": "A note with additional details about the Refund.", "type": "string" }, "no_notification": { @@ -5716,7 +6868,7 @@ } } }, - "/orders/{id}/returns": { + "/orders/{id}/return": { "post": { "operationId": "PostOrdersOrderReturns", "summary": "Request a Return", @@ -5727,7 +6879,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5745,13 +6897,17 @@ "description": "The Line Items that will be returned.", "type": "array", "items": { + "required": [ + "item_id", + "quantity" + ], "properties": { "item_id": { - "description": "The id of the Line Item.", + "description": "The ID of the Line Item.", "type": "string" }, "reason_id": { - "description": "The id of the Return Reason to use.", + "description": "The ID of the Return Reason to use.", "type": "string" }, "note": { @@ -5771,7 +6927,7 @@ "properties": { "option_id": { "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." + "description": "The ID of the Shipping Option to create the Shipping Method from." }, "price": { "type": "integer", @@ -5779,9 +6935,14 @@ } } }, + "note": { + "description": "An optional note with information about the Return.", + "type": "string" + }, "receive_now": { "description": "A flag to indicate if the Return should be registerd as received immediately.", - "type": "boolean" + "type": "boolean", + "default": false }, "no_notification": { "description": "A flag to indicate if no notifications should be emitted related to the requested Return.", @@ -5797,6 +6958,7 @@ } }, "tags": [ + "Return", "Order" ], "responses": { @@ -5828,7 +6990,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Order.", + "description": "The ID of the Order.", "schema": { "type": "string" } @@ -5837,7 +6999,7 @@ "in": "path", "name": "claim_id", "required": true, - "description": "The id of the Claim.", + "description": "The ID of the Claim.", "schema": { "type": "string" } @@ -5852,13 +7014,18 @@ "description": "The Claim Items that the Claim will consist of.", "type": "array", "items": { + "required": [ + "id", + "images", + "tags" + ], "properties": { "id": { - "description": "The id of the Claim Item.", + "description": "The ID of the Claim Item.", "type": "string" }, "item_id": { - "description": "The id of the Line Item that will be claimed.", + "description": "The ID of the Line Item that will be claimed.", "type": "string" }, "quantity": { @@ -5883,14 +7050,39 @@ "description": "A list o tags to add to the Claim Item", "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Tag ID" + }, + "value": { + "type": "string", + "description": "Tag value" + } + } } }, "images": { "description": "A list of image URL's that will be associated with the Claim", + "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Image ID" + }, + "url": { + "type": "string", + "description": "Image URL" + } + } } + }, + "metadata": { + "description": "An optional set of key-value pairs to hold additional information.", + "type": "object" } } } @@ -5901,11 +7093,11 @@ "items": { "properties": { "id": { - "description": "The id of an existing Shipping Method", + "description": "The ID of an existing Shipping Method", "type": "string" }, "option_id": { - "description": "The id of the Shipping Option to create a Shipping Method from", + "description": "The ID of the Shipping Option to create a Shipping Method from", "type": "string" }, "price": { @@ -5929,7 +7121,7 @@ } }, "tags": [ - "Order" + "Claim" ], "responses": { "200": { @@ -5949,6 +7141,328 @@ } } }, + "/product-tags": { + "get": { + "operationId": "GetProductTags", + "summary": "List Product Tags", + "description": "Retrieve a list of Product Tags.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "The number of tags to return.", + "schema": { + "type": "integer", + "default": 10 + } + }, + { + "in": "query", + "name": "offset", + "description": "The number of items to skip before the results.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "order", + "description": "The field to sort items by.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "value", + "style": "form", + "explode": false, + "description": "The tag values to search for", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "q", + "description": "A query string to search values for", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "id", + "style": "form", + "explode": false, + "description": "The tag IDs to search for", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting product tags were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting product tags were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + } + ], + "tags": [ + "Product Tag" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "product_tags": { + "$ref": "#/components/schemas/product_tag" + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, + "/product-types": { + "get": { + "operationId": "GetProductTypes", + "summary": "List Product Types", + "description": "Retrieve a list of Product Types.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "The number of types to return.", + "schema": { + "type": "integer", + "default": 10 + } + }, + { + "in": "query", + "name": "offset", + "description": "The number of items to skip before the results.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "order", + "description": "The field to sort items by.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "value", + "style": "form", + "explode": false, + "description": "The type values to search for", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "id", + "style": "form", + "explode": false, + "description": "The type IDs to search for", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "q", + "description": "A query string to search values for", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting product types were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting product types were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + } + ], + "tags": [ + "Product Type" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "product_types": { + "$ref": "#/components/schemas/product_type" + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, "/price-lists/{id}/prices/batch": { "post": { "operationId": "PostPriceListsPriceListPricesBatch", @@ -5960,7 +7474,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Price List to update prices for.", + "description": "The ID of the Price List to update prices for.", "schema": { "type": "string" } @@ -5975,38 +7489,42 @@ "description": "The prices to update or add.", "type": "array", "items": { + "required": [ + "amount", + "variant_id" + ], "properties": { "id": { - "description": "The id of the price.", + "description": "The ID of the price.", "type": "string" }, - "status": { - "description": "The status of the Price List.", - "type": "string", - "enum": [ - "active", - "draft" - ] - }, "region_id": { - "description": "The id of the Region for which the price is used.", + "description": "The ID of the Region for which the price is used. Only required if currecny_code is not provided.", "type": "string" }, "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "variant_id": { + "description": "The ID of the Variant for which the price is used.", "type": "string" }, "amount": { - "description": "The amount of the price.", - "type": "number" + "description": "The amount to charge for the Product Variant.", + "type": "integer" }, "min_quantity": { "description": "The minimum quantity for which the price will be used.", - "type": "number" + "type": "integer" }, "max_quantity": { "description": "The maximum quantity for which the price will be used.", - "type": "number" + "type": "integer" } } } @@ -6030,16 +7548,8 @@ "application/json": { "schema": { "properties": { - "id": { - "type": "string", - "description": "The id of the deleted Price List." - }, - "object": { - "type": "string", - "description": "The type of the object that was deleted." - }, - "deleted": { - "type": "boolean" + "price_list": { + "$ref": "#/components/schemas/price_list" } } } @@ -6050,15 +7560,15 @@ }, "delete": { "operationId": "DeletePriceListsPriceListPricesBatch", - "summary": "Batch delete prices that belongs to a Price List", - "description": "Batch delete prices that belongs to a Price List", + "summary": "Batch delete prices that belong to a Price List", + "description": "Batch delete prices that belong to a Price List", "x-authenticated": true, "parameters": [ { "in": "path", "name": "id", "required": true, - "description": "The id of the Price List that the Money Amounts that will be deleted belongs to.", + "description": "The ID of the Price List that the Money Amounts (Prices) that will be deleted belongs to.", "schema": { "type": "string" } @@ -6095,15 +7605,18 @@ "type": "array", "items": { "type": "string", - "description": "The id of the deleted Money Amount." + "description": "The IDs of the deleted Money Amounts (Prices)." } }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "money-amount" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -6113,7 +7626,7 @@ } } }, - "/price_lists": { + "/price-lists": { "post": { "operationId": "PostPriceListsPriceList", "summary": "Creates a Price List", @@ -6123,6 +7636,12 @@ "content": { "application/json": { "schema": { + "required": [ + "name", + "description", + "type", + "prices" + ], "properties": { "name": { "description": "The name of the Price List", @@ -6132,6 +7651,16 @@ "description": "A description of the Price List.", "type": "string" }, + "starts_at": { + "description": "The date with timezone that the Price List starts being valid.", + "type": "string", + "format": "date" + }, + "ends_at": { + "description": "The date with timezone that the Price List ends being valid.", + "type": "string", + "format": "date" + }, "type": { "description": "The type of the Price List.", "type": "string", @@ -6152,13 +7681,486 @@ "description": "The prices of the Price List.", "type": "array", "items": { + "required": [ + "amount", + "variant_id" + ], "properties": { "region_id": { - "description": "The id of the Region for which the price is used.", + "description": "The ID of the Region for which the price is used. Only required if currecny_code is not provided.", "type": "string" }, "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "amount": { + "description": "The amount to charge for the Product Variant.", + "type": "integer" + }, + "variant_id": { + "description": "The ID of the Variant for which the price is used.", + "type": "string" + }, + "min_quantity": { + "description": "The minimum quantity for which the price will be used.", + "type": "integer" + }, + "max_quantity": { + "description": "The maximum quantity for which the price will be used.", + "type": "integer" + } + } + } + }, + "customer_groups": { + "type": "array", + "description": "A list of customer groups that the Price List applies to.", + "items": { + "required": [ + "id" + ], + "properties": { + "id": { + "description": "The ID of a customer group", + "type": "string" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Price List" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "price_list": { + "$ref": "#/components/schemas/price_list" + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetPriceLists", + "summary": "List Price Lists", + "description": "Retrieves a list of Price Lists.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "The number of items to get", + "schema": { + "type": "number", + "default": "10" + } + }, + { + "in": "query", + "name": "offset", + "description": "The offset at which to get items", + "schema": { + "type": "number", + "default": "0" + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each item of the result.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "order", + "description": "field to order results by.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "id", + "description": "ID to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "q", + "description": "query to search in price list description, price list name, and customer group name fields.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "status", + "style": "form", + "explode": false, + "description": "Status to search for.", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "active", + "draft" + ] + } + } + }, + { + "in": "query", + "name": "name", + "description": "price list name to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "customer_groups", + "style": "form", + "explode": false, + "description": "Customer Group IDs to search for.", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "type", + "style": "form", + "explode": false, + "description": "Type to search for.", + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "sale", + "override" + ] + } + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting price lists were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting price lists were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "deleted_at", + "description": "Date comparison for when resulting price lists were deleted.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + } + ], + "tags": [ + "Price List" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "price_lists": { + "type": "array", + "items": { + "$ref": "#/components/schemas/price_list" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, + "/price-lists/{id}": { + "delete": { + "operationId": "DeletePriceListsPriceList", + "summary": "Delete a Price List", + "description": "Deletes a Price List", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Price List to delete.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Price List" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the deleted Price List." + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted.", + "default": "price-list" + }, + "deleted": { + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetPriceListsPriceList", + "summary": "Retrieve a Price List", + "description": "Retrieves a Price List.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Price List.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Price List" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "price_list": { + "$ref": "#/components/schemas/price_list" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostPriceListsPriceListPriceList", + "summary": "Update a Price List", + "description": "Updates a Price List", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Price List.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "The name of the Price List", + "type": "string" + }, + "description": { + "description": "A description of the Price List.", + "type": "string" + }, + "starts_at": { + "description": "The date with timezone that the Price List starts being valid.", + "type": "string", + "format": "date" + }, + "ends_at": { + "description": "The date with timezone that the Price List ends being valid.", + "type": "string", + "format": "date" + }, + "type": { + "description": "The type of the Price List.", + "type": "string", + "enum": [ + "sale", + "override" + ] + }, + "status": { + "description": "The status of the Price List.", + "type": "string", + "enum": [ + "active", + "draft" + ] + }, + "prices": { + "description": "The prices of the Price List.", + "type": "array", + "items": { + "required": [ + "amount", + "variant_id" + ], + "properties": { + "id": { + "description": "The ID of the price.", + "type": "string" + }, + "region_id": { + "description": "The ID of the Region for which the price is used. Only required if currecny_code is not provided.", + "type": "string" + }, + "currency_code": { + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "variant_id": { + "description": "The ID of the Variant for which the price is used.", "type": "string" }, "amount": { @@ -6185,7 +8187,7 @@ ], "properties": { "id": { - "description": "The id of a customer group", + "description": "The ID of a customer group", "type": "string" } } @@ -6199,88 +8201,6 @@ "tags": [ "Price List" ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/price_list" - } - } - } - } - } - } - } - } - }, - "/price-lists/{id}": { - "delete": { - "operationId": "DeletePriceListsPriceList", - "summary": "Delete a Price List", - "description": "Deletes a Price List", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Price List to delete.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "id": { - "type": "string", - "description": "The id of the deleted Price List." - }, - "object": { - "type": "string", - "description": "The type of the object that was deleted." - }, - "deleted": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetPriceListsPriceList", - "summary": "Retrieve a Price List", - "description": "Retrieves a Price List.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Price List.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Price List" - ], "responses": { "200": { "description": "OK", @@ -6310,7 +8230,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Price List that the Money Amounts that will be deleted belongs to.", + "description": "The ID of the Price List that the Money Amounts that will be deleted belongs to.", "schema": { "type": "string" } @@ -6319,7 +8239,7 @@ "in": "path", "name": "product_id", "required": true, - "description": "The id of the product from which the money amount will be deleted.", + "description": "The ID of the product from which the money amount will be deleted.", "schema": { "type": "string" } @@ -6336,19 +8256,21 @@ "schema": { "properties": { "ids": { - "type": "number", - "description": "The price ids that have been deleted." - }, - "count": { - "type": "number", - "description": "The number of prices that have been deleted." + "type": "array", + "description": "The price ids that have been deleted.", + "items": { + "type": "string" + } }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "money-amount" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -6369,7 +8291,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Price List that the Money Amounts that will be deleted belongs to.", + "description": "The ID of the Price List that the Money Amounts that will be deleted belongs to.", "schema": { "type": "string" } @@ -6378,7 +8300,7 @@ "in": "path", "name": "variant_id", "required": true, - "description": "The id of the variant from which the money amount will be deleted.", + "description": "The ID of the variant from which the money amount will be deleted.", "schema": { "type": "string" } @@ -6395,19 +8317,21 @@ "schema": { "properties": { "ids": { - "type": "number", - "description": "The price ids that have been deleted." - }, - "count": { - "type": "number", - "description": "The number of prices that have been deleted." + "type": "array", + "description": "The price ids that have been deleted.", + "items": { + "type": "string" + } }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "money-amount" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -6427,7 +8351,7 @@ { "in": "query", "name": "q", - "description": "Query used for searching products.", + "description": "Query used for searching product title and description, variant title and sku, and collection title.", "schema": { "type": "string" } @@ -6435,7 +8359,7 @@ { "in": "query", "name": "id", - "description": "Id of the product to search for.", + "description": "ID of the product to search for.", "schema": { "type": "string" } @@ -6443,20 +8367,26 @@ { "in": "query", "name": "status", - "description": "Status to search for", + "description": "Product status to search for", "style": "form", "explode": false, "schema": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "draft", + "proposed", + "published", + "rejected" + ] } } }, { "in": "query", "name": "collection_id", - "description": "Collection ids to search for", + "description": "Collection IDs to search for", "style": "form", "explode": false, "schema": { @@ -6469,7 +8399,7 @@ { "in": "query", "name": "tags", - "description": "Tags to search for", + "description": "Tag IDs to search for", "style": "form", "explode": false, "schema": { @@ -6482,7 +8412,7 @@ { "in": "query", "name": "title", - "description": "to search for.", + "description": "product title to search for.", "schema": { "type": "string" } @@ -6490,7 +8420,7 @@ { "in": "query", "name": "description", - "description": "to search for.", + "description": "product description to search for.", "schema": { "type": "string" } @@ -6498,7 +8428,7 @@ { "in": "query", "name": "handle", - "description": "to search for.", + "description": "product handle to search for.", "schema": { "type": "string" } @@ -6522,15 +8452,7 @@ { "in": "query", "name": "order", - "description": "to retrieve products in.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "deleted_at", - "description": "Date comparison for when resulting products was deleted, i.e. less than, greater than etc.", + "description": "field to sort results by.", "schema": { "type": "string" } @@ -6538,17 +8460,91 @@ { "in": "query", "name": "created_at", - "description": "Date comparison for when resulting products was created, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting products were created.", "schema": { - "type": "string" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { "in": "query", "name": "updated_at", - "description": "Date comparison for when resulting products was updated, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting products were updated.", "schema": { - "type": "string" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "deleted_at", + "description": "Date comparison for when resulting products were deleted.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -6556,7 +8552,8 @@ "name": "offset", "description": "How many products to skip in the result.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { @@ -6564,7 +8561,8 @@ "name": "limit", "description": "Limit the number of products returned.", "schema": { - "type": "string" + "type": "integer", + "default": 50 } }, { @@ -6594,338 +8592,23 @@ "application/json": { "schema": { "properties": { - "count": { - "description": "The number of Products.", - "type": "integer" - }, - "offset": { - "description": "The offset of the Product query.", - "type": "integer" - }, - "limit": { - "description": "The limit of the Product query.", - "type": "integer" - }, "products": { "type": "array", "items": { "$ref": "#/components/schemas/product" } - } - } - } - } - } - } - } - } - }, - "/price-lists": { - "get": { - "operationId": "GetPriceLists", - "summary": "List Price Lists", - "description": "Retrieves a list of Price Lists.", - "x-authenticated": true, - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "price_lists": { - "type": "array", - "items": { - "$ref": "#/components/schemas/price_list" - } }, "count": { - "description": "The number of Price Lists.", - "type": "integer" + "type": "integer", + "description": "The total number of items available" }, "offset": { - "description": "The offset of the Price List query.", - "type": "integer" + "type": "integer", + "description": "The number of items skipped before these items" }, "limit": { - "description": "The limit of the Price List query.", - "type": "integer" - } - } - } - } - } - } - } - } - }, - "/price_lists/{id}": { - "post": { - "operationId": "PostPriceListsPriceListPriceList", - "summary": "Update a Price List", - "description": "Updates a Price List", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Price List.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "name": { - "description": "The name of the Price List", - "type": "string" - }, - "description": { - "description": "A description of the Price List.", - "type": "string" - }, - "type": { - "description": "The type of the Price List.", - "type": "string", - "enum": [ - "sale", - "override" - ] - }, - "status": { - "description": "The status of the Price List.", - "type": "string", - "enum": [ - "active", - "draft" - ] - }, - "prices": { - "description": "The prices of the Price List.", - "type": "array", - "items": { - "properties": { - "id": { - "description": "The id of the price.", - "type": "string" - }, - "region_id": { - "description": "The id of the Region for which the price is used.", - "type": "string" - }, - "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", - "type": "string" - }, - "amount": { - "description": "The amount to charge for the Product Variant.", - "type": "integer" - }, - "min_quantity": { - "description": "The minimum quantity for which the price will be used.", - "type": "integer" - }, - "max_quantity": { - "description": "The maximum quantity for which the price will be used.", - "type": "integer" - } - } - } - }, - "customer_groups": { - "type": "array", - "description": "A list of customer groups that the Price List applies to.", - "items": { - "required": [ - "id" - ], - "properties": { - "id": { - "description": "The id of a customer group", - "type": "string" - } - } - } - } - } - } - } - } - }, - "tags": [ - "Price List" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "product": { - "$ref": "#/components/schemas/price_list" - } - } - } - } - } - } - } - } - }, - "/product-tags": { - "get": { - "operationId": "GetProductTags", - "summary": "List Product Tags", - "description": "Retrieve a list of Product Tags.", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "limit", - "description": "The number of tags to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "offset", - "description": "The offset of tags to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "value", - "description": "The value of tags to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "id", - "description": "The id of tags to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "created_at", - "description": "Date comparison for when resulting tas was created, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "updated_at", - "description": "Date comparison for when resulting tas was updated, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - } - ], - "tags": [ - "Product Tag" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "tags": { - "$ref": "#/components/schemas/product_tag" - } - } - } - } - } - } - } - } - }, - "/product-types": { - "get": { - "operationId": "GetProductTypes", - "summary": "List Product Types", - "description": "Retrieve a list of Product Types.", - "x-authenticated": true, - "parameters": [ - { - "in": "query", - "name": "limit", - "description": "The number of types to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "offset", - "description": "The offset of types to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "value", - "description": "The value of types to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "id", - "description": "The id of types to return.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "created_at", - "description": "Date comparison for when resulting tas was created, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "updated_at", - "description": "Date comparison for when resulting tas was updated, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - } - ], - "tags": [ - "Product Tag" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "types": { - "$ref": "#/components/schemas/product_tag" + "type": "integer", + "description": "The number of items per page" } } } @@ -6946,7 +8629,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7001,9 +8684,7 @@ "application/json": { "schema": { "required": [ - "title", - "subtitle", - "description" + "title" ], "properties": { "title": { @@ -7020,11 +8701,13 @@ }, "is_giftcard": { "description": "A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to `true` will result in a Gift Card being created.", - "type": "boolean" + "type": "boolean", + "default": false }, "discountable": { "description": "A flag to indicate if discounts can be applied to the LineItems generated from this Product", - "type": "boolean" + "type": "boolean", + "default": true }, "images": { "description": "Images of the Product.", @@ -7041,10 +8724,28 @@ "description": "A unique handle to identify the Product by.", "type": "string" }, + "status": { + "description": "The status of the product.", + "type": "string", + "enum": [ + "draft", + "proposed", + "published", + "rejected" + ], + "default": "draft" + }, "type": { "description": "The Product Type to associate the Product with.", "type": "object", + "required": [ + "value" + ], "properties": { + "id": { + "description": "The ID of the Product Type.", + "type": "string" + }, "value": { "description": "The value of the Product Type.", "type": "string" @@ -7052,16 +8753,19 @@ } }, "collection_id": { - "description": "The id of the Collection the Product should belong to.", + "description": "The ID of the Collection the Product should belong to.", "type": "string" }, "tags": { "description": "Tags to associate the Product with.", "type": "array", "items": { + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of an existing Tag.", + "description": "The ID of an existing Tag.", "type": "string" }, "value": { @@ -7071,10 +8775,28 @@ } } }, + "sales_channels": { + "description": "[EXPERIMENTAL] Sales channels to associate the Product with.", + "type": "array", + "items": { + "required": [ + "id" + ], + "properties": { + "id": { + "description": "The ID of an existing Sales channel.", + "type": "string" + } + } + } + }, "options": { "description": "The Options that the Product should have. These define on which properties the Product's Product Variants will differ.", "type": "array", "items": { + "required": [ + "title" + ], "properties": { "title": { "description": "The title to identify the Product Option by.", @@ -7087,6 +8809,9 @@ "description": "A list of Product Variants to create with the Product.", "type": "array", "items": { + "required": [ + "title" + ], "properties": { "title": { "description": "The title to identify the Product Variant by.", @@ -7114,7 +8839,8 @@ }, "inventory_quantity": { "description": "The amount of stock kept for the Product Variant.", - "type": "integer" + "type": "integer", + "default": 0 }, "allow_backorder": { "description": "Whether the Product Variant can be purchased when out of stock.", @@ -7126,19 +8852,19 @@ }, "weight": { "description": "The wieght of the Product Variant.", - "type": "string" + "type": "number" }, "length": { "description": "The length of the Product Variant.", - "type": "string" + "type": "number" }, "height": { "description": "The height of the Product Variant.", - "type": "string" + "type": "number" }, "width": { "description": "The width of the Product Variant.", - "type": "string" + "type": "number" }, "origin_country": { "description": "The country of origin of the Product Variant.", @@ -7159,21 +8885,32 @@ "prices": { "type": "array", "items": { + "required": [ + "amount" + ], "properties": { "region_id": { - "description": "The id of the Region for which the price is used.", + "description": "The ID of the Region for which the price is used. Only required if currency_code is not provided.", "type": "string" }, "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", - "type": "string" + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "amount": { "description": "The amount to charge for the Product Variant.", "type": "integer" }, - "sale_amount": { - "description": "The sale amount to charge for the Product Variant.", + "min_quantity": { + "description": "The minimum quantity for which the price will be used.", + "type": "integer" + }, + "max_quantity": { + "description": "The maximum quantity for which the price will be used.", "type": "integer" } } @@ -7182,6 +8919,9 @@ "options": { "type": "array", "items": { + "required": [ + "value" + ], "properties": { "value": { "description": "The value to give for the Product Option at the same index in the Product's `options` field.", @@ -7195,18 +8935,22 @@ }, "weight": { "description": "The wieght of the Product.", - "type": "string" + "type": "number" }, "length": { "description": "The length of the Product.", - "type": "string" + "type": "number" }, "height": { "description": "The height of the Product.", - "type": "string" + "type": "number" }, "width": { "description": "The width of the Product.", + "type": "number" + }, + "hs_code": { + "description": "The Harmonized System code for the Product Variant.", "type": "string" }, "origin_country": { @@ -7259,7 +9003,7 @@ { "in": "query", "name": "q", - "description": "Query used for searching products.", + "description": "Query used for searching product title and description, variant title and sku, and collection title.", "schema": { "type": "string" } @@ -7267,9 +9011,23 @@ { "in": "query", "name": "id", - "description": "Id of the product to search for.", + "style": "form", + "explode": false, + "description": "Filter by product IDs.", "schema": { - "type": "string" + "oneOf": [ + { + "type": "string", + "description": "ID of the product to search for." + }, + { + "type": "array", + "items": { + "type": "string", + "description": "ID of a product." + } + } + ] } }, { @@ -7281,7 +9039,13 @@ "schema": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "draft", + "proposed", + "published", + "rejected" + ] } } }, @@ -7303,7 +9067,33 @@ "name": "tags", "style": "form", "explode": false, - "description": "Tags to search for", + "description": "Tag IDs to search for", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "price_list_id", + "style": "form", + "explode": false, + "description": "Price List IDs to search for", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "sales_channel_id", + "style": "form", + "explode": false, + "description": "Sales Channel IDs to filter products by", "schema": { "type": "array", "items": { @@ -7314,7 +9104,7 @@ { "in": "query", "name": "title", - "description": "to search for.", + "description": "title to search for.", "schema": { "type": "string" } @@ -7322,7 +9112,7 @@ { "in": "query", "name": "description", - "description": "to search for.", + "description": "description to search for.", "schema": { "type": "string" } @@ -7330,7 +9120,7 @@ { "in": "query", "name": "handle", - "description": "to search for.", + "description": "handle to search for.", "schema": { "type": "string" } @@ -7340,47 +9130,105 @@ "name": "is_giftcard", "description": "Search for giftcards using is_giftcard=true.", "schema": { - "type": "string" + "type": "boolean" } }, { "in": "query", "name": "type", - "description": "to search for.", + "description": "type ID to search for.", "schema": { "type": "string" } }, - { - "in": "query", - "name": "order", - "description": "to retrieve products in.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "deleted_at", - "description": "Date comparison for when resulting products was deleted, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, { "in": "query", "name": "created_at", - "description": "Date comparison for when resulting products was created, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting products were created.", "schema": { - "type": "object" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { "in": "query", "name": "updated_at", - "description": "Date comparison for when resulting products was updated, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting products were updated.", "schema": { - "type": "object" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "deleted_at", + "description": "Date comparison for when resulting products were deleted.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -7388,7 +9236,8 @@ "name": "offset", "description": "How many products to skip in the result.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { @@ -7396,7 +9245,8 @@ "name": "limit", "description": "Limit the number of products returned.", "schema": { - "type": "string" + "type": "integer", + "default": 50 } }, { @@ -7426,23 +9276,23 @@ "application/json": { "schema": { "properties": { - "count": { - "description": "The number of Products.", - "type": "integer" - }, - "offset": { - "description": "The offset of the Product query.", - "type": "integer" - }, - "limit": { - "description": "The limit of the Product query.", - "type": "integer" - }, "products": { "type": "array", "items": { "$ref": "#/components/schemas/product" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -7463,7 +9313,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7505,7 +9355,8 @@ }, "inventory_quantity": { "description": "The amount of stock kept for the Product Variant.", - "type": "integer" + "type": "integer", + "default": 0 }, "allow_backorder": { "description": "Whether the Product Variant can be purchased when out of stock.", @@ -7517,19 +9368,19 @@ }, "weight": { "description": "The wieght of the Product Variant.", - "type": "string" + "type": "number" }, "length": { "description": "The length of the Product Variant.", - "type": "string" + "type": "number" }, "height": { "description": "The height of the Product Variant.", - "type": "string" + "type": "number" }, "width": { "description": "The width of the Product Variant.", - "type": "string" + "type": "number" }, "origin_country": { "description": "The country of origin of the Product Variant.", @@ -7550,14 +9401,25 @@ "prices": { "type": "array", "items": { + "required": [ + "amount" + ], "properties": { + "id": { + "description": "The ID of the price.", + "type": "string" + }, "region_id": { - "description": "The id of the Region for which the price is used.", + "description": "The ID of the Region for which the price is used. Only required if currency_code is not provided.", "type": "string" }, "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", - "type": "string" + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "amount": { "description": "The amount to charge for the Product Variant.", @@ -7577,9 +9439,13 @@ "options": { "type": "array", "items": { + "required": [ + "option_id", + "value" + ], "properties": { "option_id": { - "description": "The id of the Product Option to set the value for.", + "description": "The ID of the Product Option to set the value for.", "type": "string" }, "value": { @@ -7624,7 +9490,7 @@ "in": "path", "name": "id", "required": true, - "description": "Id of the product to search for the variants.", + "description": "ID of the product to search for the variants.", "schema": { "type": "string" } @@ -7648,17 +9514,19 @@ { "in": "query", "name": "offset", - "description": "How many products to skip in the result.", + "description": "How many items to skip before the results.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { "in": "query", "name": "limit", - "description": "Limit the number of products returned.", + "description": "Limit the number of items returned.", "schema": { - "type": "string" + "type": "integer", + "default": 100 } } ], @@ -7677,6 +9545,18 @@ "items": { "$ref": "#/components/schemas/product_variant" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -7697,7 +9577,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7706,7 +9586,7 @@ "in": "path", "name": "option_id", "required": true, - "description": "The id of the Product Option.", + "description": "The ID of the Product Option.", "schema": { "type": "string" } @@ -7722,16 +9602,19 @@ "application/json": { "schema": { "properties": { - "id": { + "option_id": { "type": "string", - "description": "The id of the deleted Product Option" + "description": "The ID of the deleted Product Option" }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "option" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true }, "product": { "$ref": "#/components/schemas/product" @@ -7753,7 +9636,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7762,7 +9645,7 @@ "in": "path", "name": "option_id", "required": true, - "description": "The id of the Product Option.", + "description": "The ID of the Product Option.", "schema": { "type": "string" } @@ -7817,7 +9700,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7835,14 +9718,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Product." + "description": "The ID of the deleted Product." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "product" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -7861,7 +9747,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7897,7 +9783,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -7920,10 +9806,6 @@ "description": "A description of the Product.", "type": "string" }, - "is_giftcard": { - "description": "A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to `true` will result in a Gift Card being created.", - "type": "boolean" - }, "discountable": { "description": "A flag to indicate if discounts can be applied to the LineItems generated from this Product", "type": "boolean" @@ -7943,10 +9825,27 @@ "description": "A unique handle to identify the Product by.", "type": "string" }, + "status": { + "description": "The status of the product.", + "type": "string", + "enum": [ + "draft", + "proposed", + "published", + "rejected" + ] + }, "type": { "description": "The Product Type to associate the Product with.", "type": "object", + "required": [ + "value" + ], "properties": { + "id": { + "description": "The ID of the Product Type.", + "type": "string" + }, "value": { "description": "The value of the Product Type.", "type": "string" @@ -7954,16 +9853,19 @@ } }, "collection_id": { - "description": "The id of the Collection the Product should belong to.", + "description": "The ID of the Collection the Product should belong to.", "type": "string" }, "tags": { "description": "Tags to associate the Product with.", "type": "array", "items": { + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of an existing Tag.", + "description": "The ID of an existing Tag.", "type": "string" }, "value": { @@ -7973,13 +9875,16 @@ } } }, - "options": { - "description": "The Options that the Product should have. These define on which properties the Product's Product Variants will differ.", + "sales_channels": { + "description": "[EXPERIMENTAL] Sales channels to associate the Product with.", "type": "array", "items": { + "required": [ + "id" + ], "properties": { - "title": { - "description": "The title to identify the Product Option by.", + "id": { + "description": "The ID of an existing Sales channel.", "type": "string" } } @@ -7990,6 +9895,10 @@ "type": "array", "items": { "properties": { + "id": { + "description": "The ID of the Product Variant.", + "type": "string" + }, "title": { "description": "The title to identify the Product Variant by.", "type": "string" @@ -8028,19 +9937,19 @@ }, "weight": { "description": "The wieght of the Product Variant.", - "type": "string" + "type": "number" }, "length": { "description": "The length of the Product Variant.", - "type": "string" + "type": "number" }, "height": { "description": "The height of the Product Variant.", - "type": "string" + "type": "number" }, "width": { "description": "The width of the Product Variant.", - "type": "string" + "type": "number" }, "origin_country": { "description": "The country of origin of the Product Variant.", @@ -8061,21 +9970,36 @@ "prices": { "type": "array", "items": { + "required": [ + "amount" + ], "properties": { + "id": { + "description": "The ID of the Price.", + "type": "string" + }, "region_id": { - "description": "The id of the Region for which the price is used.", + "description": "The ID of the Region for which the price is used. Only required if currency_code is not provided.", "type": "string" }, "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", - "type": "string" + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "amount": { "description": "The amount to charge for the Product Variant.", "type": "integer" }, - "sale_amount": { - "description": "The sale amount to charge for the Product Variant.", + "min_quantity": { + "description": "The minimum quantity for which the price will be used.", + "type": "integer" + }, + "max_quantity": { + "description": "The maximum quantity for which the price will be used.", "type": "integer" } } @@ -8084,7 +10008,15 @@ "options": { "type": "array", "items": { + "required": [ + "option_id", + "value" + ], "properties": { + "option_id": { + "description": "The ID of the Option.", + "type": "string" + }, "value": { "description": "The value to give for the Product Option at the same index in the Product's `options` field.", "type": "string" @@ -8097,19 +10029,19 @@ }, "weight": { "description": "The wieght of the Product.", - "type": "string" + "type": "number" }, "length": { "description": "The length of the Product.", - "type": "string" + "type": "number" }, "height": { "description": "The height of the Product.", - "type": "string" + "type": "number" }, "width": { "description": "The width of the Product.", - "type": "string" + "type": "number" }, "origin_country": { "description": "The country of origin of the Product.", @@ -8164,7 +10096,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -8173,7 +10105,7 @@ "in": "path", "name": "variant_id", "required": true, - "description": "The id of the Product Variant.", + "description": "The ID of the Product Variant.", "schema": { "type": "string" } @@ -8189,16 +10121,22 @@ "application/json": { "schema": { "properties": { - "id": { + "variant_id": { "type": "string", - "description": "The id of the deleted Product Variant." + "description": "The ID of the deleted Product Variant." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "variant" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true + }, + "product": { + "$ref": "#/components/schemas/product" } } } @@ -8217,7 +10155,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -8226,7 +10164,7 @@ "in": "path", "name": "variant_id", "required": true, - "description": "The id of the Product Variant.", + "description": "The ID of the Product Variant.", "schema": { "type": "string" } @@ -8275,19 +10213,19 @@ }, "weight": { "description": "The wieght of the Product Variant.", - "type": "string" + "type": "number" }, "length": { "description": "The length of the Product Variant.", - "type": "string" + "type": "number" }, "height": { "description": "The height of the Product Variant.", - "type": "string" + "type": "number" }, "width": { "description": "The width of the Product Variant.", - "type": "string" + "type": "number" }, "origin_country": { "description": "The country of origin of the Product Variant.", @@ -8308,18 +10246,25 @@ "prices": { "type": "array", "items": { + "required": [ + "amount" + ], "properties": { "id": { - "description": "The id of the price.", + "description": "The ID of the price.", "type": "string" }, "region_id": { - "description": "The id of the Region for which the price is used.", + "description": "The ID of the Region for which the price is used. Only required if currency_code is not provided.", "type": "string" }, "currency_code": { - "description": "The 3 character ISO currency code for which the price will be used.", - "type": "string" + "description": "The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided.", + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "amount": { "description": "The amount to charge for the Product Variant.", @@ -8339,9 +10284,13 @@ "options": { "type": "array", "items": { + "required": [ + "option_id", + "value" + ], "properties": { "option_id": { - "description": "The id of the Product Option to set the value for.", + "description": "The ID of the Product Option to set the value for.", "type": "string" }, "value": { @@ -8377,6 +10326,49 @@ } } }, + "/products/tag-usage": { + "get": { + "operationId": "GetProductsTagUsage", + "summary": "List Product Tags Usage Number", + "description": "Retrieves a list of Product Tags with how many times each is used.", + "x-authenticated": true, + "tags": [ + "Product Tag" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tags": { + "type": "array", + "items": { + "properties": { + "id": { + "description": "The ID of the tag.", + "type": "string" + }, + "usage_count": { + "description": "The number of products that use this tag.", + "type": "string" + }, + "value": { + "description": "The value of the tag.", + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + }, "/products/types": { "get": { "operationId": "GetProductsTypes", @@ -8418,7 +10410,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Product.", + "description": "The ID of the Product.", "schema": { "type": "string" } @@ -8478,7 +10470,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -8494,7 +10486,11 @@ "properties": { "country_code": { "description": "The 2 character ISO code for the Country.", - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + } } } } @@ -8533,7 +10529,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -8548,7 +10544,7 @@ ], "properties": { "provider_id": { - "description": "The id of the Fulfillment Provider to add.", + "description": "The ID of the Fulfillment Provider to add.", "type": "string" } } @@ -8588,7 +10584,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -8603,7 +10599,7 @@ ], "properties": { "provider_id": { - "description": "The id of the Payment Provider to add.", + "description": "The ID of the Payment Provider to add.", "type": "string" } } @@ -8645,7 +10641,10 @@ "required": [ "name", "currency_code", - "tax_rate" + "tax_rate", + "payment_providers", + "fulfillment_providers", + "countries" ], "properties": { "name": { @@ -8654,7 +10653,11 @@ }, "currency_code": { "description": "The 3 character ISO currency code to use for the Region.", - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "tax_code": { "description": "An optional tax code the Region.", @@ -8665,21 +10668,24 @@ "type": "number" }, "payment_providers": { - "description": "A list of Payment Providers that should be enabled for the Region", + "description": "A list of Payment Provider IDs that should be enabled for the Region", "type": "array", "items": { "type": "string" } }, "fulfillment_providers": { - "description": "A list of Fulfillment Providers that should be enabled for the Region", + "description": "A list of Fulfillment Provider IDs that should be enabled for the Region", "type": "array", "items": { "type": "string" } }, "countries": { - "description": "A list of countries that should be included in the Region.", + "description": "A list of countries' 2 ISO Characters that should be included in the Region.", + "example": [ + "US" + ], "type": "array", "items": { "type": "string" @@ -8720,7 +10726,8 @@ "in": "query", "name": "limit", "schema": { - "type": "integer" + "type": "integer", + "default": 50 }, "required": false, "description": "limit the number of regions in response" @@ -8729,7 +10736,8 @@ "in": "query", "name": "offset", "schema": { - "type": "integer" + "type": "integer", + "default": 0 }, "required": false, "description": "Offset of regions in response (used for pagination)" @@ -8777,53 +10785,18 @@ "items": { "$ref": "#/components/schemas/region" } - } - } - } - } - } - } - } - } - }, - "/regions/{id}/metadata/{key}": { - "delete": { - "operationId": "DeleteRegionsRegionMetadataKey", - "summary": "Delete Metadata", - "description": "Deletes a metadata key.", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Region.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "key", - "required": true, - "description": "The metadata key.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -8844,7 +10817,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -8862,14 +10835,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Region." + "description": "The ID of the deleted Region." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "region" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -8888,7 +10864,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -8924,7 +10900,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -8941,7 +10917,11 @@ }, "currency_code": { "description": "The 3 character ISO currency code to use for the Region.", - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "automatic_taxes": { "description": "If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes.", @@ -8952,7 +10932,7 @@ "type": "boolean" }, "tax_provider_id": { - "description": "The id of the tax provider to use; if null the system tax provider is used", + "description": "The ID of the tax provider to use; if null the system tax provider is used", "type": "string" }, "tax_code": { @@ -8964,21 +10944,21 @@ "type": "number" }, "payment_providers": { - "description": "A list of Payment Providers that should be enabled for the Region", + "description": "A list of Payment Provider IDs that should be enabled for the Region", "type": "array", "items": { "type": "string" } }, "fulfillment_providers": { - "description": "A list of Fulfillment Providers that should be enabled for the Region", + "description": "A list of Fulfillment Provider IDs that should be enabled for the Region", "type": "array", "items": { "type": "string" } }, "countries": { - "description": "A list of countries that should be included in the Region.", + "description": "A list of countries' 2 ISO Characters that should be included in the Region.", "type": "array", "items": { "type": "string" @@ -9021,7 +11001,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -9043,11 +11023,20 @@ "properties": { "provider_id": { "type": "string", - "description": "id of the fulfillment provider" + "description": "ID of the fulfillment provider" }, "options": { - "type": "object", - "description": "fulfillment provider options" + "type": "array", + "description": "fulfillment provider options", + "example": [ + { + "id": "manual-fulfillment" + }, + { + "id": "manual-fulfillment-return", + "is_return": true + } + ] } } } @@ -9071,7 +11060,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -9079,10 +11068,14 @@ { "in": "path", "name": "country_code", - "required": true, "description": "The 2 character ISO code for the Country.", + "required": true, "schema": { - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } } } ], @@ -9118,7 +11111,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -9127,7 +11120,7 @@ "in": "path", "name": "provider_id", "required": true, - "description": "The id of the Fulfillment Provider.", + "description": "The ID of the Fulfillment Provider.", "schema": { "type": "string" } @@ -9165,7 +11158,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Region.", + "description": "The ID of the Region.", "schema": { "type": "string" } @@ -9174,7 +11167,7 @@ "in": "path", "name": "provider_id", "required": true, - "description": "The id of the Payment Provider.", + "description": "The ID of the Payment Provider.", "schema": { "type": "string" } @@ -9201,67 +11194,6 @@ } } }, - "/regions/{id}/metadata": { - "post": { - "operationId": "PostRegionsRegionMetadata", - "summary": "Set the metadata of a Region", - "description": "Sets the metadata of a Region", - "x-authenticated": true, - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Region.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Region" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "region": { - "$ref": "#/components/schemas/region" - } - } - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "key", - "value" - ], - "properties": { - "key": { - "type": "string", - "description": "Key for the metadata value." - }, - "value": { - "type": "string", - "description": "The value that the key relates to." - } - } - } - } - } - } - } - }, "/return-reasons": { "post": { "operationId": "PostReturnReasons", @@ -9286,7 +11218,7 @@ "type": "string" }, "parent_return_reason_id": { - "description": "The id of the parent return reason.", + "description": "The ID of the parent return reason.", "type": "string" }, "description": { @@ -9362,7 +11294,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the return reason", + "description": "The ID of the return reason", "schema": { "type": "string" } @@ -9380,14 +11312,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted return reason" + "description": "The ID of the deleted return reason" }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "return_reason" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -9406,7 +11341,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Return Reason.", + "description": "The ID of the Return Reason.", "schema": { "type": "string" } @@ -9442,7 +11377,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Return Reason.", + "description": "The ID of the Return Reason.", "schema": { "type": "string" } @@ -9457,6 +11392,10 @@ "description": "The label to display to the Customer.", "type": "string" }, + "value": { + "description": "The value that the Return Reason will be identified by. Must be unique.", + "type": "string" + }, "description": { "description": "An optional description to for the Reason.", "type": "string" @@ -9501,7 +11440,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Return.", + "description": "The ID of the Return.", "schema": { "type": "string" } @@ -9517,7 +11456,7 @@ "application/json": { "schema": { "properties": { - "return": { + "order": { "$ref": "#/components/schemas/order" } } @@ -9535,21 +11474,21 @@ "description": "Retrieves a list of Returns", "parameters": [ { - "in": "path", + "in": "query", "name": "limit", - "required": true, "description": "The upper limit for the amount of responses returned.", "schema": { - "type": "number" + "type": "number", + "default": "50" } }, { - "in": "path", + "in": "query", "name": "offset", - "required": true, "description": "The offset of the list returned.", "schema": { - "type": "number" + "type": "number", + "default": "0" } } ], @@ -9568,6 +11507,18 @@ "items": { "$ref": "#/components/schemas/return" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -9587,7 +11538,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Return.", + "description": "The ID of the Return.", "schema": { "type": "string" } @@ -9605,9 +11556,13 @@ "description": "The Line Items that have been received.", "type": "array", "items": { + "required": [ + "item_id", + "quantity" + ], "properties": { "item_id": { - "description": "The id of the Line Item.", + "description": "The ID of the Line Item.", "type": "string" }, "quantity": { @@ -9619,7 +11574,7 @@ }, "refund": { "description": "The amount to refund.", - "type": "integer" + "type": "number" } } } @@ -9647,6 +11602,539 @@ } } }, + "/sales-channels/{id}/products/batch": { + "post": { + "operationId": "PostSalesChannelsChannelProductsBatch", + "summary": "Assign a batch of product to a sales channel", + "description": "Assign a batch of product to a sales channel.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Sales channel.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "product_ids" + ], + "properties": { + "product_ids": { + "description": "The IDs of the products to add to the Sales Channel", + "type": "array", + "items": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the product" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "sales_channel": { + "$ref": "#/components/schemas/sales_channel" + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "DeleteSalesChannelsChannelProductsBatch", + "summary": "Remove a list of products from a sales channel", + "description": "Remove a list of products from a sales channel.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Sales Channel", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "product_ids" + ], + "properties": { + "product_ids": { + "description": "The IDs of the products to delete from the Sales Channel.", + "type": "array", + "items": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "description": "The ID of a product", + "type": "string" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "sales_channel": { + "$ref": "#/components/schemas/sales_channel" + } + } + } + } + } + } + } + } + }, + "/sales-channels": { + "post": { + "operationId": "PostSalesChannels", + "summary": "Create a Sales Channel", + "description": "Creates a Sales Channel.", + "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "name" + ], + "properties": { + "name": { + "description": "The name of the Sales Channel", + "type": "string" + }, + "description": { + "description": "The description of the Sales Channel", + "type": "string" + }, + "is_disabled": { + "description": "Whether the Sales Channel is disabled or not.", + "type": "boolean" + } + } + } + } + } + }, + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "sales_channel": { + "$ref": "#/components/schemas/sales_channel" + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetSalesChannels", + "summary": "List sales channels", + "description": "Retrieves a list of sales channels", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "id", + "description": "ID of the sales channel", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "name", + "description": "Name of the sales channel", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "description", + "description": "Description of the sales channel", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "q", + "description": "Query used for searching sales channels' names and descriptions.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "order", + "description": "The field to order the results by.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting collections were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting collections were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "deleted_at", + "description": "Date comparison for when resulting collections were deleted.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "offset", + "description": "How many sales channels to skip in the result.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of sales channels returned.", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each sales channel of the result.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in each sales channel of the result.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "sales_channels": { + "type": "array", + "items": { + "$ref": "#/components/schemas/sales_channel" + } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, + "/sales-channels/{id}": { + "delete": { + "operationId": "DeleteSalesChannelsSalesChannel", + "summary": "Delete a sales channel", + "description": "Deletes the sales channel.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Sales channel.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the deleted sales channel" + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted.", + "default": "sales-channel" + }, + "deleted": { + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetSalesChannelsSalesChannel", + "summary": "Retrieve a sales channel", + "description": "Retrieves the sales channel.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Sales channel.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "sales_channel": { + "$ref": "#/components/schemas/sales_channel" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostSalesChannelsSalesChannel", + "summary": "Update a Sales Channel", + "description": "Updates a Sales Channel.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The ID of the Sales Channel.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "type": "string", + "description": "Name of the sales channel." + }, + "description": { + "type": "string", + "description": "Sales Channel description." + }, + "is_disabled": { + "type": "boolean", + "description": "Indication of if the sales channel is active." + } + } + } + } + } + }, + "tags": [ + "Sales Channel" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "sales_channel": { + "$ref": "#/components/schemas/sales_channel" + } + } + } + } + } + } + } + } + }, "/shipping-options": { "post": { "operationId": "PostShippingOptions", @@ -9657,21 +12145,28 @@ "content": { "application/json": { "schema": { + "required": [ + "name", + "region_id", + "provider_id", + "data", + "price_type" + ], "properties": { "name": { "description": "The name of the Shipping Option", "type": "string" }, "region_id": { - "description": "The id of the Region in which the Shipping Option will be available.", + "description": "The ID of the Region in which the Shipping Option will be available.", "type": "string" }, "provider_id": { - "description": "The id of the Fulfillment Provider that handles the Shipping Option.", + "description": "The ID of the Fulfillment Provider that handles the Shipping Option.", "type": "string" }, "profile_id": { - "description": "The id of the Shipping Profile to add the Shipping Option to.", + "description": "The ID of the Shipping Profile to add the Shipping Option to.", "type": "number" }, "data": { @@ -9694,6 +12189,10 @@ "description": "The requirements that must be satisfied for the Shipping Option to be available.", "type": "array", "items": { + "required": [ + "type", + "amount" + ], "properties": { "type": { "description": "The type of the requirement", @@ -9712,11 +12211,13 @@ }, "is_return": { "description": "Whether the Shipping Option defines a return shipment.", - "type": "boolean" + "type": "boolean", + "default": false }, "admin_only": { "description": "If true, the option can be used for draft orders", - "type": "boolean" + "type": "boolean", + "default": false }, "metadata": { "description": "An optional set of key-value pairs with additional information.", @@ -9759,7 +12260,7 @@ "schema": { "type": "string" }, - "description": "Region to fetch options from" + "description": "Region ID to fetch options from" }, { "in": "query", @@ -9767,7 +12268,7 @@ "schema": { "type": "boolean" }, - "description": "Flag for fetching return options" + "description": "Flag for fetching return options only" }, { "in": "query", @@ -9793,6 +12294,10 @@ "items": { "$ref": "#/components/schemas/shipping_option" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" } } } @@ -9813,7 +12318,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Option.", + "description": "The ID of the Shipping Option.", "schema": { "type": "string" } @@ -9831,14 +12336,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Shipping Option." + "description": "The ID of the deleted Shipping Option." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "shipping-option" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -9857,7 +12365,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Option.", + "description": "The ID of the Shipping Option.", "schema": { "type": "string" } @@ -9893,7 +12401,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Option.", + "description": "The ID of the Shipping Option.", "schema": { "type": "string" } @@ -9903,6 +12411,9 @@ "content": { "application/json": { "schema": { + "required": [ + "requirements" + ], "properties": { "name": { "description": "The name of the Shipping Option", @@ -9924,7 +12435,15 @@ "description": "The requirements that must be satisfied for the Shipping Option to be available.", "type": "array", "items": { + "required": [ + "type", + "amount" + ], "properties": { + "id": { + "description": "The ID of the requirement", + "type": "string" + }, "type": { "description": "The type of the requirement", "type": "string", @@ -10049,7 +12568,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Profile.", + "description": "The ID of the Shipping Profile.", "schema": { "type": "string" } @@ -10067,14 +12586,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Shipping Profile." + "description": "The ID of the deleted Shipping Profile." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "shipping_profile" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -10093,7 +12615,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Profile.", + "description": "The ID of the Shipping Profile.", "schema": { "type": "string" } @@ -10128,7 +12650,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Profile.", + "description": "The ID of the Shipping Profile.", "schema": { "type": "string" } @@ -10158,7 +12680,7 @@ "application/json": { "schema": { "properties": { - "shipping_profiles": { + "shipping_profile": { "$ref": "#/components/schemas/shipping_profile" } } @@ -10182,7 +12704,11 @@ "required": true, "description": "The 3 character ISO currency code.", "schema": { - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } } } ], @@ -10218,7 +12744,11 @@ "required": true, "description": "The 3 character ISO currency code.", "schema": { - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } } } ], @@ -10297,7 +12827,22 @@ }, "default_currency_code": { "description": "The default currency code for the Store.", - "type": "string" + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currencies": { + "description": "Array of currencies in 2 character ISO code format.", + "type": "array", + "items": { + "type": "string" + } + }, + "metadata": { + "description": "An optional set of key-value pairs with additional information.", + "type": "object" } } } @@ -10344,7 +12889,7 @@ "payment_providers": { "type": "array", "items": { - "$ref": "#/components/schemas/store" + "$ref": "#/components/schemas/payment_provider" } } } @@ -10374,7 +12919,7 @@ "tax_providers": { "type": "array", "items": { - "$ref": "#/components/schemas/store" + "$ref": "#/components/schemas/tax_provider" } } } @@ -10396,7 +12941,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Swap.", + "description": "The ID of the Swap.", "schema": { "type": "string" } @@ -10428,6 +12973,26 @@ "operationId": "GetSwaps", "summary": "List Swaps", "description": "Retrieves a list of Swaps.", + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "The upper limit for the amount of responses returned.", + "schema": { + "type": "number", + "default": "50" + } + }, + { + "in": "query", + "name": "offset", + "description": "The offset of the list returned.", + "schema": { + "type": "number", + "default": "0" + } + } + ], "x-authenticated": true, "tags": [ "Swap" @@ -10444,6 +13009,18 @@ "items": { "$ref": "#/components/schemas/swap" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -10458,9 +13035,57 @@ "operationId": "PostTaxRatesTaxRateProductTypes", "summary": "Add Tax Rate to Product Types", "description": "Associates a Tax Rate with a list of Product Types", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "product_types" + ], + "properties": { + "product_types": { + "type": "array", + "description": "The IDs of the types of products to associate with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10470,10 +13095,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10486,9 +13108,57 @@ "operationId": "DeleteTaxRatesTaxRateProductTypes", "summary": "Remove Tax Rate from Product Types", "description": "Removes a Tax Rate from a list of Product Types", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "product_types" + ], + "properties": { + "product_types": { + "type": "array", + "description": "The IDs of the types of products to remove association with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10498,10 +13168,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10516,9 +13183,57 @@ "operationId": "PostTaxRatesTaxRateProducts", "summary": "Add Tax Rate to Products", "description": "Associates a Tax Rate with a list of Products", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "products" + ], + "properties": { + "products": { + "type": "array", + "description": "The IDs of the products to associate with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10528,10 +13243,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10544,9 +13256,57 @@ "operationId": "DeleteTaxRatesTaxRateProducts", "summary": "Removes Tax Rate from Products", "description": "Removes a Tax Rate from a list of Products", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "products" + ], + "properties": { + "products": { + "type": "array", + "description": "The IDs of the products to remove association with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10556,10 +13316,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10573,10 +13330,58 @@ "post": { "operationId": "PostTaxRatesTaxRateShippingOptions", "summary": "Add Tax Rate to Product Types", - "description": "Associates a Tax Rate with a list of Product Types", + "description": "Associates a Tax Rate with a list of Shipping Options", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "shipping_options" + ], + "properties": { + "shipping_options": { + "type": "array", + "description": "The IDs of the shipping options to associate with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10586,10 +13391,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10602,9 +13404,57 @@ "operationId": "DeleteTaxRatesTaxRateShippingOptions", "summary": "Removes a Tax Rate from Product Types", "description": "Removes a Tax Rate from a list of Product Types", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "shipping_options" + ], + "properties": { + "shipping_options": { + "type": "array", + "description": "The IDs of the shipping options to remove association with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10614,10 +13464,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10632,9 +13479,89 @@ "operationId": "PostTaxRates", "summary": "Create a Tax Rate", "description": "Creates a Tax Rate", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "code", + "name", + "region_id" + ], + "properties": { + "code": { + "type": "string", + "description": "A code to identify the tax type by" + }, + "name": { + "type": "string", + "description": "A human friendly name for the tax" + }, + "region_id": { + "type": "string", + "description": "The ID of the Region that the rate belongs to" + }, + "rate": { + "type": "number", + "description": "The numeric rate to charge" + }, + "products": { + "type": "array", + "description": "The IDs of the products associated with this tax rate", + "items": { + "type": "string" + } + }, + "shipping_options": { + "type": "array", + "description": "The IDs of the shipping options associated with this tax rate", + "items": { + "type": "string" + } + }, + "product_types": { + "type": "array", + "description": "The IDs of the types of products associated with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10644,10 +13571,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10664,16 +13588,8 @@ "parameters": [ { "in": "query", - "name": "q", - "description": "Query used for searching orders.", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "id", - "description": "Id of the order to search for.", + "name": "name", + "description": "Name of tax rate to retrieve", "schema": { "type": "string" } @@ -10681,15 +13597,27 @@ { "in": "query", "name": "region_id", - "description": "to search for.", + "style": "form", + "explode": false, + "description": "Filter by Region ID", "schema": { - "type": "string" + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] } }, { "in": "query", "name": "code", - "description": "to search for.", + "description": "code to search for.", "schema": { "type": "string" } @@ -10697,54 +13625,85 @@ { "in": "query", "name": "rate", - "description": "to search for.", + "style": "form", + "explode": false, + "description": "Filter by Rate", "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "created_at", - "description": "Date comparison for when resulting orders was created, i.e. less than, greater than etc.", - "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "updated_at", - "description": "Date comparison for when resulting orders was updated, i.e. less than, greater than etc.", - "schema": { - "type": "object" + "oneOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "lt": { + "type": "number", + "description": "filter by rates less than this number" + }, + "gt": { + "type": "number", + "description": "filter by rates greater than this number" + }, + "lte": { + "type": "number", + "description": "filter by rates less than or equal to this number" + }, + "gte": { + "type": "number", + "description": "filter by rates greater than or equal to this number" + } + } + } + ] } }, { "in": "query", "name": "offset", - "description": "How many orders to skip in the result.", + "description": "How many tax rates to skip before retrieving the result.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { "in": "query", "name": "limit", - "description": "Limit the number of orders returned.", + "description": "Limit the number of tax rates returned.", "schema": { - "type": "string" + "type": "integer", + "default": 50 } }, { "in": "query", "name": "fields", - "description": "(Comma separated) Which fields should be included in each order of the result.", + "description": "Which fields should be included in each item.", + "style": "form", + "explode": false, "schema": { - "type": "string" + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved for each item.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } } } ], "tags": [ - "Order" + "Tax Rate" ], "responses": { "200": { @@ -10753,11 +13712,23 @@ "application/json": { "schema": { "properties": { - "orders": { + "tax_rates": { "type": "array", "items": { - "$ref": "#/components/schemas/order" + "$ref": "#/components/schemas/tax_rate" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -10778,14 +13749,14 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Shipping Option.", + "description": "The ID of the Shipping Option.", "schema": { "type": "string" } } ], "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10796,14 +13767,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Shipping Option." + "description": "The ID of the deleted Shipping Option." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "tax-rate" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -10818,9 +13792,37 @@ "operationId": "GetTaxRatesTaxRate", "summary": "Get Tax Rate", "description": "Retrieves a TaxRate", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10830,10 +13832,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10846,9 +13845,84 @@ "operationId": "PostTaxRatesTaxRate", "summary": "Update a Tax Rate", "description": "Updates a Tax Rate", + "parameters": [ + { + "in": "query", + "name": "fields", + "description": "Which fields should be included in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "in": "query", + "name": "expand", + "description": "Which fields should be expanded and retrieved in the result.", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "code": { + "type": "string", + "description": "A code to identify the tax type by" + }, + "name": { + "type": "string", + "description": "A human friendly name for the tax" + }, + "region_id": { + "type": "string", + "description": "The ID of the Region that the rate belongs to" + }, + "rate": { + "type": "number", + "description": "The numeric rate to charge" + }, + "products": { + "type": "array", + "description": "The IDs of the products associated with this tax rate", + "items": { + "type": "string" + } + }, + "shipping_options": { + "type": "array", + "description": "The IDs of the shipping options associated with this tax rate", + "items": { + "type": "string" + } + }, + "product_types": { + "type": "array", + "description": "The IDs of the types of products associated with this tax rate", + "items": { + "type": "string" + } + } + } + } + } + } + }, "tags": [ - "Tax Rates" + "Tax Rate" ], "responses": { "200": { @@ -10858,10 +13932,7 @@ "schema": { "properties": { "tax_rate": { - "type": "array", - "items": { - "$ref": "#/components/schemas/tax_rate" - } + "$ref": "#/components/schemas/tax_rate" } } } @@ -10871,14 +13942,14 @@ } } }, - "/": { + "/uploads": { "post": { "operationId": "PostUploads", - "summary": "Uploads an array of files", - "description": "Uploads an array of files to the specific fileservice that is installed in medusa.", + "summary": "Uploads a file", + "description": "Uploads a file to the specific fileservice that is installed in Medusa.", "x-authenticated": true, "tags": [ - "Uploads" + "Upload" ], "requestBody": { "content": { @@ -10887,11 +13958,8 @@ "type": "object", "properties": { "files": { - "type": "array", - "items": { - "type": "string", - "format": "binary" - } + "type": "string", + "format": "binary" } } } @@ -10908,7 +13976,14 @@ "uploads": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL of the uploaded file.", + "format": "uri" + } + } } } } @@ -10936,7 +14011,8 @@ "properties": { "email": { "description": "The Users email.", - "type": "string" + "type": "string", + "format": "email" }, "first_name": { "description": "The name of the User.", @@ -10948,11 +14024,17 @@ }, "role": { "description": "Userrole assigned to the user.", - "type": "string" + "type": "string", + "enum": [ + "admin", + "member", + "developer" + ] }, "password": { "description": "The Users password.", - "type": "string" + "type": "string", + "format": "password" } } } @@ -10960,7 +14042,7 @@ } }, "tags": [ - "Users" + "User" ], "responses": { "200": { @@ -10985,7 +14067,7 @@ "description": "Retrieves all users.", "x-authenticated": true, "tags": [ - "Users" + "User" ], "responses": { "200": { @@ -11008,7 +14090,7 @@ } } }, - "/users/{user_id}": { + "/users/{id}": { "delete": { "operationId": "DeleteUsersUser", "summary": "Delete a User", @@ -11017,9 +14099,9 @@ "parameters": [ { "in": "path", - "name": "user_id", + "name": "id", "required": true, - "description": "The id of the User.", + "description": "The ID of the User.", "schema": { "type": "string" } @@ -11037,14 +14119,17 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Shipping Profile." + "description": "The ID of the deleted user." }, "object": { "type": "string", - "description": "The type of the object that was deleted." + "description": "The type of the object that was deleted.", + "default": "user" }, "deleted": { - "type": "boolean" + "type": "boolean", + "description": "Whether or not the items were deleted.", + "default": true } } } @@ -11053,24 +14138,24 @@ } } }, - "post": { - "operationId": "PostUsersUser", - "summary": "Update a User", - "description": "Updates a User", + "get": { + "operationId": "GetUsersUser", + "summary": "Retrieve a User", + "description": "Retrieves a User.", "x-authenticated": true, "parameters": [ { "in": "path", - "name": "user_id", + "name": "id", "required": true, - "description": "The id of the User.", + "description": "The ID of the User.", "schema": { "type": "string" } } ], "tags": [ - "Users" + "User" ], "responses": { "200": { @@ -11087,61 +14172,61 @@ } } } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "first_name", - "last_name", - "role", - "api_token" - ], - "properties": { - "first_name": { - "type": "string", - "description": "The name of the User." - }, - "last_name": { - "type": "string", - "description": "The name of the User." - }, - "role": { - "type": "string", - "description": "The role of the User(admin, member, developer)." - }, - "api_token": { - "type": "string", - "description": "The api_token of the User." - } - } - } - } - } } - } - }, - "/users/{id}": { - "get": { - "operationId": "GetUsersUser", - "summary": "Retrieve a User", - "description": "Retrieves a User.", - "x-authenticated": true, + }, + "post": { + "operationId": "PostUsersUser", + "summary": "Update a User", + "description": "Updates a User", "parameters": [ { "in": "path", "name": "id", "required": true, - "description": "The id of the User.", + "description": "The ID of the User.", "schema": { "type": "string" } } ], + "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "first_name": { + "description": "The name of the User.", + "type": "string" + }, + "last_name": { + "description": "The name of the User.", + "type": "string" + }, + "role": { + "description": "Userrole assigned to the user.", + "type": "string", + "enum": [ + "admin", + "member", + "developer" + ] + }, + "api_token": { + "description": "The api token of the User.", + "type": "string" + }, + "metadata": { + "description": "An optional set of key-value pairs with additional information.", + "type": "object" + } + } + } + } + } + }, "tags": [ - "Users" + "User" ], "responses": { "200": { @@ -11162,6 +14247,40 @@ } }, "/users/password-token": { + "post": { + "operationId": "PostUsersUserPasswordToken", + "summary": "Generate a password token for a User.", + "description": "Generates a password token for a User with a given email.", + "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "email" + ], + "properties": { + "email": { + "description": "The Users email.", + "type": "string", + "format": "email" + } + } + } + } + } + }, + "tags": [ + "User" + ], + "responses": { + "204": { + "description": "OK" + } + } + } + }, + "/users/reset-password": { "post": { "operationId": "PostUsersUserPassword", "summary": "Set the password for a User.", @@ -11172,14 +14291,14 @@ "application/json": { "schema": { "required": [ - "email", "token", "password" ], "properties": { "email": { "description": "The Users email.", - "type": "string" + "type": "string", + "format": "email" }, "token": { "description": "The token generated from the 'password-token' endpoint.", @@ -11187,7 +14306,8 @@ }, "password": { "description": "The Users new password.", - "type": "string" + "type": "string", + "format": "password" } } } @@ -11195,7 +14315,7 @@ } }, "tags": [ - "Users" + "User" ], "responses": { "200": { @@ -11235,7 +14355,8 @@ "name": "offset", "description": "How many variants to skip in the result.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { @@ -11243,7 +14364,8 @@ "name": "limit", "description": "Limit the number of variants returned.", "schema": { - "type": "string" + "type": "integer", + "default": 20 } } ], @@ -11262,6 +14384,18 @@ "items": { "$ref": "#/components/schemas/product_variant" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -11280,34 +14414,102 @@ "x-resourceId": "address", "properties": { "id": { - "type": "string" + "type": "string", + "description": "ID of the address", + "example": "addr_01G8ZC9VS1XVE149MGH2J7QSSH" }, "customer_id": { - "type": "string" + "type": "string", + "description": "ID of the customer this address belongs to", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" + }, + "customer": { + "description": "Available if the relation `customer` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A customer object." + } }, "company": { - "type": "string" + "type": "string", + "description": "Company name", + "example": "Acme" }, "first_name": { - "type": "string" + "type": "string", + "description": "First name", + "example": "Arno" }, "last_name": { - "type": "string" + "type": "string", + "description": "Last name", + "example": "Willms" }, "address_1": { - "type": "string" + "type": "string", + "description": "Address line 1", + "example": "14433 Kemmer Court" }, "address_2": { - "type": "string" + "type": "string", + "description": "Address line 2", + "example": "Suite 369" }, "city": { - "type": "string" + "type": "string", + "description": "City", + "example": "South Geoffreyview" }, "country_code": { - "type": "string" + "type": "string", + "description": "The 2 character ISO code of the country in lower case", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + }, + "example": "st" }, "country": { - "$ref": "#/components/schemas/country" + "description": "A country object. Available if the relation `country` is expanded.", + "type": "object" + }, + "province": { + "type": "string", + "description": "Province", + "example": "Kentucky" + }, + "postal_code": { + "type": "string", + "description": "Postal Code", + "example": 72093 + }, + "phone": { + "type": "string", + "description": "Phone Number", + "example": 16128234334802 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11315,81 +14517,194 @@ "title": "Batch Job", "description": "A Batch Job.", "x-resourceId": "batch_job", + "required": [ + "type" + ], "properties": { "id": { + "type": "string", "description": "The unique identifier for the batch job.", - "type": "string" + "example": "batch_01G8T782965PYFG0751G0Z38B4" }, "type": { - "description": "The type of batch job.", "type": "string", + "description": "The type of batch job.", "enum": [ - "product_import", - "product_export" + "product-import", + "product-export" ] }, "status": { - "description": "The status of the batch job.", "type": "string", + "description": "The status of the batch job.", "enum": [ "created", "pre_processed", + "confirmed", "processing", "completed", "canceled", "failed" - ] + ], + "default": "created" }, "created_by": { + "type": "string", "description": "The unique identifier of the user that created the batch job.", - "type": "string" + "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" }, - "context": { - "description": "The context of the batch job, the type of the batch job determines what the context should contain.", + "created_by_user": { + "description": "A user object. Available if the relation `created_by_user` is expanded.", "type": "object" }, + "context": { + "type": "object", + "description": "The context of the batch job, the type of the batch job determines what the context should contain.", + "example": { + "shape": { + "prices": [ + { + "region": null, + "currency_code": "eur" + } + ], + "dynamicImageColumnCount": 4, + "dynamicOptionColumnCount": 2 + }, + "list_config": { + "skip": 0, + "take": 50, + "order": { + "created_at": "DESC" + }, + "relations": [ + "variants", + "variant.prices", + "images" + ] + } + } + }, "dry_run": { - "description": "Specify if the job must apply the modifications or not.", "type": "boolean", + "description": "Specify if the job must apply the modifications or not.", "default": false }, "result": { + "type": "object", "description": "The result of the batch job.", - "type": "object" + "properties": { + "count": { + "type": "number" + }, + "advancement_count": { + "type": "number" + }, + "progress": { + "type": "number" + }, + "errors": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "err": { + "type": "array" + } + } + }, + "stat_descriptors": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "file_key": { + "type": "string" + }, + "file_size": { + "type": "number" + } + }, + "example": { + "errors": [ + { + "err": [], + "code": "unknown", + "message": "Method not implemented." + } + ], + "stat_descriptors": [ + { + "key": "product-export-count", + "name": "Product count to export", + "message": "There will be 8 products exported by this action" + } + ] + } }, "pre_processed_at": { - "description": "The date from which the job has been pre processed.", "type": "string", + "description": "The date from which the job has been pre processed.", + "format": "date-time" + }, + "processing_at": { + "type": "string", + "description": "The date the job is processing at.", "format": "date-time" }, "confirmed_at": { - "description": "The date when the confirmation has been done.", "type": "string", + "description": "The date when the confirmation has been done.", "format": "date-time" }, "completed_at": { - "description": "The date of the completion.", "type": "string", + "description": "The date of the completion.", "format": "date-time" }, "canceled_at": { - "description": "The date of the concellation.", "type": "string", + "description": "The date of the concellation.", + "format": "date-time" + }, + "failed_at": { + "type": "string", + "description": "The date when the job failed.", "format": "date-time" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was last updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" } } @@ -11400,115 +14715,214 @@ "x-resourceId": "cart", "properties": { "id": { - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" }, "email": { - "type": "string" + "type": "string", + "description": "The email associated with the cart", + "format": "email" }, "billing_address_id": { - "type": "string" + "type": "string", + "description": "The billing address's ID", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "billing_address": { + "description": "Available if the relation `billing_address` is expanded.", "$ref": "#/components/schemas/address" }, "shipping_address_id": { - "type": "string" + "type": "string", + "description": "The shipping address's ID", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "shipping_address": { + "description": "Available if the relation `shipping_address` is expanded.", "$ref": "#/components/schemas/address" }, "items": { + "description": "Available if the relation `items` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/line_item" } }, "region_id": { - "type": "string" + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "$ref": "#/components/schemas/region" + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "discounts": { "type": "array", + "description": "Available if the relation `discounts` is expanded.", "items": { - "$ref": "#/components/schemas/region" + "type": "object", + "description": "A discount object." } }, "gift_cards": { "type": "array", + "description": "Available if the relation `gift_cards` is expanded.", "items": { - "$ref": "#/components/schemas/gift_card" + "type": "object", + "description": "A gift card object." } }, "customer_id": { - "type": "string" + "type": "string", + "description": "The customer's ID", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" }, "customer": { - "$ref": "#/components/schemas/customer" + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" }, "payment_session": { + "description": "The selected payment session in the cart.", "$ref": "#/components/schemas/payment_session" }, "payment_sessions": { "type": "array", + "description": "The payment sessions created on the cart.", "items": { "$ref": "#/components/schemas/payment_session" } }, + "payment_id": { + "type": "string", + "description": "The payment's ID if available", + "example": "pay_01G8ZCC5W42ZNY842124G7P5R9" + }, "payment": { + "description": "Available if the relation `payment` is expanded.", "$ref": "#/components/schemas/payment" }, "shipping_methods": { "type": "array", + "description": "The shipping methods added to the cart.", "items": { "$ref": "#/components/schemas/shipping_method" } }, "type": { "type": "string", + "description": "The cart's type.", "enum": [ "default", "swap", - "payment_link" - ] + "draft_order", + "payment_link", + "claim" + ], + "default": "default" }, "completed_at": { "type": "string", + "description": "The date with timezone at which the cart was completed.", "format": "date-time" }, + "payment_authorized_at": { + "type": "string", + "description": "The date with timezone at which the payment was authorized.", + "format": "date-time" + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of a cart in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "context": { + "type": "object", + "description": "The context of the cart which can include info like IP or user agent.", + "example": { + "ip": "::1", + "user_agent": "PostmanRuntime/7.29.2" + } + }, + "sales_channel_id": { + "type": "string", + "description": "The sales channel ID the cart is associated with.", + "example": null + }, + "sales_channel": { + "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", + "type": "object" + }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } }, "shipping_total": { - "type": "integer" + "type": "integer", + "description": "The total of shipping", + "example": 1000 }, "discount_total": { - "type": "integer" + "type": "integer", + "description": "The total of discount", + "example": 800 }, "tax_total": { - "type": "integer" + "type": "integer", + "description": "The total of tax", + "example": 0 + }, + "refunded_total": { + "type": "integer", + "description": "The total amount refunded if the order associated with this cart is returned.", + "example": 0 + }, + "total": { + "type": "integer", + "description": "The total amount of the cart", + "example": 8200 }, "subtotal": { - "type": "integer" + "type": "integer", + "description": "The subtotal of the cart", + "example": 8000 }, "refundable_amount": { - "type": "integer" + "type": "integer", + "description": "The amount that can be refunded", + "example": 8200 }, "gift_card_total": { - "type": "integer" + "type": "integer", + "description": "The total of gift cards", + "example": 0 + }, + "gift_card_tax_total": { + "type": "integer", + "description": "The total of gift cards with taxes", + "example": 0 } } }, @@ -11516,30 +14930,50 @@ "title": "Claim Image", "description": "Represents photo documentation of a claim.", "x-resourceId": "claim_image", + "required": [ + "claim_item_id", + "url" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The claim image's ID", + "example": "cimg_01G8ZH853Y6TFXWPG5EYE81X63" }, "claim_item_id": { - "type": "string" + "type": "string", + "description": "The ID of the claim item associated with the image" + }, + "claim_item": { + "description": "A claim item object. Available if the relation `claim_item` is expanded.", + "type": "object" }, "url": { - "type": "string" + "type": "string", + "description": "The URL of the image", + "format": "uri" }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11547,32 +14981,51 @@ "title": "Claim Item", "description": "Represents a claimed item along with information about the reasons for the claim.", "x-resourceId": "claim_item", + "required": [ + "claim_order_id", + "item_id", + "variant_id", + "reason", + "quantity" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The claim item's ID", + "example": "citm_01G8ZH853Y6TFXWPG5EYE81X63" }, "images": { "type": "array", + "description": "Available if the relation `images` is expanded.", "items": { "$ref": "#/components/schemas/claim_image" } }, "claim_order_id": { + "description": "The ID of the claim this item is associated with.", "type": "string" }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" + }, "item_id": { - "type": "string" + "description": "The ID of the line item that the claim item refers to.", + "type": "string", + "example": "item_01G8ZM25TN49YV9EQBE2NC27KC" }, "item": { - "description": "The Line Item that the claim refers to", + "description": "Available if the relation `item` is expanded.", "$ref": "#/components/schemas/line_item" }, "variant_id": { - "type": "string" + "description": "The ID of the product variant that is claimed.", + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" }, "variant": { - "description": "The Product Variant that is claimed.", - "$ref": "#/components/schemas/product_variant" + "description": "A variant object. Available if the relation `variant` is expanded.", + "type": "object" }, "reason": { "description": "The reason for the claim", @@ -11586,14 +15039,16 @@ }, "note": { "description": "An optional note about the claim, for additional information", - "type": "string" + "type": "string", + "example": "I don't like it." }, "quantity": { "description": "The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order.", - "type": "integer" + "type": "integer", + "example": 1 }, "tags": { - "description": "User defined tags for easy filtering and grouping.", + "description": "User defined tags for easy filtering and grouping. Available if the relation 'tags' is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/claim_tag" @@ -11601,18 +15056,25 @@ }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11620,9 +15082,15 @@ "title": "Claim Order", "description": "Claim Orders represent a group of faulty or missing items. Each claim order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns.", "x-resourceId": "claim_order", + "required": [ + "type", + "order_id" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The claim's ID", + "example": "claim_01G8ZH853Y6TFXWPG5EYE81X63" }, "type": { "type": "string", @@ -11633,11 +15101,13 @@ }, "payment_status": { "type": "string", + "description": "The status of the claim's payment", "enum": [ "na", "not_refunded", "refunded" - ] + ], + "default": "na" }, "fulfillment_status": { "type": "string", @@ -11651,7 +15121,8 @@ "returned", "canceled", "requires_action" - ] + ], + "default": "not_fulfilled" }, "claim_items": { "description": "The items that have been claimed", @@ -11668,19 +15139,25 @@ } }, "order_id": { - "description": "The id of the order that the claim comes from.", - "type": "string" + "description": "The ID of the order that the claim comes from.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "return_order": { - "description": "Holds information about the return if the claim is to be returned", - "$ref": "#/components/schemas/return" + "description": "A return object. Holds information about the return if the claim is to be returned. Available if the relation 'return_order' is expanded", + "type": "object" }, "shipping_address_id": { - "description": "The id of the address that the new items should be shipped to", - "type": "string" + "description": "The ID of the address that the new items should be shipped to", + "type": "string", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "shipping_address": { - "description": "The address that the new items should be shipped to", + "description": "Available if the relation `shipping_address` is expanded.", "$ref": "#/components/schemas/address" }, "shipping_methods": { @@ -11699,31 +15176,48 @@ }, "refund_amount": { "description": "The amount that will be refunded in conjunction with the claim", - "type": "integer" + "type": "integer", + "example": 1000 }, "canceled_at": { - "description": "The date with timezone at which the Swap was canceled.", + "description": "The date with timezone at which the claim was canceled.", "type": "string", "format": "date-time" }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + }, "no_notification": { "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean" + "type": "boolean", + "example": false }, - "metadata": { - "type": "object" + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } } } }, @@ -11731,33 +15225,41 @@ "title": "Claim Tag", "description": "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping.", "x-resourceId": "claim_tag", + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of the claim tag. Will be prefixed by `ctag_`.", - "type": "string" + "type": "string", + "description": "The claim tag's ID", + "example": "ctag_01G8ZCC5Y63B95V6B5SHBZ91S4" }, "value": { "description": "The value that the claim tag holds", - "type": "string" + "type": "string", + "example": "Damaged" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11765,30 +15267,64 @@ "title": "Country", "description": "Country details", "x-resourceId": "country", + "required": [ + "iso_2", + "iso_3", + "num_code", + "name", + "display_name" + ], "properties": { "id": { - "description": "The database id of the country", - "type": "integer" + "type": "string", + "description": "The country's ID", + "example": 109 }, "iso_2": { - "description": "The 2 character ISO code for the country.", - "type": "string" + "type": "string", + "description": "The 2 character ISO code of the country in lower case", + "example": "it", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "iso_3": { - "description": "The 3 character ISO code for the country.", - "type": "string" + "type": "string", + "description": "The 2 character ISO code of the country in lower case", + "example": "ita", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "num_code": { "description": "The numerical ISO code for the country.", - "type": "string" + "type": "string", + "example": 380, + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "name": { - "description": "The normalized country name; in upper case.", - "type": "string" + "description": "The normalized country name in upper case.", + "type": "string", + "example": "ITALY" }, "display_name": { "description": "The country name appropriate for display.", - "type": "string" + "type": "string", + "example": "Italy" + }, + "region_id": { + "type": "string", + "description": "The region ID this country is associated with.", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" + }, + "region": { + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" } } }, @@ -11796,22 +15332,36 @@ "title": "Currency", "description": "Currency", "x-resourceId": "currency", + "required": [ + "code", + "symbol", + "symbol_native", + "name" + ], "properties": { "code": { "description": "The 3 character ISO code for the currency.", - "type": "string" + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "symbol": { "description": "The symbol used to indicate the currency.", - "type": "string" + "type": "string", + "example": "$" }, "symbol_native": { "description": "The native symbol used to indicate the currency.", - "type": "string" + "type": "string", + "example": "$" }, "name": { "description": "The written name of the currency", - "type": "string" + "type": "string", + "example": "US Dollar" } } }, @@ -11819,49 +15369,60 @@ "title": "Custom Shipping Option", "description": "Custom Shipping Options are 'overriden' Shipping Options. Store managers can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option", "x-resourceId": "custom_shipping_option", + "required": [ + "price", + "shipping_option_id" + ], "properties": { "id": { - "description": "The id of the Custom Shipping Option. This value will be prefixed with `cso_`.", - "type": "string" + "type": "string", + "description": "The custom shipping option's ID", + "example": "cso_01G8X99XNB77DMFBJFWX6DN9V9" }, "price": { "description": "The custom price set that will override the shipping option's original price", - "type": "integer" + "type": "integer", + "example": 1000 }, "shipping_option_id": { - "description": "The id of the Shipping Option that the custom shipping option overrides", - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_option" - } - ] + "description": "The ID of the Shipping Option that the custom shipping option overrides", + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" + }, + "shipping_option": { + "description": "A shipping option object. Available if the relation `shipping_option` is expanded.", + "type": "object" }, "cart_id": { - "description": "The id of the Cart that the custom shipping option is attached to", - "anyOf": [ - { - "$ref": "#/components/schemas/cart" - } - ] + "description": "The ID of the Cart that the custom shipping option is attached to", + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11869,33 +15430,56 @@ "title": "Customer Group", "description": "Represents a customer group", "x-resourceId": "customer_group", + "required": [ + "name" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The customer group's ID", + "example": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63" }, "name": { - "type": "string" + "type": "string", + "description": "The name of the customer group", + "example": "VIP" }, "customers": { "type": "array", + "description": "The customers that belong to the customer group. Available if the relation `customers` is expanded.", "items": { - "$ref": "#/components/schemas/customer" + "type": "object", + "description": "A customer object." + } + }, + "price_lists": { + "type": "array", + "description": "The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded.", + "items": { + "$ref": "#/components/schemas/price_list" } }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11903,56 +15487,92 @@ "title": "Customer", "description": "Represents a customer", "x-resourceId": "customer", + "required": [ + "email" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The customer's ID", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" }, "email": { - "type": "string" + "type": "string", + "description": "The customer's email", + "format": "email" + }, + "first_name": { + "type": "string", + "description": "The customer's first name", + "example": "Arno" + }, + "last_name": { + "type": "string", + "description": "The customer's first name", + "example": "Willms" }, "billing_address_id": { - "type": "string" + "type": "string", + "description": "The customer's billing address ID", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "billing_address": { - "description": "The Customer's billing address.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "description": "Available if the relation `billing_address` is expanded.", + "$ref": "#/components/schemas/address" }, "shipping_addresses": { + "description": "Available if the relation `shipping_addresses` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/address" } }, - "first_name": { - "type": "string" - }, - "last_name": { - "type": "string" - }, "phone": { - "type": "string" + "type": "string", + "description": "The customer's phone number", + "example": 16128234334802 }, "has_account": { - "type": "boolean" + "type": "boolean", + "description": "Whether the customer has an account or not", + "default": false + }, + "orders": { + "description": "Available if the relation `orders` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "An order object." + } + }, + "groups": { + "description": "The customer groups the customer belongs to. Available if the relation `groups` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/customer_group" + } }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11960,33 +15580,45 @@ "title": "Product Tag Discount Condition", "description": "Associates a discount condition with a customer group", "x-resourceId": "discount_condition_customer_group", + "required": [ + "customer_group_id", + "condition_id" + ], "properties": { "customer_group_id": { - "description": "The id of the Product Tag", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "customer_group": { + "description": "Available if the relation `customer_group` is expanded.", + "$ref": "#/components/schemas/customer_group" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -11994,33 +15626,45 @@ "title": "Product Collection Discount Condition", "description": "Associates a discount condition with a product collection", "x-resourceId": "discount_condition_product_collection", + "required": [ + "product_collection_id", + "condition_id" + ], "properties": { "product_collection_id": { - "description": "The id of the Product Collection", - "type": "string" + "description": "The ID of the Product Collection", + "type": "string", + "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_collection": { + "description": "Available if the relation `product_collection` is expanded.", + "$ref": "#/components/schemas/product_collection" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12028,33 +15672,45 @@ "title": "Product Tag Discount Condition", "description": "Associates a discount condition with a product tag", "x-resourceId": "discount_condition_product_tag", + "required": [ + "product_tag_id", + "condition_id" + ], "properties": { "product_tag_id": { - "description": "The id of the Product Tag", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "ptag_01F0YESHPZYY3H4SJ3A5918SBN" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_tag": { + "description": "Available if the relation `product_tag` is expanded.", + "$ref": "#/components/schemas/product_tag" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12062,33 +15718,45 @@ "title": "Product Type Discount Condition", "description": "Associates a discount condition with a product type", "x-resourceId": "discount_condition_product", + "required": [ + "product_type_id", + "condition_id" + ], "properties": { "product_type_id": { - "description": "The id of the Product Type", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_type": { + "description": "Available if the relation `product_type` is expanded.", + "$ref": "#/components/schemas/product_type" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12096,33 +15764,45 @@ "title": "Product Discount Condition", "description": "Associates a discount condition with a product", "x-resourceId": "discount_condition_product", + "required": [ + "product_id", + "condition_id" + ], "properties": { "product_id": { - "description": "The id of the Product", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product": { + "description": "Available if the relation `product` is expanded.", + "$ref": "#/components/schemas/product" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12130,10 +15810,16 @@ "title": "Discount Condition", "description": "Holds rule conditions for when a discount is applicable", "x-resourceId": "discount_condition", + "required": [ + "type", + "operator", + "discount_rule_id" + ], "properties": { "id": { - "description": "The id of the Discount Condition. Will be prefixed by `discon_`.", - "type": "string" + "type": "string", + "description": "The discount condition's ID", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "type": { "description": "The type of the Condition", @@ -12146,24 +15832,84 @@ "customer_groups" ] }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "operator": { + "description": "The operator of the Condition", "type": "string", + "enum": [ + "in", + "not_in" + ] + }, + "discount_rule_id": { + "type": "string", + "description": "The ID of the discount rule associated with the condition", + "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" + }, + "discount_rule": { + "description": "Available if the relation `discount_rule` is expanded.", + "$ref": "#/components/schemas/discount_rule" + }, + "products": { + "description": "products associated with this condition if type = products. Available if the relation `products` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product object." + } + }, + "product_types": { + "description": "product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product type object." + } + }, + "product_tags": { + "description": "product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product tag object." + } + }, + "product_collections": { + "description": "product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product collection object." + } + }, + "customer_groups": { + "description": "customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A customer group object." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12171,10 +15917,15 @@ "title": "Discount Rule", "description": "Holds the rules that governs how a Discount is calculated when applied to a Cart.", "x-resourceId": "discount_rule", + "required": [ + "type", + "value" + ], "properties": { "id": { - "description": "The id of the Discount Rule. Will be prefixed by `dru_`.", - "type": "string" + "type": "string", + "description": "The discount rule's ID", + "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" }, "type": { "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers.", @@ -12183,15 +15934,18 @@ "fixed", "percentage", "free_shipping" - ] + ], + "example": "percentage" }, "description": { "description": "A short description of the discount", - "type": "string" + "type": "string", + "example": "10 Percent" }, "value": { "description": "The value that the discount represents; this will depend on the type of the discount", - "type": "integer" + "type": "integer", + "example": 10 }, "allocation": { "description": "The scope that the discount should apply to.", @@ -12199,33 +15953,38 @@ "enum": [ "total", "item" - ] + ], + "example": "total" }, "conditions": { - "description": "A set of conditions that can be used to limit when the discount can be used", + "description": "A set of conditions that can be used to limit when the discount can be used. Available if the relation `conditions` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/discount_condition" + "type": "object", + "description": "A discount condition object." } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12233,34 +15992,48 @@ "title": "Discount", "description": "Represents a discount that can be applied to a cart for promotional purposes.", "x-resourceId": "discount", + "required": [ + "code", + "is_dynamic" + ], "properties": { "id": { - "description": "The id of the Discount. Will be prefixed by `disc_`.", - "type": "string" + "type": "string", + "description": "The discount's ID", + "example": "disc_01F0YESMW10MGHWJKZSDDMN0VN" }, "code": { "description": "A unique code for the discount - this will be used by the customer to apply the discount", - "type": "string" + "type": "string", + "example": "10DISC" }, "is_dynamic": { "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts", - "type": "boolean" + "type": "boolean", + "example": false + }, + "rule_id": { + "type": "string", + "description": "The Discount Rule that governs the behaviour of the Discount", + "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" }, "rule": { - "description": "The Discount Rule that governs the behaviour of the Discount", - "anyOf": [ - { - "$ref": "#/components/schemas/discount_rule" - } - ] + "description": "Available if the relation `rule` is expanded.", + "$ref": "#/components/schemas/discount_rule" }, "is_disabled": { "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts", - "type": "boolean" + "type": "boolean", + "example": false }, "parent_discount_id": { + "type": "string", "description": "The Discount that the discount was created from. This will always be a dynamic discount", - "type": "string" + "example": "disc_01G8ZH853YPY9B94857DY91YGW" + }, + "parent_discount": { + "description": "Available if the relation `parent_discount` is expanded.", + "$ref": "#/components/schemas/discount" }, "starts_at": { "description": "The time at which the discount can be used.", @@ -12272,39 +16045,51 @@ "type": "string", "format": "date-time" }, + "valid_duration": { + "type": "string", + "description": "Duration the discount runs between", + "example": "P3Y6M4DT12H30M5S" + }, "regions": { - "description": "The Regions in which the Discount can be used", + "description": "The Regions in which the Discount can be used. Available if the relation `regions` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/region" + "type": "object", + "description": "A region object." } }, "usage_limit": { "description": "The maximum number of times that a discount can be used.", - "type": "integer" + "type": "integer", + "example": 100 }, "usage_count": { "description": "The number of times a discount has been used.", - "type": "integer" + "type": "integer", + "example": 50, + "default": 0 }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12314,66 +16099,86 @@ "x-resourceId": "draft-order", "properties": { "id": { - "type": "string" + "type": "string", + "description": "The draft order's ID", + "example": "dorder_01G8TJFKBG38YYFQ035MSVG03C" }, "status": { "type": "string", + "description": "The status of the draft order", "enum": [ "open", "completed" - ] + ], + "default": "open" }, "display_id": { - "type": "string" + "type": "string", + "description": "The draft order's display ID", + "example": 2 }, "cart_id": { - "type": "string" + "type": "string", + "description": "The ID of the cart associated with the draft order.", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" }, "cart": { - "anyOf": [ - { - "$ref": "#/components/schemas/cart" - } - ] + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "order_id": { - "type": "string" + "type": "string", + "description": "The ID of the order associated with the draft order.", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/order" - } - ] + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "canceled_at": { "type": "string", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "update_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "type": "string", + "description": "The date the draft order was canceled at.", "format": "date-time" }, "completed_at": { "type": "string", + "description": "The date the draft order was completed at.", "format": "date-time" }, "no_notification_order": { - "type": "boolean" - }, - "metadata": { - "type": "object" + "type": "boolean", + "description": "Whether to send the customer notifications regarding order updates.", + "example": false }, "idempotency_key": { - "type": "string" + "type": "string", + "description": "Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12381,26 +16186,34 @@ "title": "Fulfillment Item", "description": "Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item.", "x-resourceId": "fulfillment_item", + "required": [ + "fulfillment_id", + "item_id", + "quantity" + ], "properties": { "fulfillment_id": { "description": "The id of the Fulfillment that the Fulfillment Item belongs to.", - "type": "string" + "type": "string", + "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" }, "item_id": { "description": "The id of the Line Item that the Fulfillment Item references.", - "type": "string" + "type": "string", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" + }, + "fulfillment": { + "description": "A fulfillment object. Available if the relation `fulfillment` is expanded.", + "type": "object" }, "item": { - "description": "The Line Item that the Fulfillment Item references.", - "anyOf": [ - { - "$ref": "#/components/schemas/line_item" - } - ] + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" }, "quantity": { "description": "The quantity of the Line Item that is included in the Fulfillment.", - "type": "integer" + "type": "integer", + "example": 1 } } }, @@ -12411,11 +16224,13 @@ "properties": { "id": { "description": "The id of the fulfillment provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "manual" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "example": true } } }, @@ -12423,36 +16238,60 @@ "title": "Fulfillment", "description": "Fulfillments are created once store operators can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a provider, which is typically an external shipping aggregator, shipping partner og 3PL, most plugins will have asynchronous communications with these providers through webhooks in order to automatically update and synchronize the state of Fulfillments.", "x-resourceId": "fulfillment", + "required": [ + "provider_id" + ], "properties": { "id": { - "description": "The id of the Fulfillment. This value will be prefixed by `ful_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" }, "claim_order_id": { "description": "The id of the Claim that the Fulfillment belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" }, "swap_id": { "description": "The id of the Swap that the Fulfillment belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "order_id": { "description": "The id of the Order that the Fulfillment belongs to.", - "type": "string" + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "provider_id": { "description": "The id of the Fulfillment Provider responsible for handling the fulfillment", - "type": "string" + "type": "string", + "example": "manual" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/fulfillment_provider" }, "items": { - "description": "The Fulfillment Items in the Fulfillment - these hold information about how many of each Line Item has been fulfilled.", + "description": "The Fulfillment Items in the Fulfillment - these hold information about how many of each Line Item has been fulfilled. Available if the relation `items` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/fulfillment_item" } }, "tracking_links": { - "description": "The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment Provider.", + "description": "The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment Provider. Available if the relation `tracking_links` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/tracking_link" @@ -12466,6 +16305,11 @@ "type": "string" } }, + "data": { + "description": "This contains all the data necessary for the Fulfillment provider to handle the fulfillment.", + "type": "object", + "example": {} + }, "shipped_at": { "description": "The date with timezone at which the Fulfillment was shipped.", "type": "string", @@ -12473,26 +16317,43 @@ }, "no_notification": { "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean" + "type": "boolean", + "example": false }, "canceled_at": { "description": "The date with timezone at which the Fulfillment was canceled.", "type": "string", "format": "date-time" }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "idempotency_key": { "type": "string", + "description": "Randomly generated key used to continue the completion of the fulfillment in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12500,35 +16361,53 @@ "title": "Gift Card Transaction", "description": "Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order", "x-resourceId": "gift_card_transaction", + "required": [ + "gift_card_id", + "amount" + ], "properties": { "id": { - "description": "The id of the Gift Card Transaction. This value will be prefixed by `gct_`.", - "type": "string" + "type": "string", + "description": "The gift card transaction's ID", + "example": "gct_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "gift_card_id": { - "description": "The id of the Gift Card that was used in the transaction.", - "type": "string" + "description": "The ID of the Gift Card that was used in the transaction.", + "type": "string", + "example": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ" }, "gift_card": { - "description": "The Gift Card that was used in the transaction.", - "anyOf": [ - { - "$ref": "#/components/schemas/gift_card" - } - ] + "description": "A gift card object. Available if the relation `gift_card` is expanded.", + "type": "object" }, "order_id": { - "description": "The id of the Order that the Gift Card was used to pay for.", - "type": "string" + "description": "The ID of the Order that the Gift Card was used to pay for.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "amount": { "description": "The amount that was used from the Gift Card.", - "type": "integer" + "type": "integer", + "example": 10 }, "created_at": { "description": "The date with timezone at which the resource was created.", "type": "string", "format": "date-time" + }, + "is_taxable": { + "description": "Whether the transaction is taxable or not.", + "type": "boolean", + "example": false + }, + "tax_rate": { + "description": "The tax rate of the transaction", + "type": "number", + "example": 0 } } }, @@ -12536,42 +16415,55 @@ "title": "Gift Card", "description": "Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.", "x-resourceId": "gift_card", + "required": [ + "code", + "value", + "balance", + "region_id" + ], "properties": { "id": { - "description": "The id of the Gift Card. This value will be prefixed by `gift_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ" }, "code": { "description": "The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card.", - "type": "string" + "type": "string", + "example": "3RFT-MH2C-Y4YZ-XMN4" }, "value": { "description": "The value that the Gift Card represents.", - "type": "integer" + "type": "integer", + "example": 10 }, "balance": { "description": "The remaining value on the Gift Card.", - "type": "integer" + "type": "integer", + "example": 10 }, "region_id": { + "type": "string", "description": "The id of the Region in which the Gift Card is available.", - "type": "string" + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "description": "The Region in which the Gift Card is available.", - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "order_id": { + "type": "string", "description": "The id of the Order that the Gift Card was purchased in.", - "type": "string" + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "is_disabled": { "description": "Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts.", - "type": "boolean" + "type": "boolean", + "example": false }, "ends_at": { "description": "The time at which the Gift Card can no longer be used.", @@ -12579,23 +16471,93 @@ "format": "date-time" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "idempotency_key": { + "title": "Idempotency Key", + "description": "Idempotency Key is used to continue a process in case of any failure that might occur.", + "x-resourceId": "idempotency_key", + "required": [ + "idempotency_key" + ], + "properties": { + "id": { + "type": "string", + "description": "The idempotency key's ID", + "example": "ikey_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "idempotency_key": { + "description": "The unique randomly generated key used to determine the state of a process.", + "type": "string", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "description": "Date which the idempotency key was locked.", + "type": "string", + "format": "date-time" + }, + "locked_at": { + "description": "Date which the idempotency key was locked.", + "type": "string", + "format": "date-time" + }, + "request_method": { + "description": "The method of the request", + "type": "string", + "example": "POST" + }, + "request_params": { + "type": "object", + "description": "The parameters passed to the request", + "example": { + "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + } + }, + "request_path": { + "description": "The request's path", + "type": "string", + "example": "/store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete" + }, + "response_code": { + "type": "string", + "description": "The response's code.", + "example": 200 + }, + "response_body": { + "type": "object", + "description": "The response's body", + "example": { + "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + } + }, + "recovery_point": { + "type": "string", + "description": "Where to continue from.", + "default": "started" } } }, @@ -12603,33 +16565,41 @@ "title": "Image", "description": "Images holds a reference to a URL at which the image file can be found.", "x-resourceId": "image", + "required": [ + "url" + ], "properties": { "id": { - "description": "The id of the Image. This value will be prefixed by `img_`.", - "type": "string" + "type": "string", + "description": "The image's ID", + "example": "img_01G749BFYR6T8JTVW6SGW3K3E6" }, "url": { "description": "The URL at which the image file can be found.", - "type": "string" + "type": "string", + "format": "uri" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12637,45 +16607,175 @@ "title": "Invite", "description": "Represents an invite", "x-resourceId": "invite", + "required": [ + "user_email" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The invite's ID", + "example": "invite_01G8TKE4XYCTHSCK2GDEP47RE1" }, "user_email": { - "type": "string" + "type": "string", + "description": "The email of the user being invited.", + "format": "email" }, "role": { "type": "string", + "description": "The user's role.", "enum": [ "admin", "member", "developer" - ] + ], + "default": "member" }, "accepted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the invite was accepted or not.", + "example": false }, "token": { - "type": "string" + "type": "string", + "description": "The token used to accept the invite." }, "expores_at": { "type": "string", + "description": "The date the invite expires at.", "format": "date-time" }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "line_item_adjustment": { + "title": "Line Item Adjustment", + "description": "Represents an Line Item Adjustment", + "x-resourceId": "line_item_adjustment", + "required": [ + "item_id", + "description", + "amount" + ], + "properties": { + "id": { + "type": "string", + "description": "The invite's ID", + "example": "lia_01G8TKE4XYCTHSCK2GDEP47RE1" + }, + "item_id": { + "type": "string", + "description": "The ID of the line item", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" + }, + "item": { + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" + }, + "description": { + "type": "string", + "description": "The line item's adjustment description", + "example": "Adjusted item's price." + }, + "discount_id": { + "type": "string", + "description": "The ID of the discount associated with the adjustment", + "example": "disc_01F0YESMW10MGHWJKZSDDMN0VN" + }, + "discount": { + "description": "Available if the relation `discount` is expanded.", + "$ref": "#/components/schemas/discount" + }, + "amount": { + "type": "number", + "description": "The adjustment amount", + "example": 1000 + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "line_item_tax_line": { + "title": "Line Item Tax Line", + "description": "Represents an Line Item Tax Line", + "x-resourceId": "line_item_tax_line", + "required": [ + "item_id", + "rate", + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "The line item tax line's ID", + "example": "litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" + }, + "item_id": { + "type": "string", + "description": "The ID of the line item", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" + }, + "item": { + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" + }, + "code": { + "description": "A code to identify the tax type by", + "type": "string", + "example": "tax01" + }, + "name": { + "description": "A human friendly name for the tax", + "type": "string", + "example": "Tax Example" + }, + "rate": { + "description": "The numeric rate to charge tax by", + "type": "number", + "example": 10 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12683,100 +16783,198 @@ "title": "Line Item", "description": "Line Items represent purchasable units that can be added to a Cart for checkout. When Line Items are purchased they will get copied to the resulting order and can eventually be referenced in Fulfillments and Returns. Line Items may also be created when processing Swaps and Claims.", "x-resourceId": "line_item", + "required": [ + "title", + "unit_price", + "quantity" + ], "properties": { "id": { - "description": "The id of the Line Item. This value will be prefixed by `item_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" }, "cart_id": { - "description": "The id of the Cart that the Line Item belongs to.", - "type": "string" + "description": "The ID of the Cart that the Line Item belongs to.", + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "order_id": { - "description": "The id of the Order that the Line Item belongs to.", - "type": "string" + "description": "The ID of the Order that the Line Item belongs to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "swap_id": { "description": "The id of the Swap that the Line Item belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "claim_order_id": { "description": "The id of the Claim that the Line Item belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" + }, + "tax_lines": { + "description": "Available if the relation `tax_lines` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/line_item_tax_line" + } + }, + "adjustments": { + "description": "Available if the relation `adjustments` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/line_item_adjustment" + } }, "title": { "description": "The title of the Line Item, this should be easily identifiable by the Customer.", - "type": "string" + "type": "string", + "example": "Medusa Coffee Mug" }, "description": { "description": "A more detailed description of the contents of the Line Item.", - "type": "string" + "type": "string", + "example": "One Size" }, "thumbnail": { "description": "A URL string to a small image of the contents of the Line Item.", - "type": "string" + "type": "string", + "format": "uri", + "example": "https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png" + }, + "is_return": { + "description": "Is the item being returned", + "type": "boolean", + "example": false }, "is_giftcard": { "description": "Flag to indicate if the Line Item is a Gift Card.", - "type": "boolean" + "type": "boolean", + "example": false }, "should_merge": { "description": "Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item.", - "type": "boolean" + "type": "boolean", + "example": false }, "allow_discounts": { "description": "Flag to indicate if the Line Item should be included when doing discount calculations.", - "type": "boolean" + "type": "boolean", + "example": false + }, + "has_shipping": { + "description": "Flag to indicate if the Line Item has fulfillment associated with it.", + "type": "boolean", + "example": false }, "unit_price": { "description": "The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to.", - "type": "boolean" + "type": "boolean", + "example": 8000 }, "variant_id": { "description": "The id of the Product Variant contained in the Line Item.", - "type": "string" + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" }, "variant": { - "description": "The Product Variant contained in the Line Item.", - "anyOf": [ - { - "$ref": "#/components/schemas/product_variant" - } - ] + "description": "A product variant object. The Product Variant contained in the Line Item. Available if the relation `variant` is expanded.", + "type": "object" }, "quantity": { "description": "The quantity of the content in the Line Item.", - "type": "integer" + "type": "integer", + "example": 1 }, "fulfilled_quantity": { "description": "The quantity of the Line Item that has been fulfilled.", - "type": "integer" + "type": "integer", + "example": 0 }, "returned_quantity": { "description": "The quantity of the Line Item that has been returned.", - "type": "integer" + "type": "integer", + "example": 0 }, "shipped_quantity": { "description": "The quantity of the Line Item that has been shipped.", - "type": "integer" - }, - "created_at": { - "description": "The date with timezone at which the resource was created.", - "type": "string", - "format": "date-time" - }, - "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "integer", + "example": 0 }, "refundable": { "description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.", - "type": "integer" + "type": "integer", + "example": 0 + }, + "subtotal": { + "type": "integer", + "description": "The subtotal of the line item", + "example": 8000 + }, + "tax_total": { + "type": "integer", + "description": "The total of tax of the line item", + "example": 0 + }, + "total": { + "type": "integer", + "description": "The total amount of the line item", + "example": 8000 + }, + "original_total": { + "type": "integer", + "description": "The original total amount of the line item", + "example": 8000 + }, + "original_tax_total": { + "type": "integer", + "description": "The original tax total amount of the line item", + "example": 0 + }, + "discount_total": { + "type": "integer", + "description": "The total of discount of the line item", + "example": 0 + }, + "gift_card_total": { + "type": "integer", + "description": "The total of the gift card of the line item", + "example": 0 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12784,57 +16982,92 @@ "title": "Money Amount", "description": "Money Amounts represents an amount that a given Product Variant can be purcased for. Each Money Amount either has a Currency or Region associated with it to indicate the pricing in a given Currency or, for fully region-based pricing, the given price in a specific Region. If region-based pricing is used the amount will be in the currency defined for the Reigon.", "x-resourceId": "money_amount", + "required": [ + "currency_code", + "amount" + ], "properties": { "id": { - "description": "The id of the Money Amount. This value will be prefixed by `ma_`.", - "type": "string" + "type": "string", + "description": "The money amount's ID", + "example": "ma_01F0YESHRFQNH5S8Q0PK84YYZN" }, "currency_code": { "description": "The 3 character currency code that the Money Amount is given in.", - "type": "string" + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "amount": { "description": "The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost.", - "type": "integer" + "type": "integer", + "example": 100 }, "min_quantity": { "description": "The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.", - "type": "integer" + "type": "integer", + "example": 1 }, "max_quantity": { "description": "The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.", - "type": "integer" + "type": "integer", + "example": 1 + }, + "price_list_id": { + "type": "string", + "description": "The ID of the price list associated with the money amount", + "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" + }, + "price_list": { + "description": "Available if the relation `price_list` is expanded.", + "$ref": "#/components/schemas/price_list" }, "variant_id": { - "description": "The id of the Product Variant that the Money Amount belongs to.", - "type": "string" + "description": "The id of the Product Variant contained in the Line Item.", + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" + }, + "variant": { + "description": "The Product Variant contained in the Line Item. Available if the relation `variant` is expanded.", + "type": "object" }, "region_id": { - "description": "The id of the Region that the Money Amount is defined for.", - "type": "string" + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "description": "The Region that the Money Amount is defined for.", - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12842,49 +17075,62 @@ "title": "Note", "description": "Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these.", "x-resourceId": "note", + "required": [ + "value", + "resource_type", + "resource_id" + ], "properties": { "id": { - "description": "The id of the Note. This value will be prefixed by `note_`.", - "type": "string" + "type": "string", + "description": "The note's ID", + "example": "note_01G8TM8ENBMC7R90XRR1G6H26Q" }, "resource_type": { "description": "The type of resource that the Note refers to.", - "type": "string" + "type": "string", + "example": "order" }, "resource_id": { - "description": "The id of the resource that the Note refers to.", - "type": "string" + "description": "The ID of the resource that the Note refers to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "value": { "description": "The contents of the note.", - "type": "string" + "type": "string", + "example": "This order must be fulfilled on Monday" + }, + "author_id": { + "type": "string", + "description": "The ID of the author (user)", + "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" }, "author": { - "description": "The author of the note.", - "anyOf": [ - { - "$ref": "#/components/schemas/user" - } - ] + "description": "Available if the relation `author` is expanded.", + "$ref": "#/components/schemas/user" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -12892,14 +17138,19 @@ "title": "Notification Provider", "description": "Represents a notification provider plugin and holds its installation status.", "x-resourceId": "notification_provider", + "required": [ + "id" + ], "properties": { "id": { "description": "The id of the notification provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "sendgrid" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "default": true } } }, @@ -12907,46 +17158,50 @@ "title": "Notification", "description": "Notifications a communications sent via Notification Providers as a reaction to internal events such as `order.placed`. Notifications can be used to show a chronological timeline for communications sent to a Customer regarding an Order, and enables resends.", "x-resourceId": "notification", + "required": [ + "resource_type", + "resource_id", + "to" + ], "properties": { "id": { - "description": "The id of the Notification. This value will be prefixed by `noti_`.", - "type": "string" + "type": "string", + "description": "The notification's ID", + "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" }, "event_name": { "description": "The name of the event that the notification was sent for.", - "type": "string" + "type": "string", + "example": "order.placed" }, "resource_type": { "description": "The type of resource that the Notification refers to.", - "type": "string" + "type": "string", + "example": "order" }, "resource_id": { - "description": "The id of the resource that the Notification refers to.", - "type": "string" + "description": "The ID of the resource that the Notification refers to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "customer_id": { - "description": "The id of the Customer that the Notification was sent to.", - "type": "string" + "description": "The ID of the Customer that the Notification was sent to.", + "type": "string", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" }, "customer": { - "description": "The Customer that the Notification was sent to.", - "anyOf": [ - { - "$ref": "#/components/schemas/customer" - } - ] + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" }, "to": { "description": "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", - "type": "string" + "type": "string", + "example": "user@example.com" }, "data": { "description": "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend.", - "type": "object" - }, - "parent_id": { - "description": "The id of the Notification that was originally sent.", - "type": "string" + "type": "object", + "example": {} }, "resends": { "description": "The resends that have been completed after the original Notification.", @@ -12957,16 +17212,21 @@ }, "provider_id": { "description": "The id of the Notification Provider that handles the Notification.", - "type": "string" + "type": "string", + "example": "sengrid" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/notification_provider" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" } } @@ -12977,45 +17237,70 @@ "x-resourceId": "notification_resend", "properties": { "id": { - "description": "The id of the Notification. This value will be prefixed by `noti_`.", - "type": "string" + "description": "The notification resend's ID", + "type": "string", + "example": "noti_01F0YET45G9NHP08Z66CE4QKBS" }, "event_name": { "description": "The name of the event that the notification was sent for.", - "type": "string" + "type": "string", + "example": "order.placed" }, "resource_type": { "description": "The type of resource that the Notification refers to.", - "type": "string" + "type": "string", + "example": "order" }, "resource_id": { - "description": "The id of the resource that the Notification refers to.", - "type": "string" + "description": "The ID of the resource that the Notification refers to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "customer_id": { + "description": "The ID of the Customer that the Notification was sent to.", + "type": "string", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" + }, + "customer": { + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" }, "to": { "description": "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", - "type": "string" + "type": "string", + "example": "user@example.com" }, "data": { "description": "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend.", - "type": "object" + "type": "object", + "example": {} }, "parent_id": { - "description": "The id of the Notification that was originally sent.", - "type": "string" + "description": "The ID of the Notification that was originally sent.", + "type": "string", + "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" + }, + "parent_notification": { + "description": "Available if the relation `parent_notification` is expanded.", + "$ref": "#/components/schemas/notification" }, "provider_id": { - "description": "The id of the Notification Provider that handles the Notification.", - "type": "string" + "description": "The ID of the Notification Provider that handles the Notification.", + "type": "string", + "example": "sengrid" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/notification_provider" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" } } @@ -13024,24 +17309,41 @@ "title": "OAuth", "description": "Represent an OAuth app", "x-resourceId": "OAuth", + "required": [ + "id", + "display_name", + "application_name" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The app's ID", + "example": "example_app" }, "display_name": { - "type": "string" + "type": "string", + "description": "The app's display name", + "example": "Example app" }, "application_name": { - "type": "string" + "type": "string", + "description": "The app's name", + "example": "example" }, "install_url": { - "type": "string" + "type": "string", + "description": "The URL to install the app", + "format": "uri" }, "uninstall_url": { - "type": "integer" + "type": "string", + "description": "The URL to uninstall the app", + "format": "uri" }, "data": { - "type": "object" + "type": "object", + "description": "Any data necessary to the app.", + "example": {} } } }, @@ -13049,22 +17351,33 @@ "title": "Order", "description": "Represents an order", "x-resourceId": "order", + "required": [ + "customer_id", + "email", + "region_id", + "currency_code" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The order's ID", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "status": { "type": "string", + "description": "The order's status", "enum": [ "pending", "completed", "archived", "canceled", "requires_action" - ] + ], + "default": "pending" }, "fulfillment_status": { "type": "string", + "description": "The order's fulfillment status", "enum": [ "not_fulfilled", "partially_fulfilled", @@ -13075,10 +17388,12 @@ "returned", "canceled", "requires_action" - ] + ], + "default": "not_fulfilled" }, "payment_status": { "type": "string", + "description": "The order's payment status", "enum": [ "not_paid", "awaiting", @@ -13087,185 +17402,255 @@ "refuneded", "canceled", "requires_action" - ] + ], + "default": "not_paid" }, "display_id": { - "type": "integer" + "type": "integer", + "description": "The order's display ID", + "example": 2 }, "cart_id": { - "type": "string" + "type": "string", + "description": "The ID of the cart associated with the order", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" + }, + "customer_id": { + "type": "string", + "description": "The ID of the customer associated with the order", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" + }, + "customer": { + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" + }, + "email": { + "description": "The email associated with the order", + "type": "string", + "format": "email" + }, + "billing_address_id": { + "type": "string", + "description": "The ID of the billing address associated with the order", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" + }, + "billing_address": { + "description": "Available if the relation `billing_address` is expanded.", + "$ref": "#/components/schemas/address" + }, + "shipping_address_id": { + "type": "string", + "description": "The ID of the shipping address associated with the order", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" + }, + "shipping_address": { + "description": "Available if the relation `shipping_address` is expanded.", + "$ref": "#/components/schemas/address" + }, + "region_id": { + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" + }, + "region": { + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "currency_code": { - "type": "string" + "description": "The 3 character currency code that is used in the order", + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "tax_rate": { - "type": "number" + "description": "The order's tax rate", + "type": "number", + "example": 0 }, "discounts": { "type": "array", + "description": "The discounts used in the order. Available if the relation `discounts` is expanded.", "items": { - "$ref": "#/components/schemas/discount" + "type": "object", + "description": "A discount object." } }, - "email": { - "type": "string" - }, - "billing_address_id": { - "type": "string" - }, - "billing_address": { - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address_id": { - "type": "string" - }, - "shipping_address": { - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "region_id": { - "type": "string" - }, - "region": { - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] - }, "gift_cards": { "type": "array", + "description": "The gift cards used in the order. Available if the relation `gift_cards` is expanded.", "items": { - "$ref": "#/components/schemas/gift_card" - } - }, - "customer_id": { - "type": "string" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/customer" - } - ] - }, - "payment_session": { - "anyOf": [ - { - "$ref": "#/components/schemas/payment_session" - } - ] - }, - "payment_sessions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/payment_session" - } - }, - "payments": { - "type": "array", - "items": { - "$ref": "#/components/schemas/payment" + "type": "object", + "description": "A gift card object." } }, "shipping_methods": { "type": "array", + "description": "The shipping methods used in the order. Available if the relation `shipping_methods` is expanded.", "items": { "$ref": "#/components/schemas/shipping_method" } }, + "payments": { + "type": "array", + "description": "The payments used in the order. Available if the relation `payments` is expanded.", + "items": { + "$ref": "#/components/schemas/payment" + } + }, "fulfillments": { "type": "array", + "description": "The fulfillments used in the order. Available if the relation `fulfillments` is expanded.", "items": { "$ref": "#/components/schemas/fulfillment" } }, "returns": { "type": "array", + "description": "The returns associated with the order. Available if the relation `returns` is expanded.", "items": { - "$ref": "#/components/schemas/return" + "type": "object", + "description": "A return object." } }, "claims": { "type": "array", + "description": "The claims associated with the order. Available if the relation `claims` is expanded.", "items": { - "$ref": "#/components/schemas/claim_order" + "type": "object", + "description": "A claim order object." } }, "refunds": { "type": "array", + "description": "The refunds associated with the order. Available if the relation `refunds` is expanded.", "items": { - "$ref": "#/components/schemas/refund" + "type": "object", + "description": "A refund object." } }, "swaps": { "type": "array", + "description": "The swaps associated with the order. Available if the relation `swaps` is expanded.", "items": { - "$ref": "#/components/schemas/refund" + "type": "object", + "description": "A swap object." + } + }, + "draft_order_id": { + "type": "string", + "description": "The ID of the draft order this order is associated with.", + "example": null + }, + "draft_order": { + "description": "A draft order object. Available if the relation `draft_order` is expanded.", + "type": "object" + }, + "items": { + "type": "array", + "description": "The line items that belong to the order. Available if the relation `items` is expanded.", + "items": { + "$ref": "#/components/schemas/line_item" } }, "gift_card_transactions": { "type": "array", + "description": "The gift card transactions used in the order. Available if the relation `gift_card_transactions` is expanded.", "items": { "$ref": "#/components/schemas/gift_card_transaction" } }, "canceled_at": { "type": "string", + "description": "The date the order was canceled on.", "format": "date-time" }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "update_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "type": "string", - "format": "date-time" - }, - "metadata": { - "type": "object" - }, - "shipping_total": { - "type": "integer" - }, - "discount_total": { - "type": "integer" - }, - "tax_total": { - "type": "integer" - }, - "subtotal": { - "type": "integer" - }, - "refundable_amount": { - "type": "integer" - }, - "gift_card_total": { - "type": "integer" - }, - "paid_total": { - "type": "integer" - }, "no_notification": { "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean" + "type": "boolean", + "example": false + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the processing of the order in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "external_id": { + "description": "The ID of an external order.", + "type": "string", + "example": null + }, + "sales_channel_id": { + "type": "string", + "description": "The ID of the sales channel this order is associated with.", + "example": null + }, + "sales_channel": { + "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", + "type": "object" + }, + "shipping_total": { + "type": "integer", + "description": "The total of shipping", + "example": 1000 + }, + "discount_total": { + "type": "integer", + "description": "The total of discount", + "example": 800 + }, + "tax_total": { + "type": "integer", + "description": "The total of tax", + "example": 0 + }, + "refunded_total": { + "type": "integer", + "description": "The total amount refunded if the order is returned.", + "example": 0 + }, + "total": { + "type": "integer", + "description": "The total amount of the order", + "example": 8200 + }, + "subtotal": { + "type": "integer", + "description": "The subtotal of the order", + "example": 8000 + }, + "paid_total": { + "type": "integer", + "description": "The total amount paid", + "example": 8000 + }, + "refundable_amount": { + "type": "integer", + "description": "The amount that can be refunded", + "example": 8200 + }, + "gift_card_total": { + "type": "integer", + "description": "The total of gift cards", + "example": 0 + }, + "gift_card_tax_total": { + "type": "integer", + "description": "The total of gift cards with taxes", + "example": 0 } } }, @@ -13273,14 +17658,19 @@ "title": "Payment Provider", "description": "Represents a Payment Provider plugin and holds its installation status.", "x-resourceId": "payment_provider", + "required": [ + "id" + ], "properties": { "id": { "description": "The id of the payment provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "manual" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "default": true } } }, @@ -13288,22 +17678,35 @@ "title": "Payment Session", "description": "Payment Sessions are created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, who is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc.", "x-resourceId": "payment_session", + "required": [ + "cart_id", + "provider_id", + "status" + ], "properties": { "id": { - "description": "The id of the Payment Session. This value will be prefixed with `ps_`.", - "type": "string" + "type": "string", + "description": "The payment session's ID", + "example": "ps_01G901XNSRM2YS3ASN9H5KG3FZ" }, "cart_id": { "description": "The id of the Cart that the Payment Session is created for.", - "type": "string" + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "provider_id": { "description": "The id of the Payment Provider that is responsible for the Payment Session", - "type": "string" + "type": "string", + "example": "manual" }, "is_selected": { "description": "A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase.", - "type": "boolean" + "type": "boolean", + "example": true }, "status": { "description": "Indicates the status of the Payment Session. Will default to `pending`, and will eventually become `authorized`. Payment Sessions may have the status of `requires_more` to indicate that further actions are to be completed by the Customer.", @@ -13314,20 +17717,30 @@ "requires_more", "error", "canceled" - ] + ], + "example": "pending" }, "data": { "description": "The data required for the Payment Provider to identify, modify and process the Payment Session. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.", - "type": "object" + "type": "object", + "example": {} + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of a cart in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" } } @@ -13336,42 +17749,75 @@ "title": "Payment", "description": "Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded.", "x-resourceId": "payment", + "required": [ + "amount", + "currency_code", + "provider_id" + ], "properties": { "id": { - "description": "The id of the Payment. This value will be prefixed with `pay_`.", - "type": "string" + "type": "string", + "description": "The payment's ID", + "example": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE" }, "swap_id": { - "description": "The id of the Swap that the Payment is used for.", - "type": "string" + "description": "The ID of the Swap that the Payment is used for.", + "type": "string", + "example": null }, - "order_id": { - "description": "The id of the Order that the Payment is used for.", - "type": "string" + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "cart_id": { "description": "The id of the Cart that the Payment Session is created for.", "type": "string" }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" + }, + "order_id": { + "description": "The ID of the Order that the Payment is used for.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" + }, "amount": { "description": "The amount that the Payment has been authorized for.", - "type": "integer" + "type": "integer", + "example": 100 }, "currency_code": { "description": "The 3 character ISO currency code that the Payment is completed in.", - "type": "string" + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "amount_refunded": { "description": "The amount of the original Payment amount that has been refunded back to the Customer.", - "type": "integer" + "type": "integer", + "example": 0 }, "provider_id": { "description": "The id of the Payment Provider that is responsible for the Payment", - "type": "string" + "type": "string", + "example": "manual" }, "data": { "description": "The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.", - "type": "object" + "type": "object", + "example": {} }, "captured_at": { "description": "The date with timezone at which the Payment was captured.", @@ -13383,19 +17829,30 @@ "type": "string", "format": "date-time" }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "idempotency_key": { "type": "string", + "description": "Randomly generated key used to continue the completion of a payment in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13403,10 +17860,25 @@ "title": "Price List", "description": "Price Lists represents a set of prices that overrides the default price for one or more product variants.", "x-resourceId": "price_list", + "required": [ + "name", + "description" + ], "properties": { "id": { - "description": "The id of the Price List. This value will be prefixed by `pl_`.", - "type": "string" + "type": "string", + "description": "The price list's ID", + "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" + }, + "name": { + "type": "string", + "description": "The price list's name", + "example": "VIP Prices" + }, + "description": { + "type": "string", + "description": "The price list's description", + "example": "Prices for VIP customers" }, "type": { "description": "The type of Price List. This can be one of either `sale` or `override`.", @@ -13414,7 +17886,17 @@ "enum": [ "sale", "override" - ] + ], + "default": "sale" + }, + "status": { + "description": "The status of the Price List", + "type": "string", + "enum": [ + "active", + "draft" + ], + "default": "draft" }, "starts_at": { "description": "The date with timezone that the Price List starts being valid.", @@ -13427,25 +17909,33 @@ "format": "date-time" }, "customer_groups": { - "description": "The Customer Groups that the Price List applies to.", + "description": "The Customer Groups that the Price List applies to. Available if the relation `customer_groups` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/customer_group" + "type": "object", + "description": "A customer group object." + } + }, + "prices": { + "description": "The Money Amounts that are associated with the Price List. Available if the relation `prices` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/money_amount" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" } } @@ -13454,44 +17944,54 @@ "title": "Product Collection", "description": "Product Collections represents a group of Products that are related.", "x-resourceId": "product_collection", + "required": [ + "title" + ], "properties": { "id": { - "description": "The id of the Product Collection. This value will be prefixed with `pcol_`.", - "type": "string" + "type": "string", + "description": "The product collection's ID", + "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" }, "title": { "description": "The title that the Product Collection is identified by.", - "type": "string" + "type": "string", + "example": "Summer Collection" }, "handle": { "description": "A unique string that identifies the Product Collection - can for example be used in slug structures.", - "type": "string" + "type": "string", + "example": "summer-collection" }, "products": { - "description": "The Products contained in the Product Collection.", + "description": "The Products contained in the Product Collection. Available if the relation `products` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/product" + "type": "object", + "description": "A product collection object." } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13499,41 +17999,61 @@ "title": "Product Option Value", "description": "A value given to a Product Variant's option set. Product Variant have a Product Option Value for each of the Product Options defined on the Product.", "x-resourceId": "product_option_value", + "required": [ + "value", + "option_id", + "variant_id" + ], "properties": { "id": { - "description": "The id of the Product Option Value. This value will be prefixed with `optval_`.", - "type": "string" + "type": "string", + "description": "The product option value's ID", + "example": "optval_01F0YESHR7S6ECD03RF6W12DSJ" }, "value": { "description": "The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is \"Size\" this value could be \"Small\", \"Medium\" or \"Large\").", - "type": "string" + "type": "string", + "example": "large" }, "option_id": { - "description": "The id of the Product Option that the Product Option Value is defined for.", - "type": "string" + "description": "The ID of the Product Option that the Product Option Value is defined for.", + "type": "string", + "example": "opt_01F0YESHQBZVKCEXJ24BS6PCX3" + }, + "option": { + "description": "Available if the relation `option` is expanded.", + "$ref": "#/components/schemas/product_option" }, "variant_id": { - "description": "The id of the Product Variant that the Product Option Value is defined for.", - "type": "string" + "description": "The ID of the Product Variant that the Product Option Value is defined for.", + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" + }, + "variant": { + "description": "Available if the relation `variant` is expanded.", + "$ref": "#/components/schemas/product_variant" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13541,44 +18061,58 @@ "title": "Product Option", "description": "Product Options define properties that may vary between different variants of a Product. Common Product Options are \"Size\" and \"Color\", but Medusa doesn't limit what Product Options that can be defined.", "x-resourceId": "product_option", + "required": [ + "title", + "product_id" + ], "properties": { "id": { - "description": "The id of the Product Option. This value will be prefixed with `opt_`.", - "type": "string" + "type": "string", + "description": "The product option's ID", + "example": "opt_01F0YESHQBZVKCEXJ24BS6PCX3" }, "title": { "description": "The title that the Product Option is defined by (e.g. \"Size\").", - "type": "string" + "type": "string", + "example": "Size" }, "values": { - "description": "The Product Option Values that are defined for the Product Option.", + "description": "The Product Option Values that are defined for the Product Option. Available if the relation `values` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_option_value" } }, "product_id": { - "description": "The id of the Product that the Product Option is defined for.", - "type": "string" + "description": "The ID of the Product that the Product Option is defined for.", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" + }, + "product": { + "description": "A product object. Available if the relation `product` is expanded.", + "type": "object" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13586,33 +18120,41 @@ "title": "Product Tag", "description": "Product Tags can be added to Products for easy filtering and grouping.", "x-resourceId": "product_tag", + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of the Product Tag. This value will be prefixed with `ptag_`.", - "type": "string" + "type": "string", + "description": "The product tag's ID", + "example": "ptag_01G8K2MTMG9168F2B70S1TAVK3" }, "value": { - "description": "The value that the Product Tag represents (e.g. \"Pants\").", - "type": "string" + "description": "The value that the Product Tag represents", + "type": "string", + "example": "Pants" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13620,33 +18162,45 @@ "title": "Product Tax Rate", "description": "Associates a tax rate with a product to indicate that the product is taxed in a certain way", "x-resourceId": "product_tax_rate", + "required": [ + "product_id", + "rate_id" + ], "properties": { "product_id": { - "description": "The id of the Product", - "type": "string" + "description": "The ID of the Product", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" + }, + "product": { + "description": "Available if the relation `product` is expanded.", + "$ref": "#/components/schemas/product" }, "rate_id": { - "description": "The id of the Tax Rate", - "type": "string" + "description": "The ID of the Tax Rate", + "type": "string", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" + }, + "tax_rate": { + "description": "Available if the relation `tax_rate` is expanded.", + "$ref": "#/components/schemas/tax_rate" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13654,33 +18208,45 @@ "title": "Product Type Tax Rate", "description": "Associates a tax rate with a product type to indicate that the product type is taxed in a certain way", "x-resourceId": "product_type_tax_rate", + "required": [ + "product_type_id", + "rate_id" + ], "properties": { "product_type_id": { - "description": "The id of the Product type", - "type": "string" + "description": "The ID of the Product type", + "type": "string", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_type": { + "description": "Available if the relation `product_type` is expanded.", + "$ref": "#/components/schemas/product_type" }, "rate_id": { "description": "The id of the Tax Rate", - "type": "string" + "type": "string", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" + }, + "tax_rate": { + "description": "Available if the relation `tax_rate` is expanded.", + "$ref": "#/components/schemas/tax_rate" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13688,33 +18254,41 @@ "title": "Product Type", "description": "Product Type can be added to Products for filtering and reporting purposes.", "x-resourceId": "product_type", + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of the Product Type. This value will be prefixed with `ptyp_`.", - "type": "string" + "type": "string", + "description": "The product type's ID", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "value": { - "description": "The value that the Product Type represents (e.g. \"Clothing\").", - "type": "string" + "description": "The value that the Product Type represents.", + "type": "string", + "example": "Clothing" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13722,21 +18296,33 @@ "title": "Product Variant", "description": "Product Variants represent a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations.", "x-resourceId": "product_variant", + "required": [ + "title", + "product_id", + "inventory_quantity" + ], "properties": { "id": { - "description": "The id of the Product Variant. This value will be prefixed with `variant_`.", - "type": "string" + "type": "string", + "description": "The product variant's ID", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" }, "title": { "description": "A title that can be displayed for easy identification of the Product Variant.", - "type": "string" + "type": "string", + "example": "Small" }, "product_id": { - "description": "The id of the Product that the Product Variant belongs to.", - "type": "string" + "description": "The ID of the Product that the Product Variant belongs to.", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" + }, + "product": { + "description": "A product object. Available if the relation `product` is expanded.", + "type": "object" }, "prices": { - "description": "The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region.", + "description": "The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region. Available if the relation `prices` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/money_amount" @@ -13744,89 +18330,112 @@ }, "sku": { "description": "The unique stock keeping unit used to identify the Product Variant. This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems.", - "type": "string" + "type": "string", + "example": "shirt-123" }, "barcode": { "description": "A generic field for a GTIN number that can be used to identify the Product Variant.", - "type": "string" + "type": "string", + "example": null }, "ean": { "description": "An EAN barcode number that can be used to identify the Product Variant.", - "type": "string" + "type": "string", + "example": null }, "upc": { "description": "A UPC barcode number that can be used to identify the Product Variant.", - "type": "string" + "type": "string", + "example": null + }, + "variant_rank": { + "description": "The ranking of this variant", + "type": "number", + "default": 0 }, "inventory_quantity": { "description": "The current quantity of the item that is stocked.", - "type": "integer" + "type": "integer", + "example": 100 }, "allow_backorder": { "description": "Whether the Product Variant should be purchasable when `inventory_quantity` is 0.", - "type": "boolean" + "type": "boolean", + "default": false }, "manage_inventory": { "description": "Whether Medusa should manage inventory for the Product Variant.", - "type": "boolean" + "type": "boolean", + "default": true }, "hs_code": { "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "origin_country": { "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "mid_code": { "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "material": { "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "weight": { "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "height": { "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "width": { "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "length": { "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "options": { - "description": "The Product Option Values specified for the Product Variant.", + "description": "The Product Option Values specified for the Product Variant. Available if the relation `options` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_option_value" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13834,14 +18443,20 @@ "title": "Product", "description": "Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by.", "x-resourceId": "product", + "required": [ + "title", + "profile_id" + ], "properties": { "id": { - "description": "The id of the Product. This value will be prefixed with `prod_`.", - "type": "string" + "type": "string", + "description": "The product's ID", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" }, "title": { "description": "A title that can be displayed for easy identification of the Product.", - "type": "string" + "type": "string", + "example": "Medusa Coffee Mug" }, "subtitle": { "description": "An optional subtitle that can be used to further specify the Product.", @@ -13849,22 +18464,32 @@ }, "description": { "description": "A short description of the Product.", - "type": "string" + "type": "string", + "example": "Every programmer's best friend." }, "handle": { "description": "A unique identifier for the Product (e.g. for slug structure).", - "type": "string" + "type": "string", + "example": "coffee-mug" }, "is_giftcard": { "description": "Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased.", - "type": "boolean" + "type": "boolean", + "default": false }, - "discountable": { - "description": "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`.", - "type": "boolean" + "status": { + "description": "The status of the product", + "type": "string", + "enum": [ + "draft", + "proposed", + "published", + "rejected" + ], + "default": "draft" }, "images": { - "description": "Images of the Product", + "description": "Images of the Product. Available if the relation `images` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/image" @@ -13872,99 +18497,136 @@ }, "thumbnail": { "description": "A URL to an image file that can be used to identify the Product.", - "type": "string" + "type": "string", + "format": "uri" }, "options": { - "description": "The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product Option Values.", + "description": "The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product Option Values. Available if the relation `options` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_option" } }, "variants": { - "description": "The Product Variants that belong to the Product. Each will have a unique combination of Product Option Values.", + "description": "The Product Variants that belong to the Product. Each will have a unique combination of Product Option Values. Available if the relation `variants` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_variant" } }, "profile_id": { - "description": "The id of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", - "type": "string" + "description": "The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", + "type": "string", + "example": "sp_01G1G5V239ENSZ5MV4JAR737BM" }, - "hs_code": { - "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" - }, - "origin_country": { - "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" - }, - "mid_code": { - "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" - }, - "material": { - "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "profile": { + "description": "Available if the relation `profile` is expanded.", + "$ref": "#/components/schemas/shipping_profile" }, "weight": { "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "height": { "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "width": { "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "length": { "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, - "type": { - "description": "The Product Type of the Product (e.g. \"Clothing\")", - "anyOf": [ - { - "$ref": "#/components/schemas/product_type" - } - ] + "hs_code": { + "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "origin_country": { + "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "mid_code": { + "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "material": { + "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "collection_id": { + "type": "string", + "description": "The Product Collection that the Product belongs to", + "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" }, "collection": { - "description": "The Product Collection that the Product belongs to (e.g. \"SS20\")", - "anyOf": [ - { - "$ref": "#/components/schemas/product_collection" - } - ] + "description": "A product collection object. Available if the relation `collection` is expanded.", + "type": "object" + }, + "type_id": { + "type": "string", + "description": "The Product type that the Product belongs to", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "type": { + "description": "Available if the relation `type` is expanded.", + "$ref": "#/components/schemas/product_type" }, "tags": { - "description": "The Product Tags assigned to the Product.", + "description": "The Product Tags assigned to the Product. Available if the relation `tags` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_tag" } }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "discountable": { + "description": "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`.", + "type": "boolean", + "default": true + }, + "external_id": { + "description": "The external ID of the product", "type": "string", + "example": null + }, + "sales_channels": { + "description": "The sales channels the product is associated with. Available if the relation `sales_channels` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A sales channel object." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -13972,22 +18634,30 @@ "title": "Refund", "description": "Refund represent an amount of money transfered back to the Customer for a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by a store operator.", "x-resourceId": "refund", + "required": [ + "order_id", + "amount" + ], "properties": { "id": { - "description": "The id of the Refund. This value will be prefixed with `ref_`.", - "type": "string" + "type": "string", + "description": "The refund's ID", + "example": "ref_01G1G5V27GYX4QXNARRQCW1N8T" }, "order_id": { "description": "The id of the Order that the Refund is related to.", - "type": "string" + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "amount": { "description": "The amount that has be refunded to the Customer.", - "type": "integer" + "type": "integer", + "example": 1000 }, "note": { "description": "An optional note explaining why the amount was refunded.", - "type": "string" + "type": "string", + "example": "I didn't like it" }, "reason": { "description": "The reason given for the Refund, will automatically be set when processed as part of a Swap, Claim or Return.", @@ -13998,21 +18668,38 @@ "swap", "claim", "other" - ] + ], + "example": "return" + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the refund in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14020,66 +18707,113 @@ "title": "Region", "description": "Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries.", "x-resourceId": "region", + "required": [ + "name", + "currency_code", + "tax_rate" + ], "properties": { "id": { - "description": "The id of the Region. This value will be prefixed with `reg_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "name": { "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.", - "type": "string" + "type": "string", + "example": "EU" }, "currency_code": { - "description": "The 3 character ISO currency code that Customers will shop in in the Region.", - "type": "string" + "description": "The 3 character currency code that the Region uses.", + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "tax_rate": { "description": "The tax rate that should be charged on purchases in the Region.", - "type": "number" + "type": "number", + "example": 0 + }, + "tax_rates": { + "description": "The tax rates that are included in the Region. Available if the relation `tax_rates` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } }, "tax_code": { "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.", - "type": "string" + "type": "string", + "example": null + }, + "gift_cards_taxable": { + "description": "Whether the gift cards are taxable or not in this region.", + "type": "boolean", + "default": true + }, + "automatic_taxes": { + "description": "Whether taxes should be automated in this region.", + "type": "boolean", + "default": true }, "countries": { - "description": "The countries that are included in the Region.", + "description": "The countries that are included in the Region. Available if the relation `countries` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/country" } }, + "tax_provider_id": { + "type": "string", + "description": "The ID of the tax provider used in this region", + "example": null + }, + "tax_provider": { + "description": "Available if the relation `tax_provider` is expanded.", + "$ref": "#/components/schemas/tax_provider" + }, "payment_providers": { - "description": "The Payment Providers that can be used to process Payments in the Region.", + "description": "The Payment Providers that can be used to process Payments in the Region. Available if the relation `payment_providers` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/payment_provider" } }, "fulfillment_providers": { - "description": "The Fulfillment Providers that can be used to fulfill orders in the Region.", + "description": "The Fulfillment Providers that can be used to fulfill orders in the Region. Available if the relation `payment_providers` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/fulfillment_provider" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14087,54 +18821,69 @@ "title": "Return Item", "description": "Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned.", "x-resourceId": "return_item", + "required": [ + "return_id", + "item_id" + ], "properties": { "return_id": { "description": "The id of the Return that the Return Item belongs to.", - "type": "string" + "type": "string", + "example": "ret_01F0YET7XPCMF8RZ0Y151NZV2V" + }, + "return_order": { + "description": "Available if the relation `return_order` is expanded.", + "$ref": "#/components/schemas/return" }, "item_id": { "description": "The id of the Line Item that the Return Item references.", - "type": "string" + "type": "string", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" }, "item": { - "description": "The Line Item that the Return Item references.", - "anyOf": [ - { - "$ref": "#/components/schemas/line_item" - } - ] + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" }, "quantity": { "description": "The quantity of the Line Item that is included in the Return.", - "type": "integer" + "type": "integer", + "example": 1 }, "is_requested": { "description": "Whether the Return Item was requested initially or received unexpectedly in the warehouse.", - "type": "boolean" + "type": "boolean", + "default": true }, "requested_quantity": { "description": "The quantity that was originally requested to be returned.", - "type": "integer" + "type": "integer", + "example": 1 }, "recieved_quantity": { "description": "The quantity that was received in the warehouse.", - "type": "integer" + "type": "integer", + "example": 1 + }, + "reason_id": { + "description": "The ID of the reason for returning the item.", + "type": "string", + "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" }, "reason": { - "description": "The reason for returning the item.", - "anyOf": [ - { - "$ref": "#/components/schemas/return_reason" - } - ] + "description": "Available if the relation `reason` is expanded.", + "$ref": "#/components/schemas/return_reason" }, "note": { "description": "An optional note with additional details about the Return.", - "type": "string" + "type": "string", + "example": "I didn't like it." }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14142,41 +18891,65 @@ "title": "Return Reason", "description": "A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned.", "x-resourceId": "return_reason", + "required": [ + "value", + "label" + ], "properties": { "id": { - "description": "The id of the Return Reason will start with `rr_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" }, "description": { "description": "A description of the Reason.", - "type": "string" + "type": "string", + "example": "Items that are damaged" }, "label": { "description": "A text that can be displayed to the Customer as a reason.", - "type": "string" + "type": "string", + "example": "Damaged goods" }, "value": { "description": "The value to identify the reason by.", - "type": "string" + "type": "string", + "example": "damaged" + }, + "parent_return_reason_id": { + "type": "string", + "description": "The ID of the parent reason.", + "example": null + }, + "parent_return_reason": { + "description": "Available if the relation `parent_return_reason` is expanded.", + "$ref": "#/components/schemas/return_reason" + }, + "return_reason_children": { + "description": "Available if the relation `return_reason_children` is expanded.", + "$ref": "#/components/schemas/return_reason" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14184,10 +18957,14 @@ "title": "Return", "description": "Return orders hold information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can be used as part of a Swap.", "x-resourceId": "return", + "required": [ + "refund_amount" + ], "properties": { "id": { - "description": "The id of the Return. This value will be prefixed with `ret_`.", - "type": "string" + "type": "string", + "description": "The return's ID", + "example": "ret_01F0YET7XPCMF8RZ0Y151NZV2V" }, "status": { "description": "Status of the Return.", @@ -14195,39 +18972,74 @@ "enum": [ "requested", "received", - "requires_action" - ] + "requires_action", + "canceled" + ], + "default": "requested" }, "items": { - "description": "The Return Items that will be shipped back to the warehouse. type: array items: $ref: " + "description": "The Return Items that will be shipped back to the warehouse. Available if the relation `items` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/return_item" + } }, "swap_id": { - "description": "The id of the Swap that the Return is a part of.", - "type": "string" + "description": "The ID of the Swap that the Return is a part of.", + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "order_id": { - "description": "The id of the Order that the Return is made from.", - "type": "string" + "description": "The ID of the Order that the Return is made from.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "claim_order_id": { - "description": "The id of the Claim that the Return is a part of.", - "type": "string" + "description": "The ID of the Claim that the Return is a part of.", + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" }, "shipping_method": { - "description": "The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves.", - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_method" - } - ] + "description": "The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves. Available if the relation `shipping_method` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/shipping_method" + } }, "shipping_data": { "description": "Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment.", - "type": "object" + "type": "object", + "example": {} }, "refund_amount": { "description": "The amount that should be refunded as a result of the return.", - "type": "integer" + "type": "integer", + "example": 1000 + }, + "no_notification": { + "description": "When set to true, no notification will be sent related to this return.", + "type": "boolean", + "example": false + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the return in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "received_at": { "description": "The date with timezone at which the return was received.", @@ -14235,22 +19047,124 @@ "format": "date-time" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, - "no_notification": { - "description": "When set to true, no notification will be sent related to this return.", - "type": "boolean" + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "sales_channel": { + "title": "Sales Channel", + "description": "A Sales Channel", + "x-resourceId": "sales_channel", + "required": [ + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "The sales channel's ID", + "example": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "name": { + "description": "The name of the sales channel.", + "type": "string", + "example": "Market" + }, + "description": { + "description": "The description of the sales channel.", + "type": "string", + "example": "Multi-vendor market" + }, + "is_disabled": { + "description": "Specify if the sales channel is enabled or disabled.", + "type": "boolean", + "default": false + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" + } + } + }, + "sales_channel_tax_line": { + "title": "Sales Channel", + "description": "A Sales Channel", + "x-resourceId": "sales_channel_tax_line", + "required": [ + "shipping_method_id", + "rate", + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "The line item tax line's ID", + "example": "smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" + }, + "shipping_method_id": { + "type": "string", + "description": "The ID of the line item", + "example": "sm_01F0YET7DR2E7CYVSDHM593QG2" + }, + "shipping_method": { + "description": "Available if the relation `shipping_method` is expanded.", + "$ref": "#/components/schemas/shipping_method" + }, + "code": { + "description": "A code to identify the tax type by", + "type": "string", + "example": "tax01" + }, + "name": { + "description": "A human friendly name for the tax", + "type": "string", + "example": "Tax Example" + }, + "rate": { + "description": "The numeric rate to charge tax by", + "type": "number", + "example": 10 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14258,50 +19172,86 @@ "title": "Shipping Method", "description": "Shipping Methods represent a way in which an Order or Return can be shipped. Shipping Methods are built from a Shipping Option, but may contain additional details, that can be necessary for the Fulfillment Provider to handle the shipment.", "x-resourceId": "shipping_method", + "required": [ + "shipping_option_id", + "price" + ], "properties": { "id": { - "description": "The id of the Shipping Method. This value will be prefixed with `sm_`.", - "type": "string" + "type": "string", + "description": "The shipping method's ID", + "example": "sm_01F0YET7DR2E7CYVSDHM593QG2" }, "shipping_option_id": { "description": "The id of the Shipping Option that the Shipping Method is built from.", - "type": "string" + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" }, "shipping_option": { - "description": "The Shipping Option that the Shipping Method is built from.", - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_option" - } - ] + "description": "Available if the relation `shipping_option` is expanded.", + "$ref": "#/components/schemas/shipping_option" }, "order_id": { "description": "The id of the Order that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "return_id": { "description": "The id of the Return that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": null + }, + "return_order": { + "description": "A return object. Available if the relation `return_order` is expanded.", + "type": "object" }, "swap_id": { "description": "The id of the Swap that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "cart_id": { "description": "The id of the Cart that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "claim_order_id": { "description": "The id of the Claim that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" + }, + "tax_lines": { + "type": "array", + "description": "Available if the relation `tax_lines` is expanded.", + "items": { + "$ref": "#/components/schemas/tax_line" + } }, "price": { "description": "The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of.", - "type": "integer" + "type": "integer", + "example": 200 }, "data": { "description": "Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id.", - "type": "object" + "type": "object", + "example": {} } } }, @@ -14309,14 +19259,25 @@ "title": "Shipping Option Requirement", "description": "A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart.", "x-resourceId": "shipping_option_requirement", + "required": [ + "shipping_option_id", + "type", + "amount" + ], "properties": { "id": { - "description": "The id of the Shipping Option Requirement. This value will be prefixed with `sor_`.", - "type": "string" + "type": "string", + "description": "The shipping option requirement's ID", + "example": "sor_01G1G5V29AB4CTNDRFSRWSRKWD" }, "shipping_option_id": { - "description": "The id of the Shipping Option that the Shipping Option Requirement belongs to.", - "type": "string" + "description": "The id of the Shipping Option that the hipping option requirement belongs to", + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" + }, + "shipping_option": { + "description": "Available if the relation `shipping_option` is expanded.", + "$ref": "#/components/schemas/shipping_option" }, "type": { "description": "The type of the requirement, this defines how the value will be compared to the Cart's total. `min_subtotal` requirements define the minimum subtotal that is needed for the Shipping Option to be available, while the `max_subtotal` defines the maximum subtotal that the Cart can have for the Shipping Option to be available.", @@ -14324,11 +19285,18 @@ "enum": [ "min_subtotal", "max_subtotal" - ] + ], + "example": "min_subtotal" }, "amount": { "description": "The amount to compare the Cart subtotal to.", - "type": "integer" + "type": "integer", + "example": 100 + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" } } }, @@ -14336,34 +19304,50 @@ "title": "Shipping Option", "description": "Shipping Options represent a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information.", "x-resourceId": "shipping_option", + "required": [ + "name", + "region_id", + "profile_id", + "provider_id", + "price_type" + ], "properties": { "id": { - "description": "The id of the Shipping Option. This value will be prefixed with `so_`.", - "type": "string" + "type": "string", + "description": "The shipping option's ID", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" }, "name": { "description": "The name given to the Shipping Option - this may be displayed to the Customer.", - "type": "string" + "type": "string", + "example": "PostFake Standard" }, "region_id": { - "description": "The id of the Region that the Shipping Option belongs to.", - "type": "string" + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "description": "The id of the Region that the Shipping Option belongs to.", - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "profile_id": { - "description": "The id of the Shipping Profile that the Shipping Option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", - "type": "string" + "description": "The ID of the Shipping Profile that the shipping option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", + "type": "string", + "example": "sp_01G1G5V239ENSZ5MV4JAR737BM" + }, + "profile": { + "description": "Available if the relation `profile` is expanded.", + "$ref": "#/components/schemas/shipping_profile" }, "provider_id": { "description": "The id of the Fulfillment Provider, that will be used to process Fulfillments from the Shipping Option.", - "type": "string" + "type": "string", + "example": "manual" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/fulfillment_provider" }, "price_type": { "description": "The type of pricing calculation that is used when creatin Shipping Methods from the Shipping Option. Can be `flat_rate` for fixed prices or `calculated` if the Fulfillment Provider can provide price calulations.", @@ -14371,18 +19355,21 @@ "enum": [ "flat_rate", "calculated" - ] + ], + "example": "flat_rate" }, "amount": { "description": "The amount to charge for shipping when the Shipping Option price type is `flat_rate`.", - "type": "integer" + "type": "integer", + "example": 200 }, "is_return": { "description": "Flag to indicate if the Shipping Option can be used for Return shipments.", - "type": "boolean" + "type": "boolean", + "default": false }, "requirements": { - "description": "The requirements that must be satisfied for the Shipping Option to be available for a Cart.", + "description": "The requirements that must be satisfied for the Shipping Option to be available for a Cart. Available if the relation `requirements` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/shipping_option_requirement" @@ -14390,26 +19377,30 @@ }, "data": { "description": "The data needed for the Fulfillment Provider to identify the Shipping Option.", - "type": "object" + "type": "object", + "example": {} }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14417,14 +19408,20 @@ "title": "Shipping Profile", "description": "Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products.", "x-resourceId": "shipping_profile", + "required": [ + "name", + "type" + ], "properties": { "id": { - "description": "The id of the Shipping Profile. This value will be prefixed with `sp_`.", - "type": "string" + "type": "string", + "description": "The shipping profile's ID", + "example": "sp_01G1G5V239ENSZ5MV4JAR737BM" }, "name": { "description": "The name given to the Shipping profile - this may be displayed to the Customer.", - "type": "string" + "type": "string", + "example": "Default Shipping Profile" }, "type": { "description": "The type of the Shipping Profile, may be `default`, `gift_card` or `custom`.", @@ -14433,44 +19430,45 @@ "default", "gift_card", "custom" - ] + ], + "example": "default" }, "products": { - "description": "The Products that the Shipping Profile defines Shipping Options for.", + "description": "The Products that the Shipping Profile defines Shipping Options for. Available if the relation `products` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/product" + "type": "object", + "description": "A product object." } }, "shipping_options": { - "description": "The Shipping Options that can be used to fulfill the Products in the Shipping Profile.", + "description": "The Shipping Options that can be used to fulfill the Products in the Shipping Profile. Available if the relation `shipping_options` is expanded.", "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_option" - } - ] + "$ref": "#/components/schemas/shipping_option" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14478,33 +19476,70 @@ "title": "Shipping Tax Rate", "description": "Associates a tax rate with a shipping option to indicate that the shipping option is taxed in a certain way", "x-resourceId": "shipping_tax_rate", + "required": [ + "shipping_option_id", + "rate_id" + ], "properties": { "shipping_option_id": { - "description": "The id of the Shipping Option", - "type": "string" + "description": "The ID of the Shipping Option", + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" + }, + "shipping_option": { + "description": "Available if the relation `shipping_option` is expanded.", + "$ref": "#/components/schemas/shipping_option" }, "rate_id": { - "description": "The id of the Tax Rate", - "type": "string" + "description": "The ID of the Tax Rate", + "type": "string", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" + }, + "tax_rate": { + "description": "Available if the relation `tax_rate` is expanded.", + "$ref": "#/components/schemas/tax_rate" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "staged_job": { + "title": "Staged Job", + "description": "A staged job resource", + "x-resourceId": "staged_job", + "required": [ + "event_name" + ], + "properties": { + "id": { + "type": "string", + "description": "The staged job's ID", + "example": "job_01F0YET7BZTARY9MKN1SJ7AAXF" + }, + "event_name": { + "description": "The name of the event", + "type": "string", + "example": "order.placed" + }, + "data": { + "description": "Data necessary for the job", + "type": "object", + "example": {} } } }, @@ -14514,41 +19549,65 @@ "x-resourceId": "store", "properties": { "id": { - "description": "The id of the Store. This value will be prefixed with `store_`.", - "type": "string" + "type": "string", + "description": "The store's ID", + "example": "store_01G1G5V21KADXNGH29BJMAJ4B4" }, "name": { "description": "The name of the Store - this may be displayed to the Customer.", - "type": "string" + "type": "string", + "example": "Medusa Store" }, "default_currency_code": { - "description": "The default currency code used when no other currency code is specified.", - "type": "string" + "description": "The 3 character currency code that is the default of the store.", + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "default_currency": { + "description": "Available if the relation `default_currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "currencies": { - "description": "The currencies that are enabled for the Store.", + "description": "The currencies that are enabled for the Store. Available if the relation `currencies` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/currency" } }, "swap_link_template": { - "description": "A template to generate Swap links from use {{cart_id}} to include the Swap's `cart_id` in the link.", - "type": "string" - }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "description": "A template to generate Swap links from. Use {{cart_id}} to include the Swap's `cart_id` in the link.", "type": "string", - "format": "date-time" + "example": null }, - "updated_at": { - "description": "The date with timezone at which the resource was last updated.", + "payment_link_template": { + "description": "A template to generate Payment links from. Use {{cart_id}} to include the payment's `cart_id` in the link.", "type": "string", - "format": "date-time" + "example": null + }, + "invite_link_template": { + "description": "A template to generate Invite links from", + "type": "string", + "example": null + }, + "default_sales_channel_id": { + "type": "string", + "description": "The sales channel ID the cart is associated with.", + "example": null + }, + "default_sales_channel": { + "description": "A sales channel object. Available if the relation `default_sales_channel` is expanded.", + "type": "object" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14556,25 +19615,28 @@ "title": "Swap", "description": "Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference.", "x-resourceId": "swap", + "required": [ + "fulfillment_status", + "payment_status", + "order_id" + ], "properties": { "id": { - "description": "The id of the Swap. This value will be prefixed with `swap_`.", - "type": "string" + "type": "string", + "description": "The swap's ID", + "example": "swap_01F0YET86Y9G92D3YDR9Y6V676" }, "fulfillment_status": { "description": "The status of the Fulfillment of the Swap.", "type": "string", "enum": [ "not_fulfilled", - "partially_fulfilled", "fulfilled", - "partially_shipped", "shipped", - "partially_returned", - "returned", "canceled", "requires_action" - ] + ], + "example": "not_fulfilled" }, "payment_status": { "description": "The status of the Payment of the Swap. The payment may either refer to the refund of an amount or the authorization of a new amount.", @@ -14583,59 +19645,62 @@ "not_paid", "awaiting", "captured", + "confirmed", "canceled", "difference_refunded", + "partially_refunded", + "refunded", "requires_action" - ] + ], + "example": "not_paid" }, "order_id": { - "description": "The id of the Order where the Line Items to be returned where purchased.", - "type": "string" + "description": "The ID of the Order where the Line Items to be returned where purchased.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "additional_items": { - "description": "The new Line Items to ship to the Customer.", + "description": "The new Line Items to ship to the Customer. Available if the relation `additional_items` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/line_item" } }, "return_order": { - "description": "The Return that is issued for the return part of the Swap.", - "anyOf": [ - { - "$ref": "#/components/schemas/return" - } - ] + "description": "A return order object. The Return that is issued for the return part of the Swap. Available if the relation `return_order` is expanded.", + "type": "object" }, "fulfillments": { - "description": "The Fulfillments used to send the new Line Items.", + "description": "The Fulfillments used to send the new Line Items. Available if the relation `fulfillments` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/fulfillment" } }, "payment": { - "description": "The Payment authorized when the Swap requires an additional amount to be charged from the Customer.", - "anyOf": [ - { - "$ref": "#/components/schemas/payment" - } - ] + "description": "The Payment authorized when the Swap requires an additional amount to be charged from the Customer. Available if the relation `payment` is expanded.", + "$ref": "#/components/schemas/payment" }, "difference_due": { "description": "The difference that is paid or refunded as a result of the Swap. May be negative when the amount paid for the returned items exceed the total of the new Products.", - "type": "integer" + "type": "integer", + "example": 0 + }, + "shipping_address_id": { + "description": "The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order.", + "type": "string", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "shipping_address": { - "description": "The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "description": "Available if the relation `shipping_address` is expanded.", + "$ref": "#/components/schemas/address" }, "shipping_methods": { - "description": "The Shipping Methods used to fulfill the addtional items purchased.", + "description": "The Shipping Methods used to fulfill the addtional items purchased. Available if the relation `shipping_methods` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/shipping_method" @@ -14643,27 +19708,31 @@ }, "cart_id": { "description": "The id of the Cart that the Customer will use to confirm the Swap.", - "type": "string" + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "allow_backorder": { "description": "If true, swaps can be completed with items out of stock", - "type": "boolean" + "type": "boolean", + "default": false + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the swap in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "confirmed_at": { "description": "The date with timezone at which the Swap was confirmed by the Customer.", "type": "string", "format": "date-time" }, - "created_at": { - "description": "The date with timezone at which the resource was created.", - "type": "string", - "format": "date-time" - }, - "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, "canceled_at": { "description": "The date with timezone at which the Swap was canceled.", "type": "string", @@ -14671,11 +19740,30 @@ }, "no_notification": { "description": "If set to true, no notification will be sent related to this swap", - "type": "boolean" + "type": "boolean", + "example": false + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14683,36 +19771,47 @@ "title": "Tax Line", "description": "Line item that specifies an amount of tax to add to a line item.", "x-resourceId": "tax_line", + "required": [ + "rate", + "name" + ], "properties": { "id": { - "description": "The id of the Tax Line. This value will be prefixed by `tl_`.", - "type": "string" + "type": "string", + "description": "The tax line's ID", + "example": "tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" }, "code": { "description": "A code to identify the tax type by", - "type": "string" + "type": "string", + "example": "tax01" }, "name": { "description": "A human friendly name for the tax", - "type": "string" + "type": "string", + "example": "Tax Example" }, "rate": { "description": "The numeric rate to charge tax by", - "type": "number" + "type": "number", + "example": 10 }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14723,11 +19822,13 @@ "properties": { "id": { "description": "The id of the tax provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "manual" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "default": true } } }, @@ -14735,44 +19836,95 @@ "title": "Tax Rate", "description": "A Tax Rate can be used to associate a certain rate to charge on products within a given Region", "x-resourceId": "line_item", + "required": [ + "name", + "region_id" + ], "properties": { "id": { - "description": "The id of the Tax Rate. This value will be prefixed by `txr_`.", - "type": "string" + "type": "string", + "description": "The tax rate's ID", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" }, "rate": { "description": "The numeric rate to charge", - "type": "number" + "type": "number", + "example": 10 }, "code": { "description": "A code to identify the tax type by", - "type": "string" + "type": "string", + "example": "tax01" }, "name": { "description": "A human friendly name for the tax", - "type": "string" + "type": "string", + "example": "Tax Example" }, "region_id": { + "type": "string", "description": "The id of the Region that the rate belongs to", - "type": "string" + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" + }, + "region": { + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" + }, + "products": { + "type": "array", + "description": "The products that belong to this tax rate. Available if the relation `products` is expanded.", + "items": { + "type": "object", + "description": "A product object." + } + }, + "product_types": { + "type": "array", + "description": "The product types that belong to this tax rate. Available if the relation `product_types` is expanded.", + "items": { + "type": "object", + "description": "A product type object." + } + }, + "shipping_options": { + "type": "array", + "description": "The shipping options that belong to this tax rate. Available if the relation `shipping_options` is expanded.", + "items": { + "type": "object", + "description": "A shipping option object." + } + }, + "product_count": { + "description": "The count of products", + "type": "integer", + "example": null + }, + "product_type_count": { + "description": "The count of product types", + "type": "integer", + "example": null + }, + "shipping_option_count": { + "description": "The count of shipping options", + "type": "integer", + "example": null }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" - }, - "refundable": { - "description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.", - "type": "integer" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14780,41 +19932,64 @@ "title": "Tracking Link", "description": "Tracking Link holds information about tracking numbers for a Fulfillment. Tracking Links can optionally contain a URL that can be visited to see the status of the shipment.", "x-resourceId": "tracking_link", + "required": [ + "tracking_number", + "fulfillment_id" + ], "properties": { "id": { - "description": "The id of the Tracking Link. This value will be prefixed with `tlink_`.", - "type": "string" + "type": "string", + "description": "The tracking link's ID", + "example": "tlink_01G8ZH853Y6TFXWPG5EYE81X63" }, "url": { "description": "The URL at which the status of the shipment can be tracked.", - "type": "string" + "type": "string", + "format": "uri" }, "tracking_number": { "description": "The tracking number given by the shipping carrier.", - "type": "string" + "type": "string", + "format": "RH370168054CN" }, "fulfillment_id": { + "type": "string", "description": "The id of the Fulfillment that the Tracking Link references.", - "type": "string" + "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" + }, + "fulfillment": { + "description": "Available if the relation `fulfillment` is expanded.", + "$ref": "#/components/schemas/fulfillment" + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of a process in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -14822,40 +19997,56 @@ "title": "User", "description": "Represents a User who can manage store settings.", "x-resourceId": "user", + "required": [ + "email" + ], "properties": { "id": { - "description": "The unique id of the User. This will be prefixed with `usr_`", - "type": "string" + "type": "string", + "description": "The user's ID", + "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" }, "email": { "description": "The email of the User", - "type": "string" + "type": "string", + "format": "email" }, "first_name": { - "type": "string" + "description": "The first name of the User", + "type": "string", + "example": "Levi" }, "last_name": { - "description": "The Customer's billing address.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "description": "The last name of the User", + "type": "string", + "example": "Bogan" + }, + "api_token": { + "description": "An API token associated with the user.", + "type": "string", + "example": null }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } } diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index d0b8b87f7d..70b30f6aa6 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -2,95 +2,113 @@ 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 allows authorization of admin Users and manages their + 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: Product Variant - x-resourceId: product_variant - - name: OAuth - x-resourceId: OAuth + - 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: - /apps: - post: - operationId: PostApps - summary: Generates a token for an application. - description: Generates a token for an application. - x-authenticated: true - requestBody: - content: - application/json: - schema: - required: - - application_name - - state - - code - properties: - application_name: - type: string - description: Name of the application for the token to be generated for. - state: - type: string - description: State of the application. - code: - type: string - description: The code for the generated token. - tags: - - Apps - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - apps: - $ref: '#/components/schemas/OAuth' - get: - operationId: GetApps - summary: List applications - description: Retrieve a list of applications. - x-authenticated: true - tags: - - Apps - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - collection: - $ref: '#/components/schemas/OAuth' /auth: post: operationId: PostAuth @@ -98,17 +116,6 @@ paths: x-authenticated: false description: Logs a User in and authorizes them to manage Store settings. parameters: [] - tags: - - Auth - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - user: - $ref: '#/components/schemas/user' requestBody: content: application/json: @@ -124,6 +131,29 @@ paths: password: type: string description: The User's password. + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: '#/components/schemas/user' + '401': + description: The user doesn't exist or the credentials are incorrect. + delete: + operationId: DeleteAuth + summary: Delete Session + x-authenticated: true + description: Deletes the current session for the logged in user. + tags: + - Auth + responses: + '200': + description: OK get: operationId: GetAuth summary: Get Session @@ -140,6 +170,8 @@ paths: properties: user: $ref: '#/components/schemas/user' + '400': + description: An error occurred. '/batch-jobs/{id}/cancel': post: operationId: PostBatchJobsBatchJobCancel @@ -150,7 +182,7 @@ paths: - in: path name: id required: true - description: The id of the batch job. + description: The ID of the batch job. schema: type: string tags: @@ -174,7 +206,7 @@ paths: - in: path name: id required: true - description: The id of the batch job. + description: The ID of the batch job. schema: type: string tags: @@ -194,7 +226,45 @@ paths: summary: Create a Batch Job description: Creates a Batch Job. x-authenticated: true - parameters: [] + requestBody: + content: + application/json: + schema: + required: + - type + - context + properties: + type: + type: string + description: The type of batch job to start. + example: product-export + context: + type: object + description: >- + Additional infomration regarding the batch to be used for + processing. + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images + dry_run: + type: boolean + description: >- + Set a batch job in dry_run mode to get some information on + what will be done without applying any modifications. + default: false tags: - Batch Job responses: @@ -206,29 +276,6 @@ paths: properties: batch_job: $ref: '#/components/schemas/batch_job' - requestBody: - content: - application/json: - schema: - type: object - required: - - type - - context - - dry_run - properties: - type: - type: string - description: The type of batch job to start. - context: - type: string - description: >- - Additional infomration regarding the batch to be used for - processing. - dry_run: - type: boolean - description: >- - Set a batch job in dry_run mode to get some information on - what will be done without applying any modifications. get: operationId: GetBatchJobs summary: List Batch Jobs @@ -237,14 +284,29 @@ paths: parameters: - in: query name: limit - description: The number of collections to return. + description: The number of batch jobs to return. schema: - type: string + type: integer + default: 10 - in: query name: offset - description: The offset of collections to return. + description: The number of batch jobs to skip before results. schema: - type: string + type: integer + default: 0 + - in: query + name: id + style: form + explode: false + description: Filter by the batch ID + schema: + oneOf: + - type: string + description: batch job ID + - type: array + description: multiple batch job IDs + items: + type: string - in: query name: type style: form @@ -263,7 +325,23 @@ paths: less than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: pre_processed_at style: form @@ -273,7 +351,23 @@ paths: i.e. less than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: completed_at style: form @@ -283,7 +377,23 @@ paths: less than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: failed_at style: form @@ -293,7 +403,23 @@ paths: than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: canceled_at style: form @@ -303,22 +429,42 @@ paths: less than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: order - description: Order used when retrieving batch jobs + description: Field used to order retrieved batch jobs schema: type: string - in: query - name: deleted_at - style: form - explode: false + name: expand description: >- - Date comparison for when resulting collections was deleted, i.e. - less than, greater than etc. + (Comma separated) Which fields should be expanded in each order of + the result. schema: - type: object - nullable: true + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each order of + the result. + schema: + type: string - in: query name: created_at style: form @@ -328,7 +474,23 @@ paths: less than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at style: form @@ -338,7 +500,23 @@ paths: less than, greater than etc. schema: type: object - nullable: true + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date tags: - Batch Job responses: @@ -348,8 +526,19 @@ paths: application/json: schema: properties: - batch_job: - $ref: '#/components/schemas/batch_job' + batch_jobs: + type: array + items: + $ref: '#/components/schemas/batch_job' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/batch-jobs/{id}': get: operationId: GetBatchJobsBatchJob @@ -360,7 +549,7 @@ paths: - in: path name: id required: true - description: The id of the Batch Job + description: The ID of the Batch Job schema: type: string tags: @@ -384,27 +573,33 @@ paths: - in: path name: id required: true - description: The id of the Collection. + description: The ID of the Collection. schema: type: string requestBody: content: application/json: schema: + required: + - product_ids properties: product_ids: description: An array of Product IDs to add to the Product Collection. type: array items: - properties: - id: - description: The ID of a Product to add to the Product Collection. - type: string + description: The ID of a Product to add to the Product Collection. + type: string tags: - Collection responses: '200': description: OK + content: + application/json: + schema: + properties: + collection: + $ref: '#/components/schemas/product_collection' delete: operationId: DeleteProductsFromCollection summary: Removes products associated with a Product Collection @@ -414,13 +609,15 @@ paths: - in: path name: id required: true - description: The id of the Collection. + description: The ID of the Collection. schema: type: string requestBody: content: application/json: schema: + required: + - product_ids properties: product_ids: description: >- @@ -428,17 +625,30 @@ paths: Collection. type: array items: - properties: - id: - description: >- - The ID of a Product to remove from the Product - Collection. - type: string + description: The ID of a Product to add to the Product Collection. + type: string tags: - Collection responses: '200': description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the collection + object: + type: string + description: The type of object the removal was executed on + default: product-collection + removed_products: + description: The IDs of the products removed from the collection + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string /collections: post: operationId: PostCollections @@ -486,12 +696,14 @@ paths: name: limit description: The number of collections to return. schema: - type: string + type: integer + default: 10 - in: query name: offset - description: The offset of collections to return. + description: The number of collections to skip before the results. schema: - type: string + type: integer + default: 0 - in: query name: title description: The title of collections to return. @@ -503,26 +715,76 @@ paths: schema: type: string - in: query - name: deleted_at - description: >- - Date comparison for when resulting collections was deleted, i.e. - less than, greater than etc. + name: q + description: a search term to search titles and handles. schema: - type: object + type: string - in: query name: created_at - description: >- - Date comparison for when resulting collections was created, i.e. - less than, greater than etc. + description: Date comparison for when resulting collections were created. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at - description: >- - Date comparison for when resulting collections was updated, i.e. - less than, greater than etc. + description: Date comparison for when resulting collections were updated. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting collections were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date tags: - Collection responses: @@ -532,8 +794,19 @@ paths: application/json: schema: properties: - collection: - $ref: '#/components/schemas/product_collection' + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/collections/{id}': delete: operationId: DeleteCollectionsCollection @@ -544,7 +817,7 @@ paths: - in: path name: id required: true - description: The id of the Collection. + description: The ID of the Collection. schema: type: string tags: @@ -558,12 +831,15 @@ paths: properties: id: type: string - description: The id of the deleted Collection + description: The ID of the deleted Collection object: type: string description: The type of the object that was deleted. + default: product-collection deleted: type: boolean + description: Whether the collection was deleted successfully or not. + default: true get: operationId: GetCollectionsCollection summary: Retrieve a Product Collection @@ -573,7 +849,7 @@ paths: - in: path name: id required: true - description: The id of the Product Collection + description: The ID of the Product Collection schema: type: string tags: @@ -596,7 +872,7 @@ paths: - in: path name: id required: true - description: The id of the Collection. + description: The ID of the Collection. schema: type: string requestBody: @@ -638,15 +914,17 @@ paths: - in: path name: id required: true - description: The id of the customer group. + description: The ID of the customer group. schema: type: string requestBody: content: application/json: schema: + required: + - customer_ids properties: - customers: + customer_ids: description: The ids of the customers to add type: array items: @@ -654,10 +932,10 @@ paths: - id properties: id: - description: Id of the customer + description: ID of the customer type: string tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -665,7 +943,7 @@ paths: application/json: schema: properties: - customerGroup: + customer_group: $ref: '#/components/schemas/customer_group' delete: operationId: DeleteCustomerGroupsGroupCustomerBatch @@ -676,15 +954,17 @@ paths: - in: path name: id required: true - description: The id of the customer group. + description: The ID of the customer group. schema: type: string requestBody: content: application/json: schema: + required: + - customer_ids properties: - customers: + customer_ids: description: The ids of the customers to remove type: array items: @@ -692,10 +972,10 @@ paths: - id properties: id: - description: Id of the customer + description: ID of the customer type: string tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -703,7 +983,7 @@ paths: application/json: schema: properties: - customerGroup: + customer_group: $ref: '#/components/schemas/customer_group' /customer-groups: post: @@ -713,7 +993,7 @@ paths: x-authenticated: true parameters: [] tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -745,43 +1025,108 @@ paths: parameters: - in: query name: q - description: Query used for searching user group names. + description: Query used for searching customer group names. schema: type: string - in: query name: offset description: How many groups to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: order + description: the field used to order the customer groups. schema: type: string - in: query name: id - description: Ids of the groups to search for. + style: form + explode: false + description: Filter by the customer group ID schema: - type: string + oneOf: + - type: string + description: customer group ID + - type: array + description: multiple customer group IDs + items: + type: string + - type: object + properties: + lt: + type: string + description: filter by IDs less than this ID + gt: + type: string + description: filter by IDs greater than this ID + lte: + type: string + description: filter by IDs less than or equal to this ID + gte: + type: string + description: filter by IDs greater than or equal to this ID - in: query - name: order - description: to retrieve customer groups in. + name: name + style: form + explode: false + description: Filter by the customer group name schema: - type: string + type: array + description: multiple customer group names + items: + type: string + description: customer group name - in: query name: created_at - description: >- - Date comparison for when resulting customer group was created, i.e. - less than, greater than etc. + description: Date comparison for when resulting customer groups were created. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at - description: >- - Date comparison for when resulting ustomer group was updated, i.e. - less than, greater than etc. + description: Date comparison for when resulting customer groups were updated. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: limit description: Limit the number of customer groups returned. schema: - type: string + type: integer + default: 10 - in: query name: expand description: >- @@ -790,7 +1135,7 @@ paths: schema: type: string tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -798,8 +1143,19 @@ paths: application/json: schema: properties: - customerGroup: - $ref: '#/components/schemas/customer_group' + customer_groups: + type: array + items: + $ref: '#/components/schemas/customer_group' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/customer-groups/{id}': delete: operationId: DeleteCustomerGroupsCustomerGroup @@ -810,11 +1166,11 @@ paths: - in: path name: id required: true - description: The id of the Customer Group + description: The ID of the Customer Group schema: type: string tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -824,12 +1180,17 @@ paths: properties: id: type: string - description: The id of the deleted customer group. + description: The ID of the deleted customer group. object: type: string description: The type of the object that was deleted. + default: customer_group deleted: type: boolean + description: >- + Whether the customer group was deleted successfully or + not. + default: true get: operationId: GetCustomerGroupsGroup summary: Retrieve a CustomerGroup @@ -839,11 +1200,25 @@ paths: - in: path name: id required: true - description: The id of the Customer Group. + description: The ID of the Customer Group. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in the customer + group. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in the customer + group. schema: type: string tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -862,11 +1237,22 @@ paths: - in: path name: id required: true - description: The id of the customer group. + description: The ID of the customer group. schema: type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: Name of the customer group + type: string + metadata: + description: Metadata for the customer. + type: object tags: - - CustomerGroup + - Customer Group responses: '200': description: OK @@ -876,31 +1262,116 @@ paths: properties: customer_group: $ref: '#/components/schemas/customer_group' - requestBody: - content: - application/json: - schema: - type: object - required: - - name - properties: - name: - type: string - description: Name of the customer group - metadata: - type: object - description: Metadata for the customer. '/customer-groups/{id}/customers': get: operationId: GetCustomerGroupsGroupCustomers summary: List Customers - description: Retrieves a list of Customers. + description: Retrieves a list of customers in a customer group x-authenticated: true parameters: - in: path name: id required: true - description: The id of the customer group. + description: The ID of the customer group. + schema: + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customers: + type: array + items: + $ref: '#/components/schemas/customer' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + - first_name + - last_name + - password + properties: + email: + type: string + description: The customer's email. + format: email + first_name: + type: string + description: The customer's first name. + last_name: + type: string + description: The customer's last name. + password: + type: string + description: The customer's password. + format: password + phone: + type: string + description: The customer's phone number. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Customer + responses: + '201': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + get: + operationId: GetCustomers + summary: List Customers + description: Retrieves a list of Customers. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to return. + schema: + type: integer + default: 50 + - in: query + name: offset + description: The items to skip before result. + schema: + type: integer + default: 0 + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: q + description: 'a search term to search email, first_name, and last_name.' schema: type: string tags: @@ -912,67 +1383,19 @@ paths: application/json: schema: properties: - customer: - $ref: '#/components/schemas/customer' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer. - x-authenticated: true - parameters: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - first_name - - last_name - properties: - email: - type: string - description: The Customer's email address. - first_name: - type: string - description: The Customer's first name. - last_name: - type: string - description: The Customer's last name. - phone: - type: string - description: The Customer's phone number. - metadata: - type: object - description: Metadata for the customer. - get: - operationId: GetCustomers - summary: List Customers - description: Retrieves a list of Customers. - x-authenticated: true - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' + customers: + type: array + items: + $ref: '#/components/schemas/customer' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/customers/{id}': get: operationId: GetCustomersCustomer @@ -983,7 +1406,17 @@ paths: - in: path name: id required: true - description: The id of the Customer. + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the customer. schema: type: string tags: @@ -1006,17 +1439,19 @@ paths: - in: path name: id required: true - description: The id of the Customer. + description: The ID of the Customer. schema: type: string - in: query name: expand - style: form - explode: false + description: (Comma separated) Which fields should be expanded in each customer. schema: - type: array - items: - type: string + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string requestBody: content: application/json: @@ -1024,9 +1459,8 @@ paths: properties: email: type: string - description: >- - The Customer's email. Only providable if user not - registered. + description: The Customer's email. + format: email first_name: type: string description: The Customer's first name. @@ -1039,6 +1473,7 @@ paths: password: type: string description: The Customer's password. + format: password groups: type: array items: @@ -1046,12 +1481,14 @@ paths: - id properties: id: - description: The id of a customer group + description: The ID of a customer group type: string description: A list of customer groups to which the customer belongs. metadata: + description: >- + An optional set of key-value pairs to hold additional + information. type: object - description: Metadata for the customer. tags: - Customer responses: @@ -1073,13 +1510,13 @@ paths: - in: path name: id required: true - description: The id of the Discount. + description: The ID of the Discount. schema: type: string - in: path name: region_id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string tags: @@ -1104,13 +1541,13 @@ paths: - in: path name: id required: true - description: The id of the Discount. + description: The ID of the Discount. schema: type: string - in: path name: region_id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string tags: @@ -1127,13 +1564,16 @@ paths: '/discounts/{discount_id}/conditions': post: operationId: PostDiscountsDiscountConditions - summary: Creates a DiscountCondition + summary: >- + Creates a DiscountCondition. Only one of `products`, `product_types`, + `product_collections`, `product_tags`, and `customer_groups` should be + provided. x-authenticated: true parameters: - in: path name: discount_id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string - in: query @@ -1155,29 +1595,50 @@ paths: content: application/json: schema: + required: + - operator properties: operator: description: Operator of the condition type: string - items: - properties: - products: - type: array - description: list of products - product_types: - type: array - description: list of product types - product_collections: - type: array - description: list of product collections - product_tags: - type: array - description: list of product tags - customer_groups: - type: array - description: list of customer_groups + enum: + - in + - not_in + products: + type: array + description: list of product IDs if the condition is applied on products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is applied on + product types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is applied + on product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is applied on + product tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is applied on + customer groups. + items: + type: string tags: - - Discount + - Discount Condition responses: '200': description: OK @@ -1195,6 +1656,17 @@ paths: description: >- Creates a Discount with a given set of rules that define how the Discount behaves. + parameters: + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string requestBody: content: application/json: @@ -1207,21 +1679,105 @@ paths: type: string description: A unique code that will be used to redeem the Discount is_dynamic: - type: string + type: boolean description: >- Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules. + default: false rule: description: The Discount Rule that defines how Discounts are calculated - oneOf: - - $ref: '#/components/schemas/discount_rule' + type: object + required: + - type + - value + - allocation + properties: + description: + type: string + description: A short description of the discount + type: + type: string + description: >- + The type of the Discount, can be `fixed` for discounts + that reduce the price by a fixed amount, `percentage` + for percentage reductions or `free_shipping` for + shipping vouchers. + enum: + - fixed + - percentage + - free_shipping + value: + type: number + description: >- + The value that the discount represents; this will depend + on the type of the discount + allocation: + type: string + description: The scope that the discount should apply to. + enum: + - total + - item + conditions: + type: array + description: >- + A set of conditions that can be used to limit when the + discount can be used. Only one of `products`, + `product_types`, `product_collections`, `product_tags`, + and `customer_groups` should be provided. + items: + type: object + required: + - operator + properties: + operator: + type: string + description: Operator of the condition + enum: + - in + - not_in + products: + type: array + description: >- + list of product IDs if the condition is applied on + products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is + applied on product types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is + applied on product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is + applied on product tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is + applied on customer groups. + items: + type: string is_disabled: type: boolean description: >- Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. + default: false starts_at: type: string format: date-time @@ -1232,6 +1788,10 @@ paths: description: >- The time at which the Discount should no longer be available. + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S regions: description: >- A list of Region ids representing the Regions in which the @@ -1266,9 +1826,34 @@ paths: parameters: - in: query name: q - description: Search query applied on results. + description: Search query applied on the code field. schema: type: string + - in: query + name: rule + description: Discount Rules filters to apply on the search + schema: + type: object + properties: + type: + type: string + enum: + - fixed + - percentage + - free_shipping + description: >- + The type of the Discount, can be `fixed` for discounts that + reduce the price by a fixed amount, `percentage` for + percentage reductions or `free_shipping` for shipping + vouchers. + allocation: + type: string + enum: + - total + - item + description: >- + The value that the discount represents; this will depend on + the type of the discount - in: query name: is_dynamic description: Return only dynamic discounts. @@ -1284,11 +1869,13 @@ paths: description: The number of items in the response schema: type: number + default: '20' - in: query name: offset description: The offset of items in response schema: type: number + default: '0' - in: query name: expand description: Comma separated list of relations to include in the results. @@ -1303,8 +1890,19 @@ paths: application/json: schema: properties: - discount: - $ref: '#/components/schemas/discount' + discounts: + type: array + items: + $ref: '#/components/schemas/discount' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/discounts/{id}/dynamic-codes': post: operationId: PostDiscountsDiscountDynamicCodes @@ -1317,7 +1915,7 @@ paths: - in: path name: id required: true - description: The id of the Discount to create the dynamic code from." + description: The ID of the Discount to create the dynamic code from." schema: type: string tags: @@ -1338,14 +1936,14 @@ paths: type: object required: - code - - usage_limit properties: code: type: string description: The unique code that will be used to redeem the Discount. usage_limit: type: number - description: amount of times the discount can be applied + default: '1' + description: amount of times the discount can be applied. metadata: type: object description: >- @@ -1359,19 +1957,29 @@ paths: x-authenticated: true parameters: - in: path - name: id + name: discount_id required: true - description: The id of the Discount + description: The ID of the Discount schema: type: string - in: path name: condition_id required: true - description: The id of the DiscountCondition + description: The ID of the DiscountCondition + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. schema: type: string tags: - - Discount + - Discount Condition responses: '200': description: OK @@ -1381,15 +1989,20 @@ paths: properties: id: type: string - description: The id of the deleted DiscountCondition + description: The ID of the deleted DiscountCondition object: type: string description: The type of the object that was deleted. + default: discount-condition deleted: type: boolean + description: >- + Whether the discount condition was deleted successfully or + not. + default: true discount: - type: object description: The Discount to which the condition used to belong + $ref: '#/components/schemas/discount' get: operationId: GetDiscountsDiscountConditionsCondition summary: Gets a DiscountCondition @@ -1398,13 +2011,13 @@ paths: - in: path name: discount_id required: true - description: The id of the Discount. + description: The ID of the Discount. schema: type: string - in: path name: condition_id required: true - description: The id of the DiscountCondition. + description: The ID of the DiscountCondition. schema: type: string - in: query @@ -1419,7 +2032,7 @@ paths: type: string description: Gets a DiscountCondition tags: - - DiscountCondition + - Discount Condition responses: '200': description: OK @@ -1431,26 +2044,35 @@ paths: $ref: '#/components/schemas/discount_condition' post: operationId: PostDiscountsDiscountConditionsCondition - summary: Updates a DiscountCondition + summary: >- + Updates a DiscountCondition. Only one of `products`, `product_types`, + `product_collections`, `product_tags`, and `customer_groups` should be + provided. x-authenticated: true parameters: - in: path name: discount_id required: true - description: The id of the Product. + description: The ID of the Product. + schema: + type: string + - in: path + name: condition_id + required: true + description: The ID of the DiscountCondition. schema: type: string - in: query name: expand description: >- - (Comma separated) Which fields should be expanded in each product of + (Comma separated) Which fields should be expanded in each item of the result. schema: type: string - in: query name: fields description: >- - (Comma separated) Which fields should be included in each product of + (Comma separated) Which fields should be included in each item of the result. schema: type: string @@ -1459,26 +2081,40 @@ paths: content: application/json: schema: - required: - - id properties: - items: - properties: - products: - type: array - description: list of products - product_types: - type: array - description: list of product types - product_collections: - type: array - description: list of product collections - product_tags: - type: array - description: list of product tags - customer_groups: - type: array - description: list of customer_groups + products: + type: array + description: list of product IDs if the condition is applied on products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is applied on + product types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is applied + on product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is applied on + product tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is applied on + customer groups. + items: + type: string tags: - Discount responses: @@ -1500,7 +2136,7 @@ paths: - in: path name: id required: true - description: The id of the Discount + description: The ID of the Discount schema: type: string tags: @@ -1514,12 +2150,15 @@ paths: properties: id: type: string - description: The id of the deleted Discount + description: The ID of the deleted Discount object: type: string description: The type of the object that was deleted. + default: discount deleted: type: boolean + description: Whether the discount was deleted successfully or not. + default: true get: operationId: GetDiscountsDiscount summary: Retrieve a Discount @@ -1529,7 +2168,7 @@ paths: - in: path name: id required: true - description: The id of the Discount + description: The ID of the Discount schema: type: string - in: query @@ -1564,7 +2203,21 @@ paths: - in: path name: id required: true - description: The id of the Discount. + description: The ID of the Discount. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of + the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each item of + the result. schema: type: string requestBody: @@ -1577,8 +2230,83 @@ paths: description: A unique code that will be used to redeem the Discount rule: description: The Discount Rule that defines how Discounts are calculated - oneOf: - - $ref: '#/components/schemas/discount_rule' + type: object + required: + - id + properties: + id: + type: string + description: The ID of the Rule + description: + type: string + description: A short description of the discount + value: + type: number + description: >- + The value that the discount represents; this will depend + on the type of the discount + allocation: + type: string + description: The scope that the discount should apply to. + enum: + - total + - item + conditions: + type: array + description: >- + A set of conditions that can be used to limit when the + discount can be used. Only one of `products`, + `product_types`, `product_collections`, `product_tags`, + and `customer_groups` should be provided. + items: + type: object + required: + - operator + properties: + id: + type: string + description: The ID of the Rule + operator: + type: string + description: Operator of the condition + enum: + - in + - not_in + products: + type: array + description: >- + list of product IDs if the condition is applied on + products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is + applied on product types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is + applied on product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is + applied on product tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is + applied on customer groups. + items: + type: string is_disabled: type: boolean description: >- @@ -1594,6 +2322,13 @@ paths: description: >- The time at which the Discount should no longer be available. + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + usage_limit: + type: number + description: Maximum times the discount can be used regions: description: >- A list of Region ids representing the Regions in which the @@ -1625,13 +2360,13 @@ paths: - in: path name: id required: true - description: The id of the Discount + description: The ID of the Discount schema: type: string - in: path name: code required: true - description: The id of the Discount + description: The ID of the Discount schema: type: string tags: @@ -1658,6 +2393,16 @@ paths: description: The code of the Discount schema: type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string tags: - Discount responses: @@ -1669,6 +2414,60 @@ paths: properties: discount: $ref: '#/components/schemas/discount' + /apps/authorizations: + post: + operationId: PostApps + summary: Generates a token for an application. + description: Generates a token for an application. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - application_name + - state + - code + properties: + application_name: + type: string + description: Name of the application for the token to be generated for. + state: + type: string + description: State of the application. + code: + type: string + description: The code for the generated token. + tags: + - App + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + apps: + $ref: '#/components/schemas/OAuth' + /apps: + get: + operationId: GetApps + summary: List applications + description: Retrieve a list of applications. + x-authenticated: true + tags: + - App + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + apps: + type: array + items: + $ref: '#/components/schemas/OAuth' /draft-orders: post: operationId: PostDraftOrders @@ -1688,25 +2487,30 @@ paths: status: description: The status of the draft order type: string + enum: + - open + - completed email: description: The email of the customer of the draft order type: string + format: email billing_address: description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address' + $ref: '#/components/schemas/address' shipping_address: description: The Address to be used for shipping. - anyOf: - - $ref: '#/components/schemas/address' + $ref: '#/components/schemas/address' items: description: The Line Items that have been received. type: array items: + type: object + required: + - quantity properties: variant_id: description: >- - The id of the Product Variant to generate the Line + The ID of the Product Variant to generate the Line Item from. type: string unit_price: @@ -1724,18 +2528,21 @@ paths: about the Line Item. type: object region_id: - description: The id of the region for the draft order + description: The ID of the region for the draft order type: string discounts: description: The discounts to add on the draft order type: array items: + type: object + required: + - code properties: code: description: The code of the discount to apply type: string customer_id: - description: The id of the customer to add on the draft order + description: The ID of the customer to add on the draft order type: string no_notification_order: description: >- @@ -1746,9 +2553,12 @@ paths: description: The shipping methods for the draft order type: array items: + type: object + required: + - option_id properties: option_id: - description: The id of the shipping option in use + description: The ID of the shipping option in use type: string data: description: >- @@ -1779,6 +2589,26 @@ paths: summary: List Draft Orders description: Retrieves an list of Draft Orders x-authenticated: true + parameters: + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: number + default: '0' + - in: query + name: limit + description: Limit the number of items returned. + schema: + type: number + default: '50' + - in: query + name: q + description: >- + a search term to search emails in carts associated with draft orders + and display IDs of draft orders + schema: + type: string tags: - Draft Order responses: @@ -1788,8 +2618,19 @@ paths: application/json: schema: properties: - draft_order: - $ref: '#/components/schemas/draft-order' + draft_orders: + type: array + items: + $ref: '#/components/schemas/draft-order' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/draft-orders/{id}/line-items': post: operationId: PostDraftOrdersDraftOrderLineItems @@ -1800,7 +2641,7 @@ paths: - in: path name: id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string requestBody: @@ -1812,7 +2653,7 @@ paths: properties: variant_id: description: >- - The id of the Product Variant to generate the Line Item + The ID of the Product Variant to generate the Line Item from. type: string unit_price: @@ -1821,6 +2662,7 @@ paths: title: description: The potential custom title of the item. type: string + default: Custom item quantity: description: The quantity of the Line Item. type: integer @@ -1850,7 +2692,7 @@ paths: - in: path name: id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string tags: @@ -1864,12 +2706,15 @@ paths: properties: id: type: string - description: The id of the deleted Draft Order. + description: The ID of the deleted Draft Order. object: type: string description: The type of the object that was deleted. + default: draft-order deleted: type: boolean + description: Whether the draft order was deleted successfully or not. + default: true get: operationId: GetDraftOrdersDraftOrder summary: Retrieve a Draft Order @@ -1879,7 +2724,7 @@ paths: - in: path name: id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string tags: @@ -1903,13 +2748,13 @@ paths: - in: path name: id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string - in: path name: line_id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string tags: @@ -1932,13 +2777,13 @@ paths: - in: path name: id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string - in: path name: line_id required: true - description: The id of the Line Item. + description: The ID of the Line Item. schema: type: string requestBody: @@ -1971,7 +2816,7 @@ paths: properties: draft_order: $ref: '#/components/schemas/draft-order' - '/draft-orders/{id}/register-payment': + '/draft-orders/{id}/pay': post: summary: Registers a payment for a Draft Order operationId: PostDraftOrdersDraftOrderRegisterPayment @@ -1993,7 +2838,7 @@ paths: application/json: schema: properties: - draft_order: + order: $ref: '#/components/schemas/draft-order' '/admin/draft-orders/{id}': post: @@ -2005,7 +2850,7 @@ paths: - in: path name: id required: true - description: The id of the Draft Order. + description: The ID of the Draft Order. schema: type: string requestBody: @@ -2015,22 +2860,31 @@ paths: properties: region_id: type: string - description: The id of the Region to create the Draft Order in. + description: The ID of the Region to create the Draft Order in. + country_code: + type: string + description: The 2 character ISO code for the Country. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. email: type: string description: An email to be used on the Draft Order. + format: email billing_address: description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address' + $ref: '#/components/schemas/address' shipping_address: description: The Address to be used for shipping. - anyOf: - - $ref: '#/components/schemas/address' + $ref: '#/components/schemas/address' discounts: description: An array of Discount codes to add to the Draft Order. type: array items: + type: object + required: + - code properties: code: description: The code that a Discount is identifed by. @@ -2041,7 +2895,7 @@ paths: use of notifications. type: boolean 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 tags: - Draft Order @@ -2066,6 +2920,8 @@ paths: content: application/json: schema: + required: + - region_id properties: value: type: integer @@ -2084,10 +2940,8 @@ paths: The time at which the Gift Card should no longer be available. region_id: - description: The id of the Region in which the Gift Card can be used. - type: array - items: - type: string + description: The ID of the Region in which the Gift Card can be used. + type: string metadata: description: >- An optional set of key-value pairs to hold additional @@ -2109,6 +2963,24 @@ paths: summary: List Gift Cards description: Retrieves a list of Gift Cards. x-authenticated: true + parameters: + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: number + default: '0' + - in: query + name: limit + description: Limit the number of items returned. + schema: + type: number + default: '50' + - in: query + name: q + description: a search term to search by code or display ID + schema: + type: string tags: - Gift Card responses: @@ -2122,6 +2994,15 @@ paths: type: array items: $ref: '#/components/schemas/gift_card' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/gift-cards/{id}': delete: operationId: DeleteGiftCardsGiftCard @@ -2132,7 +3013,7 @@ paths: - in: path name: id required: true - description: The id of the Gift Card to delete. + description: The ID of the Gift Card to delete. schema: type: string tags: @@ -2146,12 +3027,15 @@ paths: properties: id: type: string - description: The id of the deleted Gift Card + description: The ID of the deleted Gift Card object: type: string description: The type of the object that was deleted. + default: gift-card deleted: type: boolean + description: Whether the gift card was deleted successfully or not. + default: true get: operationId: GetGiftCardsGiftCard summary: Retrieve a Gift Card @@ -2161,7 +3045,7 @@ paths: - in: path name: id required: true - description: The id of the Gift Card. + description: The ID of the Gift Card. schema: type: string tags: @@ -2186,7 +3070,7 @@ paths: - in: path name: id required: true - description: The id of the Gift Card. + description: The ID of the Gift Card. schema: type: string requestBody: @@ -2211,10 +3095,8 @@ paths: The time at which the Gift Card should no longer be available. region_id: - description: The id of the Region in which the Gift Card can be used. - type: array - items: - type: string + description: The ID of the Region in which the Gift Card can be used. + type: string metadata: description: >- An optional set of key-value pairs to hold additional @@ -2264,8 +3146,9 @@ paths: password: description: The desired password for the User type: string + format: password tags: - - Invites + - Invite responses: '200': description: OK @@ -2286,11 +3169,16 @@ paths: user: description: The email for the user to be created. type: string + format: email role: description: The role of the user to be created. type: string + enum: + - admin + - member + - developer tags: - - Invites + - Invite responses: '200': description: OK @@ -2300,7 +3188,7 @@ paths: description: Lists all Invites x-authenticated: true tags: - - Invites + - Invite responses: '200': description: OK @@ -2322,14 +3210,29 @@ paths: - in: path name: invite_id required: true - description: The id of the Invite + description: The ID of the Invite schema: type: string tags: - - Invites + - Invite responses: '200': description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Invite. + object: + type: string + description: The type of the object that was deleted. + format: invite + deleted: + type: boolean + description: Whether or not the Invite was deleted. + default: true '/invites/{invite_id}/resend': post: operationId: PostInvitesInviteResend @@ -2340,11 +3243,11 @@ paths: - in: path name: invite_id required: true - description: The id of the Invite + description: The ID of the Invite schema: type: string tags: - - Invites + - Invite responses: '200': description: OK @@ -2358,10 +3261,14 @@ paths: content: application/json: schema: + required: + - resource_id + - resource_type + - value properties: resource_id: type: string - description: The id of the resource which the Note relates to. + description: The ID of the resource which the Note relates to. resource_type: type: string description: The type of resource which the Note relates to. @@ -2385,27 +3292,23 @@ paths: x-authenticated: true description: Retrieves a list of notes parameters: - - in: path + - in: query name: limit - required: true description: The number of notes to get schema: type: number - default: '' - - in: path + default: '50' + - in: query name: offset - required: true description: The offset at which to get notes schema: type: number - default: '' - - in: path + default: '0' + - in: query name: resource_id - required: true - description: The id which the notes belongs to + description: The ID which the notes belongs to schema: type: string - default: '' tags: - Note responses: @@ -2419,6 +3322,15 @@ paths: type: array items: $ref: '#/components/schemas/note' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/notes/{id}': delete: operationId: DeleteNotesNote @@ -2429,7 +3341,7 @@ paths: - in: path name: id required: true - description: The id of the Note to delete. + description: The ID of the Note to delete. schema: type: string tags: @@ -2443,10 +3355,15 @@ paths: properties: id: type: string - description: The id of the deleted Note. + description: The ID of the deleted Note. + object: + type: string + description: The type of the object that was deleted. + default: note deleted: type: boolean description: Whether or not the Note was deleted. + default: true get: operationId: GetNotesNote summary: Get Note @@ -2456,7 +3373,7 @@ paths: - in: path name: id required: true - description: The id of the note to retrieve. + description: The ID of the note to retrieve. schema: type: string tags: @@ -2479,7 +3396,7 @@ paths: - in: path name: id required: true - description: The id of the Note to update + description: The ID of the Note to update schema: type: string requestBody: @@ -2526,35 +3443,44 @@ paths: default: 50 - in: query name: fields - description: The fields to include in the result set + description: Comma separated fields to include in the result set schema: type: string - in: query name: expand - description: The fields to populate + description: Comma separated fields to populate schema: type: string - in: query name: event_name + description: The name of the event that the notification was sent for. schema: type: string - in: query name: resource_type + description: The type of resource that the Notification refers to. schema: type: string - in: query name: resource_id + description: The ID of the resource that the Notification refers to. schema: type: string - in: query name: to + description: >- + 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 schema: type: string - in: query name: include_resends - description: Whether the result set should include resent notifications or not + description: >- + A boolean indicating whether the result set should include resent + notifications or not schema: - type: boolean + type: string tags: - Notification responses: @@ -2580,7 +3506,7 @@ paths: - in: path name: id required: true - description: The id of the Notification + description: The ID of the Notification schema: type: string requestBody: @@ -2590,8 +3516,8 @@ paths: properties: to: description: >- - The address or user identifier that the Notification was - sent to + A new address or user identifier that the Notification + should be sent to type: string tags: - Notification @@ -2617,7 +3543,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string tags: @@ -2639,7 +3565,6 @@ paths: required: - price - option_id - - data properties: price: type: integer @@ -2649,7 +3574,7 @@ paths: option_id: type: string description: >- - The id of the Shipping Option to create the Shipping Method + The ID of the Shipping Option to create the Shipping Method from. data: type: object @@ -2667,7 +3592,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string tags: @@ -2691,13 +3616,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: claim_id required: true - description: The id of the Claim. + description: The ID of the Claim. schema: type: string tags: @@ -2710,7 +3635,7 @@ paths: schema: properties: order: - $ref: '#/components/schemas/claim_order' + $ref: '#/components/schemas/order' '/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel': post: operationId: PostOrdersClaimFulfillmentsCancel @@ -2721,19 +3646,19 @@ paths: - in: path name: id required: true - description: The id of the Order which the Claim relates to. + description: The ID of the Order which the Claim relates to. schema: type: string - in: path name: claim_id required: true - description: The id of the Claim which the Fulfillment relates to. + description: The ID of the Claim which the Fulfillment relates to. schema: type: string - in: path name: fulfillment_id required: true - description: The id of the Fulfillment. + description: The ID of the Fulfillment. schema: type: string tags: @@ -2745,8 +3670,8 @@ paths: application/json: schema: properties: - fulfillment: - $ref: '#/components/schemas/fulfillment' + order: + $ref: '#/components/schemas/order' '/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel': post: operationId: PostOrdersSwapFulfillmentsCancel @@ -2757,19 +3682,19 @@ paths: - in: path name: id required: true - description: The id of the Order which the Swap relates to. + description: The ID of the Order which the Swap relates to. schema: type: string - in: path name: swap_id required: true - description: The id of the Swap which the Fulfillment relates to. + description: The ID of the Swap which the Fulfillment relates to. schema: type: string - in: path name: fulfillment_id required: true - description: The id of the Fulfillment. + description: The ID of the Fulfillment. schema: type: string tags: @@ -2781,8 +3706,8 @@ paths: application/json: schema: properties: - fulfillment: - $ref: '#/components/schemas/fulfillment' + order: + $ref: '#/components/schemas/order' '/orders/{id}/fulfillments/{fulfillment_id}/cancel': post: operationId: PostOrdersOrderFulfillmentsCancel @@ -2793,13 +3718,13 @@ paths: - in: path name: id required: true - description: The id of the Order which the Fulfillment relates to. + description: The ID of the Order which the Fulfillment relates to. schema: type: string - in: path name: fulfillment_id required: true - description: The id of the Fulfillment + description: The ID of the Fulfillment schema: type: string tags: @@ -2811,8 +3736,8 @@ paths: application/json: schema: properties: - fulfillment: - $ref: '#/components/schemas/fulfillment' + order: + $ref: '#/components/schemas/order' '/orders/{id}/cancel': post: operationId: PostOrdersOrderCancel @@ -2826,7 +3751,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string tags: @@ -2850,13 +3775,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: swap_id required: true - description: The id of the Swap. + description: The ID of the Swap. schema: type: string tags: @@ -2869,7 +3794,7 @@ paths: schema: properties: order: - $ref: '#/components/schemas/swap' + $ref: '#/components/schemas/order' '/orders/{id}/capture': post: operationId: PostOrdersOrderCapture @@ -2880,7 +3805,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string tags: @@ -2904,7 +3829,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string tags: @@ -2928,13 +3853,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: claim_id required: true - description: The id of the Claim. + description: The ID of the Claim. schema: type: string requestBody: @@ -2945,7 +3870,7 @@ paths: - fulfillment_id properties: fulfillment_id: - description: The id of the Fulfillment. + description: The ID of the Fulfillment. type: string tracking_numbers: description: The tracking numbers for the shipment. @@ -2953,7 +3878,7 @@ paths: items: type: string tags: - - Order + - Claim responses: '200': description: OK @@ -2973,7 +3898,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -2998,9 +3923,12 @@ paths: description: The Claim Items that the Claim will consist of. type: array items: + required: + - item_id + - quantity properties: item_id: - description: The id of the Line Item that will be claimed. + description: The ID of the Line Item that will be claimed. type: string quantity: description: The number of items that will be returned @@ -3038,7 +3966,7 @@ paths: option_id: type: string description: >- - The id of the Shipping Option to create the Shipping + The ID of the Shipping Option to create the Shipping Method from. price: type: integer @@ -3049,9 +3977,12 @@ paths: Replace. type: array items: + required: + - variant_id + - quantity properties: variant_id: - description: The id of the Product Variant to ship. + description: The ID of the Product Variant to ship. type: string quantity: description: The quantity of the Product Variant to ship. @@ -3062,11 +3993,11 @@ paths: items: properties: id: - description: The id of an existing Shipping Method + description: The ID of an existing Shipping Method type: string option_id: description: >- - The id of the Shipping Option to create a Shipping + The ID of the Shipping Option to create a Shipping Method from type: string price: @@ -3077,6 +4008,7 @@ paths: description: >- An optional shipping address to send the claim to. Defaults to the parent order's shipping address + $ref: '#/components/schemas/address' refund_amount: description: >- The amount to refund the Customer when the Claim type is @@ -3093,7 +4025,7 @@ paths: information. type: object tags: - - Order + - Claim responses: '200': description: OK @@ -3103,7 +4035,7 @@ paths: properties: order: $ref: '#/components/schemas/order' - '/orders/{id}/fulfillments': + '/orders/{id}/fulfillment': post: operationId: PostOrdersOrderFulfillments summary: Create a Fulfillment @@ -3115,7 +4047,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -3129,9 +4061,12 @@ paths: description: The Line Items to include in the Fulfillment. type: array items: + required: + - item_id + - quantity properties: item_id: - description: The id of Line Item to fulfill. + description: The ID of Line Item to fulfill. type: string quantity: description: The quantity of the Line Item to fulfill. @@ -3147,7 +4082,7 @@ paths: information. type: object tags: - - Order + - Fulfillment responses: '200': description: OK @@ -3157,237 +4092,6 @@ paths: properties: order: $ref: '#/components/schemas/order' - /orders: - post: - operationId: PostOrders - summary: Create an order - description: Creates and order - x-authenticated: true - requestBody: - content: - application/json: - schema: - required: - - email - - billing_address - - shipping_address - - items - - region - - customer_id - - payment_method - - shipping_method - properties: - status: - description: status of the order - type: string - email: - description: the email for the order - type: string - billing_address: - description: Billing address - anyOf: - - $ref: '#/components/schemas/address' - shipping_address: - description: Shipping address - anyOf: - - $ref: '#/components/schemas/address' - items: - description: The Line Items for the order - type: array - items: - $ref: '#/components/schemas/line_item' - region: - description: Region where the order belongs - type: string - discounts: - description: Discounts applied to the order - type: array - items: - $ref: '#/components/schemas/line_item' - customer_id: - description: id of the customer - type: string - payment_method: - description: payment method chosen for the order - type: object - required: - - provider_id - properties: - provider_id: - type: string - description: id of the payment provider - data: - description: Data relevant for the given payment method - type: object - shipping_method: - description: The Shipping Method used for shipping the order. - type: object - required: - - provider_id - - profile_id - - price - properties: - provider_id: - type: string - description: The id of the shipping provider. - profile_id: - type: string - description: The id of the shipping profile. - price: - type: integer - description: The price of the shipping. - data: - type: object - description: Data relevant to the specific shipping method. - items: - type: array - items: - $ref: '#/components/schemas/line_item' - description: Items to ship - no_notification: - description: >- - A flag to indicate if no notifications should be emitted - related to the updated order. - type: boolean - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - get: - operationId: GetOrders - summary: List Orders - description: Retrieves a list of Orders - x-authenticated: true - parameters: - - in: query - name: q - description: Query used for searching orders. - schema: - type: string - - in: query - name: id - description: Id of the order to search for. - schema: - type: string - - in: query - name: status - style: form - explode: false - description: Status to search for - schema: - type: array - items: - type: string - - in: query - name: fulfillment_status - description: Fulfillment status to search for. - schema: - type: string - - in: query - name: payment_status - description: Payment status to search for. - schema: - type: string - - in: query - name: display_id - description: Display id to search for. - schema: - type: string - - in: query - name: cart_id - description: to search for. - schema: - type: string - - in: query - name: customer_id - description: to search for. - schema: - type: string - - in: query - name: email - description: to search for. - schema: - type: string - - in: query - name: region_id - description: to search for. - schema: - type: string - - in: query - name: currency_code - description: to search for. - schema: - type: string - - in: query - name: tax_rate - description: to search for. - schema: - type: string - - in: query - name: cancelled_at - description: >- - Date comparison for when resulting orders was cancelled, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: created_at - description: >- - Date comparison for when resulting orders was created, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: updated_at - description: >- - Date comparison for when resulting orders was updated, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: offset - description: How many orders to skip in the result. - schema: - type: string - - in: query - name: limit - description: Limit the number of orders returned. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated) Which fields should be expanded in each order of - the result. - schema: - type: string - - in: query - name: fields - description: >- - (Comma separated) Which fields should be included in each order of - the result. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - orders: - type: array - items: - $ref: '#/components/schemas/order' '/orders/{id}/shipment': post: operationId: PostOrdersOrderShipment @@ -3398,7 +4102,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -3409,7 +4113,7 @@ paths: - fulfillment_id properties: fulfillment_id: - description: The id of the Fulfillment. + description: The ID of the Fulfillment. type: string tracking_numbers: description: The tracking numbers for the shipment. @@ -3442,13 +4146,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: swap_id required: true - description: The id of the Swap. + description: The ID of the Swap. schema: type: string requestBody: @@ -3459,7 +4163,7 @@ paths: - fulfillment_id properties: fulfillment_id: - description: The id of the Fulfillment. + description: The ID of the Fulfillment. type: string tracking_numbers: description: The tracking numbers for the shipment. @@ -3472,7 +4176,7 @@ paths: Claim. type: boolean tags: - - Order + - Swap responses: '200': description: OK @@ -3494,7 +4198,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -3513,19 +4217,27 @@ paths: - quantity properties: item_id: - description: The id of the Line Item that will be claimed. + description: The ID of the Line Item that will be claimed. type: string quantity: description: The number of items that will be returned type: integer + reason_id: + description: The ID of the Return Reason to use. + type: string + note: + description: An optional note with information about the Return. + type: string return_shipping: description: How the Swap will be returned. type: object + required: + - option_id properties: option_id: type: string description: >- - The id of the Shipping Option to create the Shipping + The ID of the Shipping Option to create the Shipping Method from. price: type: integer @@ -3539,7 +4251,7 @@ paths: - quantity properties: variant_id: - description: The id of the Product Variant to ship. + description: The ID of the Product Variant to ship. type: string quantity: description: The quantity of the Product Variant to ship. @@ -3556,7 +4268,7 @@ paths: properties: option_id: description: >- - The id of the Shipping Option to override with a + The ID of the Shipping Option to override with a custom price. type: string price: @@ -3570,38 +4282,9 @@ paths: allow_backorder: description: 'If true, swaps can be completed with items out of stock' type: boolean + default: true tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/order/{id}/metadata/{key}': - delete: - operationId: DeleteOrdersOrderMetadataKey - summary: Delete Metadata - description: Deletes a metadata key. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - - in: path - name: key - required: true - description: The metadata key. - schema: - type: string - tags: - - Order + - Swap responses: '200': description: OK @@ -3621,13 +4304,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: claim_id required: true - description: The id of the Claim. + description: The ID of the Claim. schema: type: string requestBody: @@ -3646,7 +4329,7 @@ paths: Claim. type: boolean tags: - - Order + - Fulfillment responses: '200': description: OK @@ -3666,13 +4349,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: swap_id required: true - description: The id of the Swap. + description: The ID of the Swap. schema: type: string requestBody: @@ -3691,7 +4374,7 @@ paths: Claim. type: boolean tags: - - Order + - Fulfillment responses: '200': description: OK @@ -3711,7 +4394,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string tags: @@ -3734,7 +4417,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -3759,15 +4442,15 @@ paths: items: $ref: '#/components/schemas/line_item' region: - description: Region where the order belongs + description: ID of the region where the order belongs type: string discounts: description: Discounts applied to the order type: array items: - $ref: '#/components/schemas/line_item' + $ref: '#/components/schemas/discount' customer_id: - description: id of the customer + description: ID of the customer type: string payment_method: description: payment method chosen for the order @@ -3775,7 +4458,7 @@ paths: properties: provider_id: type: string - description: id of the payment provider + description: ID of the payment provider data: description: Data relevant for the given payment method type: object @@ -3785,10 +4468,10 @@ paths: properties: provider_id: type: string - description: The id of the shipping provider. + description: The ID of the shipping provider. profile_id: type: string - description: The id of the shipping profile. + description: The ID of the shipping profile. price: type: integer description: The price of the shipping. @@ -3816,6 +4499,248 @@ paths: properties: order: $ref: '#/components/schemas/order' + /orders: + get: + operationId: GetOrders + summary: List Orders + description: Retrieves a list of Orders + x-authenticated: true + parameters: + - in: query + name: q + description: >- + Query used for searching orders by shipping address first name, + orders' email, and orders' display ID + schema: + type: string + - in: query + name: id + description: ID of the order to search for. + schema: + type: string + - in: query + name: status + style: form + explode: false + description: Status to search for + schema: + type: array + items: + type: string + enum: + - pending + - completed + - archived + - canceled + - requires_action + - in: query + name: fulfillment_status + style: form + explode: false + description: Fulfillment status to search for. + schema: + type: array + items: + type: string + enum: + - not_fulfilled + - fulfilled + - partially_fulfilled + - shipped + - partially_shipped + - canceled + - returned + - partially_returned + - requires_action + - in: query + name: payment_status + style: form + explode: false + description: Payment status to search for. + schema: + type: array + items: + type: string + enum: + - captured + - awaiting + - not_paid + - refunded + - partially_refunded + - canceled + - requires_action + - in: query + name: display_id + description: Display ID to search for. + schema: + type: string + - in: query + name: cart_id + description: to search for. + schema: + type: string + - in: query + name: customer_id + description: to search for. + schema: + type: string + - in: query + name: email + description: to search for. + schema: + type: string + - in: query + name: region_id + style: form + explode: false + description: Regions to search orders by + schema: + oneOf: + - type: string + description: ID of a Region. + - type: array + items: + type: string + description: ID of a Region. + - in: query + name: currency_code + style: form + explode: false + description: Currency code to search for + schema: + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + - in: query + name: tax_rate + description: to search for. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting orders were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting orders were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: canceled_at + description: Date comparison for when resulting orders were canceled. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: sales_channel_id + style: form + explode: false + description: Filter by Sales Channels + schema: + type: array + items: + type: string + description: The ID of a Sales Channel + - in: query + name: offset + description: How many orders to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of orders returned. + schema: + type: integer + default: 50 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each order of + the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each order of + the result. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + orders: + type: array + items: + $ref: '#/components/schemas/order' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/orders/{id}/swaps/{swap_id}/process-payment': post: operationId: PostOrdersOrderSwapsSwapProcessPayment @@ -3829,17 +4754,17 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: swap_id required: true - description: The id of the Swap. + description: The ID of the Swap. schema: type: string tags: - - Order + - Swap responses: '200': description: OK @@ -3849,7 +4774,7 @@ paths: properties: order: $ref: '#/components/schemas/order' - '/orders/{id}/refunds': + '/orders/{id}/refund': post: operationId: PostOrdersOrderRefunds summary: Create a Refund @@ -3859,7 +4784,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -3877,7 +4802,7 @@ paths: description: The reason for the Refund. type: string note: - description: A not with additional details about the Refund. + description: A note with additional details about the Refund. type: string no_notification: description: >- @@ -3895,7 +4820,7 @@ paths: properties: order: $ref: '#/components/schemas/order' - '/orders/{id}/returns': + '/orders/{id}/return': post: operationId: PostOrdersOrderReturns summary: Request a Return @@ -3907,7 +4832,7 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string requestBody: @@ -3921,12 +4846,15 @@ paths: description: The Line Items that will be returned. type: array items: + required: + - item_id + - quantity properties: item_id: - description: The id of the Line Item. + description: The ID of the Line Item. type: string reason_id: - description: The id of the Return Reason to use. + description: The ID of the Return Reason to use. type: string note: description: An optional note with information about the Return. @@ -3943,16 +4871,20 @@ paths: option_id: type: string description: >- - The id of the Shipping Option to create the Shipping + The ID of the Shipping Option to create the Shipping Method from. price: type: integer description: The price to charge for the Shipping Method. + note: + description: An optional note with information about the Return. + type: string receive_now: description: >- A flag to indicate if the Return should be registerd as received immediately. type: boolean + default: false no_notification: description: >- A flag to indicate if no notifications should be emitted @@ -3962,6 +4894,7 @@ paths: description: The amount to refund. type: integer tags: + - Return - Order responses: '200': @@ -3982,13 +4915,13 @@ paths: - in: path name: id required: true - description: The id of the Order. + description: The ID of the Order. schema: type: string - in: path name: claim_id required: true - description: The id of the Claim. + description: The ID of the Claim. schema: type: string requestBody: @@ -4000,12 +4933,16 @@ paths: description: The Claim Items that the Claim will consist of. type: array items: + required: + - id + - images + - tags properties: id: - description: The id of the Claim Item. + description: The ID of the Claim Item. type: string item_id: - description: The id of the Line Item that will be claimed. + description: The ID of the Line Item that will be claimed. type: string quantity: description: The number of items that will be returned @@ -4027,24 +4964,44 @@ paths: description: A list o tags to add to the Claim Item type: array items: - type: string + type: object + properties: + id: + type: string + description: Tag ID + value: + type: string + description: Tag value images: description: >- A list of image URL's that will be associated with the Claim + type: array items: - type: string + type: object + properties: + id: + type: string + description: Image ID + url: + type: string + description: Image URL + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object shipping_methods: description: The Shipping Methods to send the additional Line Items with. type: array items: properties: id: - description: The id of an existing Shipping Method + description: The ID of an existing Shipping Method type: string option_id: description: >- - The id of the Shipping Option to create a Shipping + The ID of the Shipping Option to create a Shipping Method from type: string price: @@ -4061,7 +5018,7 @@ paths: information. type: object tags: - - Order + - Claim responses: '200': description: OK @@ -4081,7 +5038,7 @@ paths: - in: path name: id required: true - description: The id of the Price List to update prices for. + description: The ID of the Price List to update prices for. schema: type: string requestBody: @@ -4093,33 +5050,39 @@ paths: description: The prices to update or add. type: array items: + required: + - amount + - variant_id properties: id: - description: The id of the price. + description: The ID of the price. type: string - status: - description: The status of the Price List. - type: string - enum: - - active - - draft region_id: - description: The id of the Region for which the price is used. + description: >- + The ID of the Region for which the price is used. Only + required if currecny_code is not provided. type: string currency_code: description: >- The 3 character ISO currency code for which the price - will be used. + will be used. Only required if region_id is not + provided. + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + variant_id: + description: The ID of the Variant for which the price is used. type: string amount: - description: The amount of the price. - type: number + description: The amount to charge for the Product Variant. + type: integer min_quantity: description: The minimum quantity for which the price will be used. - type: number + type: integer max_quantity: description: The maximum quantity for which the price will be used. - type: number + type: integer override: description: >- If true the prices will replace all existing prices @@ -4134,26 +5097,20 @@ paths: application/json: schema: properties: - id: - type: string - description: The id of the deleted Price List. - object: - type: string - description: The type of the object that was deleted. - deleted: - type: boolean + price_list: + $ref: '#/components/schemas/price_list' delete: operationId: DeletePriceListsPriceListPricesBatch - summary: Batch delete prices that belongs to a Price List - description: Batch delete prices that belongs to a Price List + summary: Batch delete prices that belong to a Price List + description: Batch delete prices that belong to a Price List x-authenticated: true parameters: - in: path name: id required: true description: >- - The id of the Price List that the Money Amounts that will be deleted - belongs to. + The ID of the Price List that the Money Amounts (Prices) that will + be deleted belongs to. schema: type: string requestBody: @@ -4179,13 +5136,16 @@ paths: type: array items: type: string - description: The id of the deleted Money Amount. + description: The IDs of the deleted Money Amounts (Prices). object: type: string description: The type of the object that was deleted. + default: money-amount deleted: type: boolean - /price_lists: + description: Whether or not the items were deleted. + default: true + /price-lists: post: operationId: PostPriceListsPriceList summary: Creates a Price List @@ -4195,6 +5155,11 @@ paths: content: application/json: schema: + required: + - name + - description + - type + - prices properties: name: description: The name of the Price List @@ -4202,6 +5167,16 @@ paths: description: description: A description of the Price List. type: string + starts_at: + description: >- + The date with timezone that the Price List starts being + valid. + type: string + format: date + ends_at: + description: The date with timezone that the Price List ends being valid. + type: string + format: date type: description: The type of the Price List. type: string @@ -4218,14 +5193,353 @@ paths: description: The prices of the Price List. type: array items: + required: + - amount + - variant_id properties: region_id: - description: The id of the Region for which the price is used. + description: >- + The ID of the Region for which the price is used. Only + required if currecny_code is not provided. type: string currency_code: description: >- The 3 character ISO currency code for which the price - will be used. + will be used. Only required if region_id is not + provided. + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + amount: + description: The amount to charge for the Product Variant. + type: integer + variant_id: + description: The ID of the Variant for which the price is used. + type: string + min_quantity: + description: The minimum quantity for which the price will be used. + type: integer + max_quantity: + description: The maximum quantity for which the price will be used. + type: integer + customer_groups: + type: array + description: A list of customer groups that the Price List applies to. + items: + required: + - id + properties: + id: + description: The ID of a customer group + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: '#/components/schemas/price_list' + get: + operationId: GetPriceLists + summary: List Price Lists + description: Retrieves a list of Price Lists. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to get + schema: + type: number + default: '10' + - in: query + name: offset + description: The offset at which to get items + schema: + type: number + default: '0' + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of + the result. + schema: + type: string + - in: query + name: order + description: field to order results by. + schema: + type: string + - in: query + name: id + description: ID to search for. + schema: + type: string + - in: query + name: q + description: >- + query to search in price list description, price list name, and + customer group name fields. + schema: + type: string + - in: query + name: status + style: form + explode: false + description: Status to search for. + schema: + type: array + items: + type: string + enum: + - active + - draft + - in: query + name: name + description: price list name to search for. + schema: + type: string + - in: query + name: customer_groups + style: form + explode: false + description: Customer Group IDs to search for. + schema: + type: array + items: + type: string + - in: query + name: type + style: form + explode: false + description: Type to search for. + schema: + type: array + items: + type: string + enum: + - sale + - override + - in: query + name: created_at + description: Date comparison for when resulting price lists were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting price lists were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting price lists were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_lists: + type: array + items: + $ref: '#/components/schemas/price_list' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + '/price-lists/{id}': + delete: + operationId: DeletePriceListsPriceList + summary: Delete a Price List + description: Deletes a Price List + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List to delete. + schema: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Price List. + object: + type: string + description: The type of the object that was deleted. + default: price-list + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + get: + operationId: GetPriceListsPriceList + summary: Retrieve a Price List + description: Retrieves a Price List. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List. + schema: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: '#/components/schemas/price_list' + post: + operationId: PostPriceListsPriceListPriceList + summary: Update a Price List + description: Updates a Price List + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Price List + type: string + description: + description: A description of the Price List. + type: string + starts_at: + description: >- + The date with timezone that the Price List starts being + valid. + type: string + format: date + ends_at: + description: The date with timezone that the Price List ends being valid. + type: string + format: date + type: + description: The type of the Price List. + type: string + enum: + - sale + - override + status: + description: The status of the Price List. + type: string + enum: + - active + - draft + prices: + description: The prices of the Price List. + type: array + items: + required: + - amount + - variant_id + properties: + id: + description: The ID of the price. + type: string + region_id: + description: >- + The ID of the Region for which the price is used. Only + required if currecny_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the price + will be used. Only required if region_id is not + provided. + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + variant_id: + description: The ID of the Variant for which the price is used. type: string amount: description: The amount to charge for the Product Variant. @@ -4244,63 +5558,10 @@ paths: - id properties: id: - description: The id of a customer group + description: The ID of a customer group type: string tags: - Price List - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - product: - $ref: '#/components/schemas/price_list' - '/price-lists/{id}': - delete: - operationId: DeletePriceListsPriceList - summary: Delete a Price List - description: Deletes a Price List - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The id of the Price List to delete. - schema: - type: string - tags: - - Price List - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - id: - type: string - description: The id of the deleted Price List. - object: - type: string - description: The type of the object that was deleted. - deleted: - type: boolean - get: - operationId: GetPriceListsPriceList - summary: Retrieve a Price List - description: Retrieves a Price List. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The id of the Price List. - schema: - type: string - tags: - - Price List responses: '200': description: OK @@ -4321,14 +5582,14 @@ paths: name: id required: true description: >- - The id of the Price List that the Money Amounts that will be deleted + The ID of the Price List that the Money Amounts that will be deleted belongs to. schema: type: string - in: path name: product_id required: true - description: The id of the product from which the money amount will be deleted. + description: The ID of the product from which the money amount will be deleted. schema: type: string tags: @@ -4341,16 +5602,18 @@ paths: schema: properties: ids: - type: number + type: array description: The price ids that have been deleted. - count: - type: number - description: The number of prices that have been deleted. + items: + type: string object: type: string description: The type of the object that was deleted. + default: money-amount deleted: type: boolean + description: Whether or not the items were deleted. + default: true '/price-lists/{id}/variants/{variant_id}/prices': delete: operationId: DeletePriceListsPriceListVariantsVariantPrices @@ -4362,14 +5625,14 @@ paths: name: id required: true description: >- - The id of the Price List that the Money Amounts that will be deleted + The ID of the Price List that the Money Amounts that will be deleted belongs to. schema: type: string - in: path name: variant_id required: true - description: The id of the variant from which the money amount will be deleted. + description: The ID of the variant from which the money amount will be deleted. schema: type: string tags: @@ -4382,16 +5645,18 @@ paths: schema: properties: ids: - type: number + type: array description: The price ids that have been deleted. - count: - type: number - description: The number of prices that have been deleted. + items: + type: string object: type: string description: The type of the object that was deleted. + default: money-amount deleted: type: boolean + description: Whether or not the items were deleted. + default: true '/price-lists/:id/products': get: operationId: GetPriceListsPriceListProducts @@ -4401,26 +5666,33 @@ paths: parameters: - in: query name: q - description: Query used for searching products. + description: >- + Query used for searching product title and description, variant + title and sku, and collection title. schema: type: string - in: query name: id - description: Id of the product to search for. + description: ID of the product to search for. schema: type: string - in: query name: status - description: Status to search for + description: Product status to search for style: form explode: false schema: type: array items: type: string + enum: + - draft + - proposed + - published + - rejected - in: query name: collection_id - description: Collection ids to search for + description: Collection IDs to search for style: form explode: false schema: @@ -4429,7 +5701,7 @@ paths: type: string - in: query name: tags - description: Tags to search for + description: Tag IDs to search for style: form explode: false schema: @@ -4438,17 +5710,17 @@ paths: type: string - in: query name: title - description: to search for. + description: product title to search for. schema: type: string - in: query name: description - description: to search for. + description: product description to search for. schema: type: string - in: query name: handle - description: to search for. + description: product handle to search for. schema: type: string - in: query @@ -4463,40 +5735,87 @@ paths: type: string - in: query name: order - description: to retrieve products in. - schema: - type: string - - in: query - name: deleted_at - description: >- - Date comparison for when resulting products was deleted, i.e. less - than, greater than etc. + description: field to sort results by. schema: type: string - in: query name: created_at - description: >- - Date comparison for when resulting products was created, i.e. less - than, greater than etc. + description: Date comparison for when resulting products were created. schema: - type: string + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at - description: >- - Date comparison for when resulting products was updated, i.e. less - than, greater than etc. + description: Date comparison for when resulting products were updated. schema: - type: string + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting products were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: offset description: How many products to skip in the result. schema: - type: string + type: integer + default: 0 - in: query name: limit description: Limit the number of products returned. schema: - type: string + type: integer + default: 50 - in: query name: expand description: >- @@ -4520,129 +5839,19 @@ paths: application/json: schema: properties: - count: - description: The number of Products. - type: integer - offset: - description: The offset of the Product query. - type: integer - limit: - description: The limit of the Product query. - type: integer products: type: array items: $ref: '#/components/schemas/product' - /price-lists: - get: - operationId: GetPriceLists - summary: List Price Lists - description: Retrieves a list of Price Lists. - x-authenticated: true - tags: - - Price List - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - price_lists: - type: array - items: - $ref: '#/components/schemas/price_list' count: - description: The number of Price Lists. type: integer + description: The total number of items available offset: - description: The offset of the Price List query. type: integer + description: The number of items skipped before these items limit: - description: The limit of the Price List query. type: integer - '/price_lists/{id}': - post: - operationId: PostPriceListsPriceListPriceList - summary: Update a Price List - description: Updates a Price List - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The id of the Price List. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - name: - description: The name of the Price List - type: string - description: - description: A description of the Price List. - type: string - type: - description: The type of the Price List. - type: string - enum: - - sale - - override - status: - description: The status of the Price List. - type: string - enum: - - active - - draft - prices: - description: The prices of the Price List. - type: array - items: - properties: - id: - description: The id of the price. - type: string - region_id: - description: The id of the Region for which the price is used. - type: string - currency_code: - description: >- - The 3 character ISO currency code for which the price - will be used. - type: string - amount: - description: The amount to charge for the Product Variant. - type: integer - min_quantity: - description: The minimum quantity for which the price will be used. - type: integer - max_quantity: - description: The maximum quantity for which the price will be used. - type: integer - customer_groups: - type: array - description: A list of customer groups that the Price List applies to. - items: - required: - - id - properties: - id: - description: The id of a customer group - type: string - tags: - - Price List - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - product: - $ref: '#/components/schemas/price_list' + description: The number of items per page /product-tags: get: operationId: GetProductTags @@ -4654,36 +5863,86 @@ paths: name: limit description: The number of tags to return. schema: - type: string + type: integer + default: 10 - in: query name: offset - description: The offset of tags to return. + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. schema: type: string - in: query name: value - description: The value of tags to return. + style: form + explode: false + description: The tag values to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for schema: type: string - in: query name: id - description: The id of tags to return. + style: form + explode: false + description: The tag IDs to search for schema: - type: string + type: array + items: + type: string - in: query name: created_at - description: >- - Date comparison for when resulting tas was created, i.e. less than, - greater than etc. + description: Date comparison for when resulting product tags were created. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at - description: >- - Date comparison for when resulting tas was updated, i.e. less than, - greater than etc. + description: Date comparison for when resulting product tags were updated. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date tags: - Product Tag responses: @@ -4693,8 +5952,17 @@ paths: application/json: schema: properties: - tags: + product_tags: $ref: '#/components/schemas/product_tag' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page /product-types: get: operationId: GetProductTypes @@ -4706,38 +5974,88 @@ paths: name: limit description: The number of types to return. schema: - type: string + type: integer + default: 10 - in: query name: offset - description: The offset of types to return. + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. schema: type: string - in: query name: value - description: The value of types to return. + style: form + explode: false + description: The type values to search for schema: - type: string + type: array + items: + type: string - in: query name: id - description: The id of types to return. + style: form + explode: false + description: The type IDs to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for schema: type: string - in: query name: created_at - description: >- - Date comparison for when resulting tas was created, i.e. less than, - greater than etc. + description: Date comparison for when resulting product types were created. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at - description: >- - Date comparison for when resulting tas was updated, i.e. less than, - greater than etc. + description: Date comparison for when resulting product types were updated. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date tags: - - Product Tag + - Product Type responses: '200': description: OK @@ -4745,8 +6063,17 @@ paths: application/json: schema: properties: - types: - $ref: '#/components/schemas/product_tag' + product_types: + $ref: '#/components/schemas/product_type' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/products/{id}/options': post: operationId: PostProductsProductOptions @@ -4757,7 +6084,7 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string requestBody: @@ -4795,8 +6122,6 @@ paths: schema: required: - title - - subtitle - - description properties: title: description: The title of the Product @@ -4813,11 +6138,13 @@ paths: Purchasing Products with this flag set to `true` will result in a Gift Card being created. type: boolean + default: false discountable: description: >- A flag to indicate if discounts can be applied to the LineItems generated from this Product type: boolean + default: true images: description: Images of the Product. type: array @@ -4829,33 +6156,61 @@ paths: handle: description: A unique handle to identify the Product by. type: string + status: + description: The status of the product. + type: string + enum: + - draft + - proposed + - published + - rejected + default: draft type: description: The Product Type to associate the Product with. type: object + required: + - value properties: + id: + description: The ID of the Product Type. + type: string value: description: The value of the Product Type. type: string collection_id: - description: The id of the Collection the Product should belong to. + description: The ID of the Collection the Product should belong to. type: string tags: description: Tags to associate the Product with. type: array items: + required: + - value properties: id: - description: The id of an existing Tag. + description: The ID of an existing Tag. type: string value: description: 'The value of the Tag, these will be upserted.' type: string + sales_channels: + description: '[EXPERIMENTAL] Sales channels to associate the Product with.' + type: array + items: + required: + - id + properties: + id: + description: The ID of an existing Sales channel. + type: string options: description: >- The Options that the Product should have. These define on which properties the Product's Product Variants will differ. type: array items: + required: + - title properties: title: description: The title to identify the Product Option by. @@ -4864,6 +6219,8 @@ paths: description: A list of Product Variants to create with the Product. type: array items: + required: + - title properties: title: description: The title to identify the Product Variant by. @@ -4886,6 +6243,7 @@ paths: inventory_quantity: description: The amount of stock kept for the Product Variant. type: integer + default: 0 allow_backorder: description: >- Whether the Product Variant can be purchased when out @@ -4898,16 +6256,16 @@ paths: type: boolean weight: description: The wieght of the Product Variant. - type: string + type: number length: description: The length of the Product Variant. - type: string + type: number height: description: The height of the Product Variant. - type: string + type: number width: description: The width of the Product Variant. - type: string + type: number origin_country: description: The country of origin of the Product Variant. type: string @@ -4927,28 +6285,43 @@ paths: prices: type: array items: + required: + - amount properties: region_id: description: >- - The id of the Region for which the price is - used. + The ID of the Region for which the price is + used. Only required if currency_code is not + provided. type: string currency_code: description: >- The 3 character ISO currency code for which the - price will be used. + price will be used. Only required if region_id + is not provided. type: string + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. amount: description: The amount to charge for the Product Variant. type: integer - sale_amount: + min_quantity: description: >- - The sale amount to charge for the Product - Variant. + The minimum quantity for which the price will be + used. + type: integer + max_quantity: + description: >- + The maximum quantity for which the price will be + used. type: integer options: type: array items: + required: + - value properties: value: description: >- @@ -4957,15 +6330,18 @@ paths: type: string weight: description: The wieght of the Product. - type: string + type: number length: description: The length of the Product. - type: string + type: number height: description: The height of the Product. - type: string + type: number width: description: The width of the Product. + type: number + hs_code: + description: The Harmonized System code for the Product Variant. type: string origin_country: description: The country of origin of the Product. @@ -5000,14 +6376,24 @@ paths: parameters: - in: query name: q - description: Query used for searching products. + description: >- + Query used for searching product title and description, variant + title and sku, and collection title. schema: type: string - in: query name: id - description: Id of the product to search for. + style: form + explode: false + description: Filter by product IDs. schema: - type: string + oneOf: + - type: string + description: ID of the product to search for. + - type: array + items: + type: string + description: ID of a product. - in: query name: status style: form @@ -5017,6 +6403,11 @@ paths: type: array items: type: string + enum: + - draft + - proposed + - published + - rejected - in: query name: collection_id style: form @@ -5030,72 +6421,132 @@ paths: name: tags style: form explode: false - description: Tags to search for + description: Tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: price_list_id + style: form + explode: false + description: Price List IDs to search for + schema: + type: array + items: + type: string + - in: query + name: sales_channel_id + style: form + explode: false + description: Sales Channel IDs to filter products by schema: type: array items: type: string - in: query name: title - description: to search for. + description: title to search for. schema: type: string - in: query name: description - description: to search for. + description: description to search for. schema: type: string - in: query name: handle - description: to search for. + description: handle to search for. schema: type: string - in: query name: is_giftcard description: Search for giftcards using is_giftcard=true. schema: - type: string + type: boolean - in: query name: type - description: to search for. + description: type ID to search for. schema: type: string - - in: query - name: order - description: to retrieve products in. - schema: - type: string - - in: query - name: deleted_at - description: >- - Date comparison for when resulting products was deleted, i.e. less - than, greater than etc. - schema: - type: object - in: query name: created_at - description: >- - Date comparison for when resulting products was created, i.e. less - than, greater than etc. + description: Date comparison for when resulting products were created. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: updated_at - description: >- - Date comparison for when resulting products was updated, i.e. less - than, greater than etc. + description: Date comparison for when resulting products were updated. schema: type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting products were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date - in: query name: offset description: How many products to skip in the result. schema: - type: string + type: integer + default: 0 - in: query name: limit description: Limit the number of products returned. schema: - type: string + type: integer + default: 50 - in: query name: expand description: >- @@ -5119,19 +6570,19 @@ paths: application/json: schema: properties: - count: - description: The number of Products. - type: integer - offset: - description: The offset of the Product query. - type: integer - limit: - description: The limit of the Product query. - type: integer products: type: array items: $ref: '#/components/schemas/product' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/products/{id}/variants': post: operationId: PostProductsProductVariants @@ -5144,7 +6595,7 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string requestBody: @@ -5177,6 +6628,7 @@ paths: inventory_quantity: description: The amount of stock kept for the Product Variant. type: integer + default: 0 allow_backorder: description: >- Whether the Product Variant can be purchased when out of @@ -5189,16 +6641,16 @@ paths: type: boolean weight: description: The wieght of the Product Variant. - type: string + type: number length: description: The length of the Product Variant. - type: string + type: number height: description: The height of the Product Variant. - type: string + type: number width: description: The width of the Product Variant. - type: string + type: number origin_country: description: The country of origin of the Product Variant. type: string @@ -5218,15 +6670,26 @@ paths: prices: type: array items: + required: + - amount properties: + id: + description: The ID of the price. + type: string region_id: - description: The id of the Region for which the price is used. + description: >- + The ID of the Region for which the price is used. Only + required if currency_code is not provided. type: string currency_code: description: >- The 3 character ISO currency code for which the price - will be used. + will be used. Only required if region_id is not + provided. type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. amount: description: The amount to charge for the Product Variant. type: integer @@ -5239,9 +6702,12 @@ paths: options: type: array items: + required: + - option_id + - value properties: option_id: - description: The id of the Product Option to set the value for. + description: The ID of the Product Option to set the value for. type: string value: description: The value to give for the Product Option. @@ -5266,7 +6732,7 @@ paths: - in: path name: id required: true - description: Id of the product to search for the variants. + description: ID of the product to search for the variants. schema: type: string - in: query @@ -5281,14 +6747,16 @@ paths: type: string - in: query name: offset - description: How many products to skip in the result. + description: How many items to skip before the results. schema: - type: string + type: integer + default: 0 - in: query name: limit - description: Limit the number of products returned. + description: Limit the number of items returned. schema: - type: string + type: integer + default: 100 tags: - Product responses: @@ -5302,6 +6770,15 @@ paths: type: array items: $ref: '#/components/schemas/product_variant' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/products/{id}/options/{option_id}': delete: operationId: DeleteProductsProductOptionsOption @@ -5316,13 +6793,13 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string - in: path name: option_id required: true - description: The id of the Product Option. + description: The ID of the Product Option. schema: type: string tags: @@ -5334,14 +6811,17 @@ paths: application/json: schema: properties: - id: + option_id: type: string - description: The id of the deleted Product Option + description: The ID of the deleted Product Option object: type: string description: The type of the object that was deleted. + default: option deleted: type: boolean + description: Whether or not the items were deleted. + default: true product: $ref: '#/components/schemas/product' post: @@ -5353,13 +6833,13 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string - in: path name: option_id required: true - description: The id of the Product Option. + description: The ID of the Product Option. schema: type: string requestBody: @@ -5393,7 +6873,7 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string tags: @@ -5407,12 +6887,15 @@ paths: properties: id: type: string - description: The id of the deleted Product. + description: The ID of the deleted Product. object: type: string description: The type of the object that was deleted. + default: product deleted: type: boolean + description: Whether or not the items were deleted. + default: true get: operationId: GetProductsProduct summary: Retrieve a Product @@ -5422,7 +6905,7 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string tags: @@ -5445,7 +6928,7 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string requestBody: @@ -5462,12 +6945,6 @@ paths: description: description: A description of the Product. type: string - is_giftcard: - description: >- - A flag to indicate if the Product represents a Gift Card. - Purchasing Products with this flag set to `true` will result - in a Gift Card being created. - type: boolean discountable: description: >- A flag to indicate if discounts can be applied to the @@ -5484,42 +6961,60 @@ paths: handle: description: A unique handle to identify the Product by. type: string + status: + description: The status of the product. + type: string + enum: + - draft + - proposed + - published + - rejected type: description: The Product Type to associate the Product with. type: object + required: + - value properties: + id: + description: The ID of the Product Type. + type: string value: description: The value of the Product Type. type: string collection_id: - description: The id of the Collection the Product should belong to. + description: The ID of the Collection the Product should belong to. type: string tags: description: Tags to associate the Product with. type: array items: + required: + - value properties: id: - description: The id of an existing Tag. + description: The ID of an existing Tag. type: string value: description: 'The value of the Tag, these will be upserted.' type: string - options: - description: >- - The Options that the Product should have. These define on - which properties the Product's Product Variants will differ. + sales_channels: + description: '[EXPERIMENTAL] Sales channels to associate the Product with.' type: array items: + required: + - id properties: - title: - description: The title to identify the Product Option by. + id: + description: The ID of an existing Sales channel. type: string variants: description: A list of Product Variants to create with the Product. type: array items: properties: + id: + description: The ID of the Product Variant. + type: string title: description: The title to identify the Product Variant by. type: string @@ -5553,16 +7048,16 @@ paths: type: boolean weight: description: The wieght of the Product Variant. - type: string + type: number length: description: The length of the Product Variant. - type: string + type: number height: description: The height of the Product Variant. - type: string + type: number width: description: The width of the Product Variant. - type: string + type: number origin_country: description: The country of origin of the Product Variant. type: string @@ -5582,29 +7077,51 @@ paths: prices: type: array items: + required: + - amount properties: + id: + description: The ID of the Price. + type: string region_id: description: >- - The id of the Region for which the price is - used. + The ID of the Region for which the price is + used. Only required if currency_code is not + provided. type: string currency_code: description: >- The 3 character ISO currency code for which the - price will be used. + price will be used. Only required if region_id + is not provided. type: string + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. amount: description: The amount to charge for the Product Variant. type: integer - sale_amount: + min_quantity: description: >- - The sale amount to charge for the Product - Variant. + The minimum quantity for which the price will be + used. + type: integer + max_quantity: + description: >- + The maximum quantity for which the price will be + used. type: integer options: type: array items: + required: + - option_id + - value properties: + option_id: + description: The ID of the Option. + type: string value: description: >- The value to give for the Product Option at the @@ -5612,16 +7129,16 @@ paths: type: string weight: description: The wieght of the Product. - type: string + type: number length: description: The length of the Product. - type: string + type: number height: description: The height of the Product. - type: string + type: number width: description: The width of the Product. - type: string + type: number origin_country: description: The country of origin of the Product. type: string @@ -5657,13 +7174,13 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string - in: path name: variant_id required: true - description: The id of the Product Variant. + description: The ID of the Product Variant. schema: type: string tags: @@ -5675,14 +7192,19 @@ paths: application/json: schema: properties: - id: + variant_id: type: string - description: The id of the deleted Product Variant. + description: The ID of the deleted Product Variant. object: type: string description: The type of the object that was deleted. + default: variant deleted: type: boolean + description: Whether or not the items were deleted. + default: true + product: + $ref: '#/components/schemas/product' post: operationId: PostProductsProductVariantsVariant summary: Update a Product Variant @@ -5692,13 +7214,13 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string - in: path name: variant_id required: true - description: The id of the Product Variant. + description: The ID of the Product Variant. schema: type: string requestBody: @@ -5739,16 +7261,16 @@ paths: type: boolean weight: description: The wieght of the Product Variant. - type: string + type: number length: description: The length of the Product Variant. - type: string + type: number height: description: The height of the Product Variant. - type: string + type: number width: description: The width of the Product Variant. - type: string + type: number origin_country: description: The country of origin of the Product Variant. type: string @@ -5768,18 +7290,26 @@ paths: prices: type: array items: + required: + - amount properties: id: - description: The id of the price. + description: The ID of the price. type: string region_id: - description: The id of the Region for which the price is used. + description: >- + The ID of the Region for which the price is used. Only + required if currency_code is not provided. type: string currency_code: description: >- The 3 character ISO currency code for which the price - will be used. + will be used. Only required if region_id is not + provided. type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. amount: description: The amount to charge for the Product Variant. type: integer @@ -5792,9 +7322,12 @@ paths: options: type: array items: + required: + - option_id + - value properties: option_id: - description: The id of the Product Option to set the value for. + description: The ID of the Product Option to set the value for. type: string value: description: The value to give for the Product Option. @@ -5810,6 +7343,34 @@ paths: properties: product: $ref: '#/components/schemas/product' + /products/tag-usage: + get: + operationId: GetProductsTagUsage + summary: List Product Tags Usage Number + description: Retrieves a list of Product Tags with how many times each is used. + x-authenticated: true + tags: + - Product Tag + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tags: + type: array + items: + properties: + id: + description: The ID of the tag. + type: string + usage_count: + description: The number of products that use this tag. + type: string + value: + description: The value of the tag. + type: string /products/types: get: operationId: GetProductsTypes @@ -5839,7 +7400,7 @@ paths: - in: path name: id required: true - description: The id of the Product. + description: The ID of the Product. schema: type: string requestBody: @@ -5877,7 +7438,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string requestBody: @@ -5890,6 +7451,10 @@ paths: country_code: description: The 2 character ISO code for the Country. type: string + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. tags: - Region responses: @@ -5911,7 +7476,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string requestBody: @@ -5922,7 +7487,7 @@ paths: - provider_id properties: provider_id: - description: The id of the Fulfillment Provider to add. + description: The ID of the Fulfillment Provider to add. type: string tags: - Region @@ -5945,7 +7510,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string requestBody: @@ -5956,7 +7521,7 @@ paths: - provider_id properties: provider_id: - description: The id of the Payment Provider to add. + description: The ID of the Payment Provider to add. type: string tags: - Region @@ -5983,6 +7548,9 @@ paths: - name - currency_code - tax_rate + - payment_providers + - fulfillment_providers + - countries properties: name: description: The name of the Region @@ -5990,6 +7558,9 @@ paths: currency_code: description: The 3 character ISO currency code to use for the Region. type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. tax_code: description: An optional tax code the Region. type: string @@ -5998,20 +7569,24 @@ paths: type: number payment_providers: description: >- - A list of Payment Providers that should be enabled for the - Region + A list of Payment Provider IDs that should be enabled for + the Region type: array items: type: string fulfillment_providers: description: >- - A list of Fulfillment Providers that should be enabled for - the Region + A list of Fulfillment Provider IDs that should be enabled + for the Region type: array items: type: string countries: - description: A list of countries that should be included in the Region. + description: >- + A list of countries' 2 ISO Characters that should be + included in the Region. + example: + - US type: array items: type: string @@ -6036,12 +7611,14 @@ paths: name: limit schema: type: integer + default: 50 required: false description: limit the number of regions in response - in: query name: offset schema: type: integer + default: 0 required: false description: Offset of regions in response (used for pagination) - in: query @@ -6081,36 +7658,15 @@ paths: type: array items: $ref: '#/components/schemas/region' - '/regions/{id}/metadata/{key}': - delete: - operationId: DeleteRegionsRegionMetadataKey - summary: Delete Metadata - description: Deletes a metadata key. - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - - in: path - name: key - required: true - description: The metadata key. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/regions/{id}': delete: operationId: DeleteRegionsRegion @@ -6121,7 +7677,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string tags: @@ -6135,12 +7691,15 @@ paths: properties: id: type: string - description: The id of the deleted Region. + description: The ID of the deleted Region. object: type: string description: The type of the object that was deleted. + default: region deleted: type: boolean + description: Whether or not the items were deleted. + default: true get: operationId: GetRegionsRegion summary: Retrieve a Region @@ -6150,7 +7709,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string tags: @@ -6173,7 +7732,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string requestBody: @@ -6187,6 +7746,9 @@ paths: currency_code: description: The 3 character ISO currency code to use for the Region. type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. automatic_taxes: description: >- If true Medusa will automatically calculate taxes for carts @@ -6200,7 +7762,7 @@ paths: type: boolean tax_provider_id: description: >- - The id of the tax provider to use; if null the system tax + The ID of the tax provider to use; if null the system tax provider is used type: string tax_code: @@ -6211,20 +7773,22 @@ paths: type: number payment_providers: description: >- - A list of Payment Providers that should be enabled for the - Region + A list of Payment Provider IDs that should be enabled for + the Region type: array items: type: string fulfillment_providers: description: >- - A list of Fulfillment Providers that should be enabled for - the Region + A list of Fulfillment Provider IDs that should be enabled + for the Region type: array items: type: string countries: - description: A list of countries that should be included in the Region. + description: >- + A list of countries' 2 ISO Characters that should be + included in the Region. type: array items: type: string @@ -6249,7 +7813,7 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string tags: @@ -6267,10 +7831,14 @@ paths: properties: provider_id: type: string - description: id of the fulfillment provider + description: ID of the fulfillment provider options: - type: object + type: array description: fulfillment provider options + example: + - id: manual-fulfillment + - id: manual-fulfillment-return + is_return: true '/regions/{id}/countries/{country_code}': delete: operationId: PostRegionsRegionCountriesCountry @@ -6281,15 +7849,18 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string - in: path name: country_code - required: true description: The 2 character ISO code for the Country. + required: true schema: type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. tags: - Region responses: @@ -6311,13 +7882,13 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string - in: path name: provider_id required: true - description: The id of the Fulfillment Provider. + description: The ID of the Fulfillment Provider. schema: type: string tags: @@ -6341,13 +7912,13 @@ paths: - in: path name: id required: true - description: The id of the Region. + description: The ID of the Region. schema: type: string - in: path name: provider_id required: true - description: The id of the Payment Provider. + description: The ID of the Payment Provider. schema: type: string tags: @@ -6361,45 +7932,6 @@ paths: properties: region: $ref: '#/components/schemas/region' - '/regions/{id}/metadata': - post: - operationId: PostRegionsRegionMetadata - summary: Set the metadata of a Region - description: Sets the metadata of a Region - x-authenticated: true - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - requestBody: - content: - application/json: - schema: - type: object - required: - - key - - value - properties: - key: - type: string - description: Key for the metadata value. - value: - type: string - description: The value that the key relates to. /return-reasons: post: operationId: PostReturnReasons @@ -6423,7 +7955,7 @@ paths: be unique. type: string parent_return_reason_id: - description: The id of the parent return reason. + description: The ID of the parent return reason. type: string description: description: An optional description to for the Reason. @@ -6472,7 +8004,7 @@ paths: - in: path name: id required: true - description: The id of the return reason + description: The ID of the return reason schema: type: string tags: @@ -6486,12 +8018,15 @@ paths: properties: id: type: string - description: The id of the deleted return reason + description: The ID of the deleted return reason object: type: string description: The type of the object that was deleted. + default: return_reason deleted: type: boolean + description: Whether or not the items were deleted. + default: true get: operationId: GetReturnReasonsReason summary: Retrieve a Return Reason @@ -6501,7 +8036,7 @@ paths: - in: path name: id required: true - description: The id of the Return Reason. + description: The ID of the Return Reason. schema: type: string tags: @@ -6524,7 +8059,7 @@ paths: - in: path name: id required: true - description: The id of the Return Reason. + description: The ID of the Return Reason. schema: type: string requestBody: @@ -6535,6 +8070,11 @@ paths: label: description: The label to display to the Customer. type: string + value: + description: >- + The value that the Return Reason will be identified by. Must + be unique. + type: string description: description: An optional description to for the Reason. type: string @@ -6563,7 +8103,7 @@ paths: - in: path name: id required: true - description: The id of the Return. + description: The ID of the Return. schema: type: string tags: @@ -6575,7 +8115,7 @@ paths: application/json: schema: properties: - return: + order: $ref: '#/components/schemas/order' /returns: get: @@ -6583,18 +8123,18 @@ paths: summary: List Returns description: Retrieves a list of Returns parameters: - - in: path + - in: query name: limit - required: true description: The upper limit for the amount of responses returned. schema: type: number - - in: path + default: '50' + - in: query name: offset - required: true description: The offset of the list returned. schema: type: number + default: '0' tags: - Return responses: @@ -6608,6 +8148,15 @@ paths: type: array items: $ref: '#/components/schemas/return' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/returns/{id}/receive': post: operationId: PostReturnsReturnReceive @@ -6619,7 +8168,7 @@ paths: - in: path name: id required: true - description: The id of the Return. + description: The ID of the Return. schema: type: string requestBody: @@ -6633,16 +8182,19 @@ paths: description: The Line Items that have been received. type: array items: + required: + - item_id + - quantity properties: item_id: - description: The id of the Line Item. + description: The ID of the Line Item. type: string quantity: description: The quantity of the Line Item. type: integer refund: description: The amount to refund. - type: integer + type: number tags: - Return responses: @@ -6654,6 +8206,360 @@ paths: properties: return: $ref: '#/components/schemas/return' + '/sales-channels/{id}/products/batch': + post: + operationId: PostSalesChannelsChannelProductsBatch + summary: Assign a batch of product to a sales channel + description: Assign a batch of product to a sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales channel. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to add to the Sales Channel + type: array + items: + type: object + required: + - id + properties: + id: + type: string + description: The ID of the product + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + delete: + operationId: DeleteSalesChannelsChannelProductsBatch + summary: Remove a list of products from a sales channel + description: Remove a list of products from a sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales Channel + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to delete from the Sales Channel. + type: array + items: + type: object + required: + - id + properties: + id: + description: The ID of a product + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + /sales-channels: + post: + operationId: PostSalesChannels + summary: Create a Sales Channel + description: Creates a Sales Channel. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - name + properties: + name: + description: The name of the Sales Channel + type: string + description: + description: The description of the Sales Channel + type: string + is_disabled: + description: Whether the Sales Channel is disabled or not. + type: boolean + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + get: + operationId: GetSalesChannels + summary: List sales channels + description: Retrieves a list of sales channels + x-authenticated: true + parameters: + - in: query + name: id + description: ID of the sales channel + schema: + type: string + - in: query + name: name + description: Name of the sales channel + schema: + type: string + - in: query + name: description + description: Description of the sales channel + schema: + type: string + - in: query + name: q + description: Query used for searching sales channels' names and descriptions. + schema: + type: string + - in: query + name: order + description: The field to order the results by. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting collections were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: offset + description: How many sales channels to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of sales channels returned. + schema: + type: integer + default: 20 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each sales + channel of the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each sales + channel of the result. + schema: + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channels: + type: array + items: + $ref: '#/components/schemas/sales_channel' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + '/sales-channels/{id}': + delete: + operationId: DeleteSalesChannelsSalesChannel + summary: Delete a sales channel + description: Deletes the sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales channel. + schema: + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted sales channel + object: + type: string + description: The type of the object that was deleted. + default: sales-channel + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + get: + operationId: GetSalesChannelsSalesChannel + summary: Retrieve a sales channel + description: Retrieves the sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales channel. + schema: + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' + post: + operationId: PostSalesChannelsSalesChannel + summary: Update a Sales Channel + description: Updates a Sales Channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales Channel. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + type: string + description: Name of the sales channel. + description: + type: string + description: Sales Channel description. + is_disabled: + type: boolean + description: Indication of if the sales channel is active. + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: '#/components/schemas/sales_channel' /shipping-options: post: operationId: PostShippingOptions @@ -6664,23 +8570,29 @@ paths: content: application/json: schema: + required: + - name + - region_id + - provider_id + - data + - price_type properties: name: description: The name of the Shipping Option type: string region_id: description: >- - The id of the Region in which the Shipping Option will be + The ID of the Region in which the Shipping Option will be available. type: string provider_id: description: >- - The id of the Fulfillment Provider that handles the Shipping + The ID of the Fulfillment Provider that handles the Shipping Option. type: string profile_id: description: >- - The id of the Shipping Profile to add the Shipping Option + The ID of the Shipping Profile to add the Shipping Option to. type: number data: @@ -6703,6 +8615,9 @@ paths: Option to be available. type: array items: + required: + - type + - amount properties: type: description: The type of the requirement @@ -6716,9 +8631,11 @@ paths: is_return: description: Whether the Shipping Option defines a return shipment. type: boolean + default: false admin_only: description: 'If true, the option can be used for draft orders' type: boolean + default: false metadata: description: >- An optional set of key-value pairs with additional @@ -6745,12 +8662,12 @@ paths: name: region_id schema: type: string - description: Region to fetch options from + description: Region ID to fetch options from - in: query name: is_return schema: type: boolean - description: Flag for fetching return options + description: Flag for fetching return options only - in: query name: admin_only schema: @@ -6769,6 +8686,9 @@ paths: type: array items: $ref: '#/components/schemas/shipping_option' + count: + type: integer + description: The total number of items available '/shipping-options/{id}': delete: operationId: DeleteShippingOptionsOption @@ -6779,7 +8699,7 @@ paths: - in: path name: id required: true - description: The id of the Shipping Option. + description: The ID of the Shipping Option. schema: type: string tags: @@ -6793,12 +8713,15 @@ paths: properties: id: type: string - description: The id of the deleted Shipping Option. + description: The ID of the deleted Shipping Option. object: type: string description: The type of the object that was deleted. + default: shipping-option deleted: type: boolean + description: Whether or not the items were deleted. + default: true get: operationId: GetShippingOptionsOption summary: Retrieve a Shipping Option @@ -6808,7 +8731,7 @@ paths: - in: path name: id required: true - description: The id of the Shipping Option. + description: The ID of the Shipping Option. schema: type: string tags: @@ -6831,13 +8754,15 @@ paths: - in: path name: id required: true - description: The id of the Shipping Option. + description: The ID of the Shipping Option. schema: type: string requestBody: content: application/json: schema: + required: + - requirements properties: name: description: The name of the Shipping Option @@ -6859,7 +8784,13 @@ paths: Option to be available. type: array items: + required: + - type + - amount properties: + id: + description: The ID of the requirement + type: string type: description: The type of the requirement type: string @@ -6935,7 +8866,7 @@ paths: - in: path name: id required: true - description: The id of the Shipping Profile. + description: The ID of the Shipping Profile. schema: type: string tags: @@ -6949,12 +8880,15 @@ paths: properties: id: type: string - description: The id of the deleted Shipping Profile. + description: The ID of the deleted Shipping Profile. object: type: string description: The type of the object that was deleted. + default: shipping_profile deleted: type: boolean + description: Whether or not the items were deleted. + default: true get: operationId: GetShippingProfilesProfile summary: Retrieve a Shipping Profile @@ -6964,7 +8898,7 @@ paths: - in: path name: id required: true - description: The id of the Shipping Profile. + description: The ID of the Shipping Profile. schema: type: string tags: @@ -6986,7 +8920,7 @@ paths: - in: path name: id required: true - description: The id of the Shipping Profile. + description: The ID of the Shipping Profile. schema: type: string requestBody: @@ -7006,7 +8940,7 @@ paths: application/json: schema: properties: - shipping_profiles: + shipping_profile: $ref: '#/components/schemas/shipping_profile' '/store/currencies/{code}': post: @@ -7021,6 +8955,9 @@ paths: description: The 3 character ISO currency code. schema: type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. tags: - Store responses: @@ -7044,6 +8981,9 @@ paths: description: The 3 character ISO currency code. schema: type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. tags: - Store responses: @@ -7103,6 +9043,19 @@ paths: default_currency_code: description: The default currency code for the Store. type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currencies: + description: Array of currencies in 2 character ISO code format. + type: array + items: + type: string + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object tags: - Store responses: @@ -7132,7 +9085,7 @@ paths: payment_providers: type: array items: - $ref: '#/components/schemas/store' + $ref: '#/components/schemas/payment_provider' /store/tax-providers: get: operationId: GetStoreTaxProviders @@ -7151,7 +9104,7 @@ paths: tax_providers: type: array items: - $ref: '#/components/schemas/store' + $ref: '#/components/schemas/tax_provider' '/swaps/{id}': get: operationId: GetSwapsSwap @@ -7162,7 +9115,7 @@ paths: - in: path name: id required: true - description: The id of the Swap. + description: The ID of the Swap. schema: type: string tags: @@ -7181,6 +9134,19 @@ paths: operationId: GetSwaps summary: List Swaps description: Retrieves a list of Swaps. + parameters: + - in: query + name: limit + description: The upper limit for the amount of responses returned. + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset of the list returned. + schema: + type: number + default: '0' x-authenticated: true tags: - Swap @@ -7195,14 +9161,56 @@ paths: type: array items: $ref: '#/components/schemas/swap' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/tax-rates/:id/product-types/batch': post: operationId: PostTaxRatesTaxRateProductTypes summary: Add Tax Rate to Product Types description: Associates a Tax Rate with a list of Product Types + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - product_types + properties: + product_types: + type: array + description: >- + The IDs of the types of products to associate with this tax + rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7211,16 +9219,47 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' delete: operationId: DeleteTaxRatesTaxRateProductTypes summary: Remove Tax Rate from Product Types description: Removes a Tax Rate from a list of Product Types + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - product_types + properties: + product_types: + type: array + description: >- + The IDs of the types of products to remove association with + this tax rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7229,17 +9268,46 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' '/tax-rates/:id/products/batch': post: operationId: PostTaxRatesTaxRateProducts summary: Add Tax Rate to Products description: Associates a Tax Rate with a list of Products + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - products + properties: + products: + type: array + description: The IDs of the products to associate with this tax rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7248,16 +9316,47 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' delete: operationId: DeleteTaxRatesTaxRateProducts summary: Removes Tax Rate from Products description: Removes a Tax Rate from a list of Products + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - products + properties: + products: + type: array + description: >- + The IDs of the products to remove association with this tax + rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7266,17 +9365,48 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' '/tax-rates/:id/shipping-options/batch': post: operationId: PostTaxRatesTaxRateShippingOptions summary: Add Tax Rate to Product Types - description: Associates a Tax Rate with a list of Product Types + description: Associates a Tax Rate with a list of Shipping Options + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - shipping_options + properties: + shipping_options: + type: array + description: >- + The IDs of the shipping options to associate with this tax + rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7285,16 +9415,47 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' delete: operationId: DeleteTaxRatesTaxRateShippingOptions summary: Removes a Tax Rate from Product Types description: Removes a Tax Rate from a list of Product Types + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - shipping_options + properties: + shipping_options: + type: array + description: >- + The IDs of the shipping options to remove association with + this tax rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7303,17 +9464,74 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' /tax-rates: post: operationId: PostTaxRates summary: Create a Tax Rate description: Creates a Tax Rate + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - code + - name + - region_id + properties: + code: + type: string + description: A code to identify the tax type by + name: + type: string + description: A human friendly name for the tax + region_id: + type: string + description: The ID of the Region that the rate belongs to + rate: + type: number + description: The numeric rate to charge + products: + type: array + description: The IDs of the products associated with this tax rate + items: + type: string + shipping_options: + type: array + description: >- + The IDs of the shipping options associated with this tax + rate + items: + type: string + product_types: + type: array + description: >- + The IDs of the types of products associated with this tax + rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7322,9 +9540,7 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' get: operationId: GetTaxRates summary: List Tax Rates @@ -7332,63 +9548,80 @@ paths: x-authenticated: true parameters: - in: query - name: q - description: Query used for searching orders. - schema: - type: string - - in: query - name: id - description: Id of the order to search for. + name: name + description: Name of tax rate to retrieve schema: type: string - in: query name: region_id - description: to search for. + style: form + explode: false + description: Filter by Region ID schema: - type: string + oneOf: + - type: string + - type: array + items: + type: string - in: query name: code - description: to search for. + description: code to search for. schema: type: string - in: query name: rate - description: to search for. + style: form + explode: false + description: Filter by Rate schema: - type: string - - in: query - name: created_at - description: >- - Date comparison for when resulting orders was created, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: updated_at - description: >- - Date comparison for when resulting orders was updated, i.e. less - than, greater than etc. - schema: - type: object + oneOf: + - type: number + - type: object + properties: + lt: + type: number + description: filter by rates less than this number + gt: + type: number + description: filter by rates greater than this number + lte: + type: number + description: filter by rates less than or equal to this number + gte: + type: number + description: filter by rates greater than or equal to this number - in: query name: offset - description: How many orders to skip in the result. + description: How many tax rates to skip before retrieving the result. schema: - type: string + type: integer + default: 0 - in: query name: limit - description: Limit the number of orders returned. + description: Limit the number of tax rates returned. schema: - type: string + type: integer + default: 50 - in: query name: fields - description: >- - (Comma separated) Which fields should be included in each order of - the result. + description: Which fields should be included in each item. + style: form + explode: false schema: - type: string + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved for each item. + style: form + explode: false + schema: + type: array + items: + type: string tags: - - Order + - Tax Rate responses: '200': description: OK @@ -7396,10 +9629,19 @@ paths: application/json: schema: properties: - orders: + tax_rates: type: array items: - $ref: '#/components/schemas/order' + $ref: '#/components/schemas/tax_rate' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/tax-rates/{id}': delete: operationId: DeleteTaxRatesTaxRate @@ -7410,11 +9652,11 @@ paths: - in: path name: id required: true - description: The id of the Shipping Option. + description: The ID of the Shipping Option. schema: type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7424,20 +9666,42 @@ paths: properties: id: type: string - description: The id of the deleted Shipping Option. + description: The ID of the deleted Shipping Option. object: type: string description: The type of the object that was deleted. + default: tax-rate deleted: type: boolean + description: Whether or not the items were deleted. + default: true '/tax-rates/:id': get: operationId: GetTaxRatesTaxRate summary: Get Tax Rate description: Retrieves a TaxRate + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7446,16 +9710,69 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' + $ref: '#/components/schemas/tax_rate' post: operationId: PostTaxRatesTaxRate summary: Update a Tax Rate description: Updates a Tax Rate + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + code: + type: string + description: A code to identify the tax type by + name: + type: string + description: A human friendly name for the tax + region_id: + type: string + description: The ID of the Region that the rate belongs to + rate: + type: number + description: The numeric rate to charge + products: + type: array + description: The IDs of the products associated with this tax rate + items: + type: string + shipping_options: + type: array + description: >- + The IDs of the shipping options associated with this tax + rate + items: + type: string + product_types: + type: array + description: >- + The IDs of the types of products associated with this tax + rate + items: + type: string tags: - - Tax Rates + - Tax Rate responses: '200': description: OK @@ -7464,19 +9781,15 @@ paths: schema: properties: tax_rate: - type: array - items: - $ref: '#/components/schemas/tax_rate' - /: + $ref: '#/components/schemas/tax_rate' + /uploads: post: operationId: PostUploads - summary: Uploads an array of files - description: >- - Uploads an array of files to the specific fileservice that is installed - in medusa. + summary: Uploads a file + description: Uploads a file to the specific fileservice that is installed in Medusa. x-authenticated: true tags: - - Uploads + - Upload requestBody: content: multipart/form-data: @@ -7484,10 +9797,8 @@ paths: type: object properties: files: - type: array - items: - type: string - format: binary + type: string + format: binary responses: '200': description: OK @@ -7498,7 +9809,12 @@ paths: uploads: type: array items: - type: string + type: object + properties: + url: + type: string + description: The URL of the uploaded file. + format: uri /users: post: operationId: PostUsers @@ -7516,6 +9832,7 @@ paths: email: description: The Users email. type: string + format: email first_name: description: The name of the User. type: string @@ -7525,11 +9842,16 @@ paths: role: description: Userrole assigned to the user. type: string + enum: + - admin + - member + - developer password: description: The Users password. type: string + format: password tags: - - Users + - User responses: '200': description: OK @@ -7545,7 +9867,7 @@ paths: description: Retrieves all users. x-authenticated: true tags: - - Users + - User responses: '200': description: OK @@ -7557,7 +9879,7 @@ paths: type: array items: $ref: '#/components/schemas/user' - '/users/{user_id}': + '/users/{id}': delete: operationId: DeleteUsersUser summary: Delete a User @@ -7565,9 +9887,9 @@ paths: x-authenticated: true parameters: - in: path - name: user_id + name: id required: true - description: The id of the User. + description: The ID of the User. schema: type: string tags: @@ -7581,59 +9903,15 @@ paths: properties: id: type: string - description: The id of the deleted Shipping Profile. + description: The ID of the deleted user. object: type: string description: The type of the object that was deleted. + default: user deleted: type: boolean - post: - operationId: PostUsersUser - summary: Update a User - description: Updates a User - x-authenticated: true - parameters: - - in: path - name: user_id - required: true - description: The id of the User. - schema: - type: string - tags: - - Users - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - user: - $ref: '#/components/schemas/user' - requestBody: - content: - application/json: - schema: - type: object - required: - - first_name - - last_name - - role - - api_token - properties: - first_name: - type: string - description: The name of the User. - last_name: - type: string - description: The name of the User. - role: - type: string - description: 'The role of the User(admin, member, developer).' - api_token: - type: string - description: The api_token of the User. - '/users/{id}': + description: Whether or not the items were deleted. + default: true get: operationId: GetUsersUser summary: Retrieve a User @@ -7643,11 +9921,60 @@ paths: - in: path name: id required: true - description: The id of the User. + description: The ID of the User. schema: type: string tags: - - Users + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: '#/components/schemas/user' + post: + operationId: PostUsersUser + summary: Update a User + description: Updates a User + parameters: + - in: path + name: id + required: true + description: The ID of the User. + schema: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + first_name: + description: The name of the User. + type: string + last_name: + description: The name of the User. + type: string + role: + description: Userrole assigned to the user. + type: string + enum: + - admin + - member + - developer + api_token: + description: The api token of the User. + type: string + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object + tags: + - User responses: '200': description: OK @@ -7658,6 +9985,28 @@ paths: user: $ref: '#/components/schemas/user' /users/password-token: + post: + operationId: PostUsersUserPasswordToken + summary: Generate a password token for a User. + description: Generates a password token for a User with a given email. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + properties: + email: + description: The Users email. + type: string + format: email + tags: + - User + responses: + '204': + description: OK + /users/reset-password: post: operationId: PostUsersUserPassword summary: Set the password for a User. @@ -7668,21 +10017,22 @@ paths: application/json: schema: required: - - email - token - password properties: email: description: The Users email. type: string + format: email token: description: The token generated from the 'password-token' endpoint. type: string password: description: The Users new password. type: string + format: password tags: - - Users + - User responses: '200': description: OK @@ -7708,12 +10058,14 @@ paths: name: offset description: How many variants to skip in the result. schema: - type: string + type: integer + default: 0 - in: query name: limit description: Limit the number of variants returned. schema: - type: string + type: integer + default: 20 tags: - Product Variant responses: @@ -7727,6 +10079,15 @@ paths: type: array items: $ref: '#/components/schemas/product_variant' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page components: schemas: address: @@ -7736,90 +10097,223 @@ components: properties: id: type: string + description: ID of the address + example: addr_01G8ZC9VS1XVE149MGH2J7QSSH customer_id: type: string + description: ID of the customer this address belongs to + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: Available if the relation `customer` is expanded. + type: array + items: + type: object + description: A customer object. company: type: string + description: Company name + example: Acme first_name: type: string + description: First name + example: Arno last_name: type: string + description: Last name + example: Willms address_1: type: string + description: Address line 1 + example: 14433 Kemmer Court address_2: type: string + description: Address line 2 + example: Suite 369 city: type: string + description: City + example: South Geoffreyview country_code: type: string + description: The 2 character ISO code of the country in lower case + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + example: st country: - $ref: '#/components/schemas/country' + description: A country object. Available if the relation `country` is expanded. + type: object + province: + type: string + description: Province + example: Kentucky + postal_code: + type: string + description: Postal Code + example: 72093 + phone: + type: string + description: Phone Number + example: 16128234334802 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white batch_job: title: Batch Job description: A Batch Job. x-resourceId: batch_job + required: + - type properties: id: + type: string description: The unique identifier for the batch job. - type: string + example: batch_01G8T782965PYFG0751G0Z38B4 type: + type: string description: The type of batch job. - type: string enum: - - product_import - - product_export + - product-import + - product-export status: - description: The status of the batch job. type: string + description: The status of the batch job. enum: - created - pre_processed + - confirmed - processing - completed - canceled - failed + default: created created_by: - description: The unique identifier of the user that created the batch job. type: string + description: The unique identifier of the user that created the batch job. + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + created_by_user: + description: >- + A user object. Available if the relation `created_by_user` is + expanded. + type: object context: + type: object description: >- The context of the batch job, the type of the batch job determines what the context should contain. - type: object + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images dry_run: - description: Specify if the job must apply the modifications or not. type: boolean + description: Specify if the job must apply the modifications or not. default: false result: - description: The result of the batch job. type: object + description: The result of the batch job. + properties: + count: + type: number + advancement_count: + type: number + progress: + type: number + errors: + type: object + properties: + message: + type: string + code: + oneOf: + - type: string + - type: number + err: + type: array + stat_descriptors: + type: object + properties: + key: + type: string + name: + type: string + message: + type: string + file_key: + type: string + file_size: + type: number + example: + errors: + - err: [] + code: unknown + message: Method not implemented. + stat_descriptors: + - key: product-export-count + name: Product count to export + message: There will be 8 products exported by this action pre_processed_at: - description: The date from which the job has been pre processed. type: string + description: The date from which the job has been pre processed. + format: date-time + processing_at: + type: string + description: The date the job is processing at. format: date-time confirmed_at: - description: The date when the confirmation has been done. type: string + description: The date when the confirmation has been done. format: date-time completed_at: - description: The date of the completion. type: string + description: The date of the completion. format: date-time canceled_at: - description: The date of the concellation. type: string + description: The date of the concellation. + format: date-time + failed_at: + type: string + description: The date when the job failed. format: date-time created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was last updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time cart: title: Cart @@ -7828,127 +10322,261 @@ components: properties: id: type: string + description: The cart's ID + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 email: type: string + description: The email associated with the cart + format: email billing_address_id: type: string + description: The billing address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW billing_address: + description: Available if the relation `billing_address` is expanded. $ref: '#/components/schemas/address' shipping_address_id: type: string + description: The shipping address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW shipping_address: + description: Available if the relation `shipping_address` is expanded. $ref: '#/components/schemas/address' items: + description: Available if the relation `items` is expanded. type: array items: $ref: '#/components/schemas/line_item' region_id: type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object discounts: type: array + description: Available if the relation `discounts` is expanded. items: - $ref: '#/components/schemas/region' + type: object + description: A discount object. gift_cards: type: array + description: Available if the relation `gift_cards` is expanded. items: - $ref: '#/components/schemas/gift_card' + type: object + description: A gift card object. customer_id: type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 customer: - $ref: '#/components/schemas/customer' + description: A customer object. Available if the relation `customer` is expanded. + type: object payment_session: + description: The selected payment session in the cart. $ref: '#/components/schemas/payment_session' payment_sessions: type: array + description: The payment sessions created on the cart. items: $ref: '#/components/schemas/payment_session' + payment_id: + type: string + description: The payment's ID if available + example: pay_01G8ZCC5W42ZNY842124G7P5R9 payment: + description: Available if the relation `payment` is expanded. $ref: '#/components/schemas/payment' shipping_methods: type: array + description: The shipping methods added to the cart. items: $ref: '#/components/schemas/shipping_method' type: type: string + description: The cart's type. enum: - default - swap + - draft_order - payment_link + - claim + default: default completed_at: type: string + description: The date with timezone at which the cart was completed. format: date-time + payment_authorized_at: + type: string + description: The date with timezone at which the payment was authorized. + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + context: + type: object + description: >- + The context of the cart which can include info like IP or user + agent. + example: + ip: '::1' + user_agent: PostmanRuntime/7.29.2 + sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white shipping_total: type: integer + description: The total of shipping + example: 1000 discount_total: type: integer + description: The total of discount + example: 800 tax_total: type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: >- + The total amount refunded if the order associated with this cart is + returned. + example: 0 + total: + type: integer + description: The total amount of the cart + example: 8200 subtotal: type: integer + description: The subtotal of the cart + example: 8000 refundable_amount: type: integer + description: The amount that can be refunded + example: 8200 gift_card_total: type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 claim_image: title: Claim Image description: Represents photo documentation of a claim. x-resourceId: claim_image + required: + - claim_item_id + - url properties: id: type: string + description: The claim image's ID + example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 claim_item_id: type: string + description: The ID of the claim item associated with the image + claim_item: + description: >- + A claim item object. Available if the relation `claim_item` is + expanded. + type: object url: type: string + description: The URL of the image + format: uri created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white claim_item: title: Claim Item description: >- Represents a claimed item along with information about the reasons for the claim. x-resourceId: claim_item + required: + - claim_order_id + - item_id + - variant_id + - reason + - quantity properties: id: type: string + description: The claim item's ID + example: citm_01G8ZH853Y6TFXWPG5EYE81X63 images: type: array + description: Available if the relation `images` is expanded. items: $ref: '#/components/schemas/claim_image' claim_order_id: + description: The ID of the claim this item is associated with. type: string + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object item_id: + description: The ID of the line item that the claim item refers to. type: string + example: item_01G8ZM25TN49YV9EQBE2NC27KC item: - description: The Line Item that the claim refers to + description: Available if the relation `item` is expanded. $ref: '#/components/schemas/line_item' variant_id: + description: The ID of the product variant that is claimed. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 variant: - description: The Product Variant that is claimed. - $ref: '#/components/schemas/product_variant' + description: A variant object. Available if the relation `variant` is expanded. + type: object reason: description: The reason for the claim type: string @@ -7960,27 +10588,37 @@ components: note: description: 'An optional note about the claim, for additional information' type: string + example: I don't like it. quantity: description: >- The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order. type: integer + example: 1 tags: - description: User defined tags for easy filtering and grouping. + description: >- + User defined tags for easy filtering and grouping. Available if the + relation 'tags' is expanded. type: array items: $ref: '#/components/schemas/claim_tag' created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white claim_order: title: Claim Order description: >- @@ -7988,9 +10626,14 @@ components: order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns. x-resourceId: claim_order + required: + - type + - order_id properties: id: type: string + description: The claim's ID + example: claim_01G8ZH853Y6TFXWPG5EYE81X63 type: type: string enum: @@ -7998,10 +10641,12 @@ components: - replace payment_status: type: string + description: The status of the claim's payment enum: - na - not_refunded - refunded + default: na fulfillment_status: type: string enum: @@ -8014,6 +10659,7 @@ components: - returned - canceled - requires_action + default: not_fulfilled claim_items: description: The items that have been claimed type: array @@ -8027,16 +10673,23 @@ components: items: $ref: '#/components/schemas/line_item' order_id: - description: The id of the order that the claim comes from. + description: The ID of the order that the claim comes from. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object return_order: - description: Holds information about the return if the claim is to be returned - $ref: '#/components/schemas/return' + description: >- + A return object. Holds information about the return if the claim is + to be returned. Available if the relation 'return_order' is expanded + type: object shipping_address_id: - description: The id of the address that the new items should be shipped to + description: The ID of the address that the new items should be shipped to type: string + example: addr_01G8ZH853YPY9B94857DY91YGW shipping_address: - description: The address that the new items should be shipped to + description: Available if the relation `shipping_address` is expanded. $ref: '#/components/schemas/address' shipping_methods: description: The shipping methods that the claim order will be shipped with. @@ -8051,94 +10704,160 @@ components: refund_amount: description: The amount that will be refunded in conjunction with the claim type: integer + example: 1000 canceled_at: - description: The date with timezone at which the Swap was canceled. + description: The date with timezone at which the claim was canceled. type: string format: date-time created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white no_notification: description: >- Flag for describing whether or not notifications related to this should be send. type: boolean - metadata: - type: object + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the claim in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. claim_tag: title: Claim Tag description: >- Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping. x-resourceId: claim_tag + required: + - value properties: id: - description: The id of the claim tag. Will be prefixed by `ctag_`. type: string + description: The claim tag's ID + example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 value: description: The value that the claim tag holds type: string + example: Damaged created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white country: title: Country description: Country details x-resourceId: country + required: + - iso_2 + - iso_3 + - num_code + - name + - display_name properties: id: - description: The database id of the country - type: integer + type: string + description: The country's ID + example: 109 iso_2: - description: The 2 character ISO code for the country. type: string + description: The 2 character ISO code of the country in lower case + example: it + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. iso_3: - description: The 3 character ISO code for the country. type: string + description: The 2 character ISO code of the country in lower case + example: ita + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements + description: See a list of codes. num_code: description: The numerical ISO code for the country. type: string + example: 380 + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements + description: See a list of codes. name: - description: The normalized country name; in upper case. + description: The normalized country name in upper case. type: string + example: ITALY display_name: description: The country name appropriate for display. type: string + example: Italy + region_id: + type: string + description: The region ID this country is associated with. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object currency: title: Currency description: Currency x-resourceId: currency + required: + - code + - symbol + - symbol_native + - name properties: code: description: The 3 character ISO code for the currency. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. symbol: description: The symbol used to indicate the currency. type: string + example: $ symbol_native: description: The native symbol used to indicate the currency. type: string + example: $ name: description: The written name of the currency type: string + example: US Dollar custom_shipping_option: title: Custom Shipping Option description: >- @@ -8146,242 +10865,363 @@ components: can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option x-resourceId: custom_shipping_option + required: + - price + - shipping_option_id properties: id: - description: >- - The id of the Custom Shipping Option. This value will be prefixed - with `cso_`. type: string + description: The custom shipping option's ID + example: cso_01G8X99XNB77DMFBJFWX6DN9V9 price: description: >- The custom price set that will override the shipping option's original price type: integer + example: 1000 shipping_option_id: description: >- - The id of the Shipping Option that the custom shipping option + The ID of the Shipping Option that the custom shipping option overrides - anyOf: - - $ref: '#/components/schemas/shipping_option' - cart_id: - description: The id of the Cart that the custom shipping option is attached to - anyOf: - - $ref: '#/components/schemas/cart' - created_at: - description: The date with timezone at which the resource was created. type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: >- + A shipping option object. Available if the relation + `shipping_option` is expanded. + type: object + cart_id: + description: The ID of the Cart that the custom shipping option is attached to + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white customer_group: title: Customer Group description: Represents a customer group x-resourceId: customer_group + required: + - name properties: id: type: string + description: The customer group's ID + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 name: type: string + description: The name of the customer group + example: VIP customers: type: array + description: >- + The customers that belong to the customer group. Available if the + relation `customers` is expanded. items: - $ref: '#/components/schemas/customer' + type: object + description: A customer object. + price_lists: + type: array + description: >- + The price lists that are associated with the customer group. + Available if the relation `price_lists` is expanded. + items: + $ref: '#/components/schemas/price_list' created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white customer: title: Customer description: Represents a customer x-resourceId: customer + required: + - email properties: id: type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 email: type: string + description: The customer's email + format: email + first_name: + type: string + description: The customer's first name + example: Arno + last_name: + type: string + description: The customer's first name + example: Willms billing_address_id: type: string + description: The customer's billing address ID + example: addr_01G8ZH853YPY9B94857DY91YGW billing_address: - description: The Customer's billing address. - anyOf: - - $ref: '#/components/schemas/address' + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' shipping_addresses: + description: Available if the relation `shipping_addresses` is expanded. type: array items: $ref: '#/components/schemas/address' - first_name: - type: string - last_name: - type: string phone: type: string + description: The customer's phone number + example: 16128234334802 has_account: type: boolean + description: Whether the customer has an account or not + default: false + orders: + description: Available if the relation `orders` is expanded. + type: array + items: + type: object + description: An order object. + groups: + description: >- + The customer groups the customer belongs to. Available if the + relation `groups` is expanded. + type: array + items: + $ref: '#/components/schemas/customer_group' created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_customer_group: title: Product Tag Discount Condition description: Associates a discount condition with a customer group x-resourceId: discount_condition_customer_group + required: + - customer_group_id + - condition_id properties: customer_group_id: - description: The id of the Product Tag + description: The ID of the Product Tag type: string + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + customer_group: + description: Available if the relation `customer_group` is expanded. + $ref: '#/components/schemas/customer_group' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product_collection: title: Product Collection Discount Condition description: Associates a discount condition with a product collection x-resourceId: discount_condition_product_collection + required: + - product_collection_id + - condition_id properties: product_collection_id: - description: The id of the Product Collection + description: The ID of the Product Collection type: string + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_collection: + description: Available if the relation `product_collection` is expanded. + $ref: '#/components/schemas/product_collection' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product_tag: title: Product Tag Discount Condition description: Associates a discount condition with a product tag x-resourceId: discount_condition_product_tag + required: + - product_tag_id + - condition_id properties: product_tag_id: - description: The id of the Product Tag + description: The ID of the Product Tag type: string + example: ptag_01F0YESHPZYY3H4SJ3A5918SBN condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_tag: + description: Available if the relation `product_tag` is expanded. + $ref: '#/components/schemas/product_tag' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product_type: title: Product Type Discount Condition description: Associates a discount condition with a product type x-resourceId: discount_condition_product + required: + - product_type_id + - condition_id properties: product_type_id: - description: The id of the Product Type + description: The ID of the Product Tag type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: '#/components/schemas/product_type' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product: title: Product Discount Condition description: Associates a discount condition with a product x-resourceId: discount_condition_product + required: + - product_id + - condition_id properties: product_id: - description: The id of the Product + description: The ID of the Product Tag type: string + example: prod_01G1G5V2MBA328390B5AXJ610F condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product: + description: Available if the relation `product` is expanded. + $ref: '#/components/schemas/product' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition: title: Discount Condition description: Holds rule conditions for when a discount is applicable x-resourceId: discount_condition + required: + - type + - operator + - discount_rule_id properties: id: - description: The id of the Discount Condition. Will be prefixed by `discon_`. type: string + description: The discount condition's ID + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A type: description: The type of the Condition type: string @@ -8391,31 +11231,93 @@ components: - product_collections - product_tags - customer_groups + operator: + description: The operator of the Condition + type: string + enum: + - in + - not_in + discount_rule_id: + type: string + description: The ID of the discount rule associated with the condition + example: dru_01F0YESMVK96HVX7N419E3CJ7C + discount_rule: + description: Available if the relation `discount_rule` is expanded. + $ref: '#/components/schemas/discount_rule' + products: + description: >- + products associated with this condition if type = products. + Available if the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + product_types: + description: >- + product types associated with this condition if type = + product_types. Available if the relation `product_types` is + expanded. + type: array + items: + type: object + description: A product type object. + product_tags: + description: >- + product tags associated with this condition if type = product_tags. + Available if the relation `product_tags` is expanded. + type: array + items: + type: object + description: A product tag object. + product_collections: + description: >- + product collections associated with this condition if type = + product_collections. Available if the relation `product_collections` + is expanded. + type: array + items: + type: object + description: A product collection object. + customer_groups: + description: >- + customer groups associated with this condition if type = + customer_groups. Available if the relation `customer_groups` is + expanded. + type: array + items: + type: object + description: A customer group object. created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_rule: title: Discount Rule description: >- Holds the rules that governs how a Discount is calculated when applied to a Cart. x-resourceId: discount_rule + required: + - type + - value properties: id: - description: The id of the Discount Rule. Will be prefixed by `dru_`. type: string + description: The discount rule's ID + example: dru_01F0YESMVK96HVX7N419E3CJ7C type: description: >- The type of the Discount, can be `fixed` for discounts that reduce @@ -8426,76 +11328,97 @@ components: - fixed - percentage - free_shipping + example: percentage description: description: A short description of the discount type: string + example: 10 Percent value: description: >- The value that the discount represents; this will depend on the type of the discount type: integer + example: 10 allocation: description: The scope that the discount should apply to. type: string enum: - total - item + example: total conditions: description: >- A set of conditions that can be used to limit when the discount can - be used + be used. Available if the relation `conditions` is expanded. type: array items: - $ref: '#/components/schemas/discount_condition' + type: object + description: A discount condition object. created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount: title: Discount description: >- Represents a discount that can be applied to a cart for promotional purposes. x-resourceId: discount + required: + - code + - is_dynamic properties: id: - description: The id of the Discount. Will be prefixed by `disc_`. type: string + description: The discount's ID + example: disc_01F0YESMW10MGHWJKZSDDMN0VN code: description: >- A unique code for the discount - this will be used by the customer to apply the discount type: string + example: 10DISC is_dynamic: description: >- A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts type: boolean - rule: + example: false + rule_id: + type: string description: The Discount Rule that governs the behaviour of the Discount - anyOf: - - $ref: '#/components/schemas/discount_rule' + example: dru_01F0YESMVK96HVX7N419E3CJ7C + rule: + description: Available if the relation `rule` is expanded. + $ref: '#/components/schemas/discount_rule' is_disabled: description: >- Whether the Discount has been disabled. Disabled discounts cannot be applied to carts type: boolean + example: false parent_discount_id: + type: string description: >- The Discount that the discount was created from. This will always be a dynamic discount - type: string + example: disc_01G8ZH853YPY9B94857DY91YGW + parent_discount: + description: Available if the relation `parent_discount` is expanded. + $ref: '#/components/schemas/discount' starts_at: description: The time at which the discount can be used. type: string @@ -8504,32 +11427,44 @@ components: description: The time at which the discount can no longer be used. type: string format: date-time + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S regions: - description: The Regions in which the Discount can be used + description: >- + The Regions in which the Discount can be used. Available if the + relation `regions` is expanded. type: array items: - $ref: '#/components/schemas/region' + type: object + description: A region object. usage_limit: description: The maximum number of times that a discount can be used. type: integer + example: 100 usage_count: description: The number of times a discount has been used. type: integer + example: 50 + default: 0 created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white draft-order: title: DraftOrder description: Represents a draft order @@ -8537,64 +11472,102 @@ components: properties: id: type: string + description: The draft order's ID + example: dorder_01G8TJFKBG38YYFQ035MSVG03C status: type: string + description: The status of the draft order enum: - open - completed + default: open display_id: type: string + description: The draft order's display ID + example: 2 cart_id: type: string + description: The ID of the cart associated with the draft order. + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 cart: - anyOf: - - $ref: '#/components/schemas/cart' + description: A cart object. Available if the relation `cart` is expanded. + type: object order_id: type: string + description: The ID of the order associated with the draft order. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK order: - anyOf: - - $ref: '#/components/schemas/order' + description: An order object. Available if the relation `order` is expanded. + type: object canceled_at: type: string - format: date-time - created_at: - type: string - format: date-time - update_at: - type: string - format: date-time - deleted_at: - type: string + description: The date the draft order was canceled at. format: date-time completed_at: type: string + description: The date the draft order was completed at. format: date-time no_notification_order: type: boolean - metadata: - type: object + description: Whether to send the customer notifications regarding order updates. + example: false idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the draft order in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white fulfillment_item: title: Fulfillment Item description: >- Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item. x-resourceId: fulfillment_item + required: + - fulfillment_id + - item_id + - quantity properties: fulfillment_id: description: The id of the Fulfillment that the Fulfillment Item belongs to. type: string + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF item_id: description: The id of the Line Item that the Fulfillment Item references. type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + fulfillment: + description: >- + A fulfillment object. Available if the relation `fulfillment` is + expanded. + type: object item: - description: The Line Item that the Fulfillment Item references. - anyOf: - - $ref: '#/components/schemas/line_item' + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' quantity: description: The quantity of the Line Item that is included in the Fulfillment. type: integer + example: 1 fulfillment_provider: title: Fulfillment Provider description: >- @@ -8605,12 +11578,14 @@ components: id: description: The id of the fulfillment provider as given by the plugin. type: string + example: manual is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + example: true fulfillment: title: Fulfillment description: >- @@ -8622,28 +11597,50 @@ components: these providers through webhooks in order to automatically update and synchronize the state of Fulfillments. x-resourceId: fulfillment + required: + - provider_id properties: id: - description: The id of the Fulfillment. This value will be prefixed by `ful_`. type: string + description: The cart's ID + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF claim_order_id: description: The id of the Claim that the Fulfillment belongs to. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object swap_id: description: The id of the Swap that the Fulfillment belongs to. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object order_id: description: The id of the Order that the Fulfillment belongs to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object provider_id: description: >- The id of the Fulfillment Provider responsible for handling the fulfillment type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/fulfillment_provider' items: description: >- The Fulfillment Items in the Fulfillment - these hold information - about how many of each Line Item has been fulfilled. + about how many of each Line Item has been fulfilled. Available if + the relation `items` is expanded. type: array items: $ref: '#/components/schemas/fulfillment_item' @@ -8651,7 +11648,7 @@ components: description: >- The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment - Provider. + Provider. Available if the relation `tracking_links` is expanded. type: array items: $ref: '#/components/schemas/tracking_link' @@ -8663,6 +11660,12 @@ components: type: array items: type: string + data: + description: >- + This contains all the data necessary for the Fulfillment provider to + handle the fulfillment. + type: object + example: {} shipped_at: description: The date with timezone at which the Fulfillment was shipped. type: string @@ -8672,164 +11675,378 @@ components: Flag for describing whether or not notifications related to this should be send. type: boolean + example: false canceled_at: description: The date with timezone at which the Fulfillment was canceled. type: string format: date-time - created_at: - description: The date with timezone at which the resource was created. + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of the + fulfillment in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white gift_card_transaction: title: Gift Card Transaction description: >- Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order x-resourceId: gift_card_transaction + required: + - gift_card_id + - amount properties: id: - description: >- - The id of the Gift Card Transaction. This value will be prefixed by - `gct_`. type: string + description: The gift card transaction's ID + example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A gift_card_id: - description: The id of the Gift Card that was used in the transaction. + description: The ID of the Gift Card that was used in the transaction. type: string + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ gift_card: - description: The Gift Card that was used in the transaction. - anyOf: - - $ref: '#/components/schemas/gift_card' + description: >- + A gift card object. Available if the relation `gift_card` is + expanded. + type: object order_id: - description: The id of the Order that the Gift Card was used to pay for. + description: The ID of the Order that the Gift Card was used to pay for. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object amount: description: The amount that was used from the Gift Card. type: integer + example: 10 created_at: description: The date with timezone at which the resource was created. type: string format: date-time + is_taxable: + description: Whether the transaction is taxable or not. + type: boolean + example: false + tax_rate: + description: The tax rate of the transaction + type: number + example: 0 gift_card: title: Gift Card description: >- Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. x-resourceId: gift_card + required: + - code + - value + - balance + - region_id properties: id: - description: The id of the Gift Card. This value will be prefixed by `gift_`. type: string + description: The cart's ID + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ code: description: >- The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card. type: string + example: 3RFT-MH2C-Y4YZ-XMN4 value: description: The value that the Gift Card represents. type: integer + example: 10 balance: description: The remaining value on the Gift Card. type: integer + example: 10 region_id: + type: string description: The id of the Region in which the Gift Card is available. - type: string + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - description: The Region in which the Gift Card is available. - anyOf: - - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object order_id: - description: The id of the Order that the Gift Card was purchased in. type: string + description: The id of the Order that the Gift Card was purchased in. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object is_disabled: description: >- Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts. type: boolean + example: false ends_at: description: The time at which the Gift Card can no longer be used. type: string format: date-time created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white + idempotency_key: + title: Idempotency Key + description: >- + Idempotency Key is used to continue a process in case of any failure + that might occur. + x-resourceId: idempotency_key + required: + - idempotency_key + properties: + id: + type: string + description: The idempotency key's ID + example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A + idempotency_key: + description: >- + The unique randomly generated key used to determine the state of a + process. + type: string + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + locked_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + request_method: + description: The method of the request + type: string + example: POST + request_params: + type: object + description: The parameters passed to the request + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + request_path: + description: The request's path + type: string + example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + response_code: + type: string + description: The response's code. + example: 200 + response_body: + type: object + description: The response's body + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + recovery_point: + type: string + description: Where to continue from. + default: started image: title: Image description: Images holds a reference to a URL at which the image file can be found. x-resourceId: image + required: + - url properties: id: - description: The id of the Image. This value will be prefixed by `img_`. type: string + description: The image's ID + example: img_01G749BFYR6T8JTVW6SGW3K3E6 url: description: The URL at which the image file can be found. type: string + format: uri created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white invite: title: Invite description: Represents an invite x-resourceId: invite + required: + - user_email properties: id: type: string + description: The invite's ID + example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 user_email: type: string + description: The email of the user being invited. + format: email role: type: string + description: The user's role. enum: - admin - member - developer + default: member accepted: type: boolean + description: Whether the invite was accepted or not. + example: false token: type: string + description: The token used to accept the invite. expores_at: type: string + description: The date the invite expires at. format: date-time created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white + line_item_adjustment: + title: Line Item Adjustment + description: Represents an Line Item Adjustment + x-resourceId: line_item_adjustment + required: + - item_id + - description + - amount + properties: + id: + type: string + description: The invite's ID + example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + description: + type: string + description: The line item's adjustment description + example: Adjusted item's price. + discount_id: + type: string + description: The ID of the discount associated with the adjustment + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + discount: + description: Available if the relation `discount` is expanded. + $ref: '#/components/schemas/discount' + amount: + type: number + description: The adjustment amount + example: 1000 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + line_item_tax_line: + title: Line Item Tax Line + description: Represents an Line Item Tax Line + x-resourceId: line_item_tax_line + required: + - item_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white line_item: title: Line Item description: >- @@ -8839,87 +12056,176 @@ components: Returns. Line Items may also be created when processing Swaps and Claims. x-resourceId: line_item + required: + - title + - unit_price + - quantity properties: id: - description: The id of the Line Item. This value will be prefixed by `item_`. type: string + description: The cart's ID + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN cart_id: - description: The id of the Cart that the Line Item belongs to. + description: The ID of the Cart that the Line Item belongs to. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object order_id: - description: The id of the Order that the Line Item belongs to. + description: The ID of the Order that the Line Item belongs to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object swap_id: description: The id of the Swap that the Line Item belongs to. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object claim_order_id: description: The id of the Claim that the Line Item belongs to. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + description: Available if the relation `tax_lines` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_tax_line' + adjustments: + description: Available if the relation `adjustments` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_adjustment' title: description: >- The title of the Line Item, this should be easily identifiable by the Customer. type: string + example: Medusa Coffee Mug description: description: A more detailed description of the contents of the Line Item. type: string + example: One Size thumbnail: description: A URL string to a small image of the contents of the Line Item. type: string + format: uri + example: >- + https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png + is_return: + description: Is the item being returned + type: boolean + example: false is_giftcard: description: Flag to indicate if the Line Item is a Gift Card. type: boolean + example: false should_merge: description: >- Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item. type: boolean + example: false allow_discounts: description: >- Flag to indicate if the Line Item should be included when doing discount calculations. type: boolean + example: false + has_shipping: + description: >- + Flag to indicate if the Line Item has fulfillment associated with + it. + type: boolean + example: false unit_price: description: >- The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to. type: boolean + example: 8000 variant_id: description: The id of the Product Variant contained in the Line Item. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 variant: - description: The Product Variant contained in the Line Item. - anyOf: - - $ref: '#/components/schemas/product_variant' + description: >- + A product variant object. The Product Variant contained in the Line + Item. Available if the relation `variant` is expanded. + type: object quantity: description: The quantity of the content in the Line Item. type: integer + example: 1 fulfilled_quantity: description: The quantity of the Line Item that has been fulfilled. type: integer + example: 0 returned_quantity: description: The quantity of the Line Item that has been returned. type: integer + example: 0 shipped_quantity: description: The quantity of the Line Item that has been shipped. type: integer - created_at: - description: The date with timezone at which the resource was created. - type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - metadata: - description: An optional key-value map with additional information. - type: object + example: 0 refundable: description: >- The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration. type: integer + example: 0 + subtotal: + type: integer + description: The subtotal of the line item + example: 8000 + tax_total: + type: integer + description: The total of tax of the line item + example: 0 + total: + type: integer + description: The total amount of the line item + example: 8000 + original_total: + type: integer + description: The original total amount of the line item + example: 8000 + original_tax_total: + type: integer + description: The original tax total amount of the line item + example: 0 + discount_total: + type: integer + description: The total of discount of the line item + example: 0 + gift_card_total: + type: integer + description: The total of the gift card of the line item + example: 0 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white money_amount: title: Money Amount description: >- @@ -8930,50 +12236,82 @@ components: region-based pricing is used the amount will be in the currency defined for the Reigon. x-resourceId: money_amount + required: + - currency_code + - amount properties: id: - description: The id of the Money Amount. This value will be prefixed by `ma_`. type: string + description: The money amount's ID + example: ma_01F0YESHRFQNH5S8Q0PK84YYZN currency_code: description: The 3 character currency code that the Money Amount is given in. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' amount: description: >- The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost. type: integer + example: 100 min_quantity: description: >- The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities. type: integer + example: 1 max_quantity: description: >- The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities. type: integer + example: 1 + price_list_id: + type: string + description: The ID of the price list associated with the money amount + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + price_list: + description: Available if the relation `price_list` is expanded. + $ref: '#/components/schemas/price_list' variant_id: - description: The id of the Product Variant that the Money Amount belongs to. + description: The id of the Product Variant contained in the Line Item. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + The Product Variant contained in the Line Item. Available if the + relation `variant` is expanded. + type: object region_id: - description: The id of the Region that the Money Amount is defined for. type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - description: The Region that the Money Amount is defined for. - anyOf: - - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white note: title: Note description: >- @@ -8981,54 +12319,71 @@ components: resources to allow users to describe additional information in relation to these. x-resourceId: note + required: + - value + - resource_type + - resource_id properties: id: - description: The id of the Note. This value will be prefixed by `note_`. type: string + description: The note's ID + example: note_01G8TM8ENBMC7R90XRR1G6H26Q resource_type: description: The type of resource that the Note refers to. type: string + example: order resource_id: - description: The id of the resource that the Note refers to. + description: The ID of the resource that the Note refers to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK value: description: The contents of the note. type: string - author: - description: The author of the note. - anyOf: - - $ref: '#/components/schemas/user' - created_at: - description: The date with timezone at which the resource was created. + example: This order must be fulfilled on Monday + author_id: type: string + description: The ID of the author (user) + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + author: + description: Available if the relation `author` is expanded. + $ref: '#/components/schemas/user' + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white notification_provider: title: Notification Provider description: >- Represents a notification provider plugin and holds its installation status. x-resourceId: notification_provider + required: + - id properties: id: description: The id of the notification provider as given by the plugin. type: string + example: sendgrid is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + default: true notification: title: Notification description: >- @@ -9037,40 +12392,47 @@ components: used to show a chronological timeline for communications sent to a Customer regarding an Order, and enables resends. x-resourceId: notification + required: + - resource_type + - resource_id + - to properties: id: - description: The id of the Notification. This value will be prefixed by `noti_`. type: string + description: The notification's ID + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX event_name: description: The name of the event that the notification was sent for. type: string + example: order.placed resource_type: description: The type of resource that the Notification refers to. type: string + example: order resource_id: - description: The id of the resource that the Notification refers to. + description: The ID of the resource that the Notification refers to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK customer_id: - description: The id of the Customer that the Notification was sent to. + description: The ID of the Customer that the Notification was sent to. type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 customer: - description: The Customer that the Notification was sent to. - anyOf: - - $ref: '#/components/schemas/customer' + description: A customer object. Available if the relation `customer` is expanded. + type: object to: description: >- 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 type: string + example: user@example.com data: description: >- The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend. type: object - parent_id: - description: The id of the Notification that was originally sent. - type: string + example: {} resends: description: >- The resends that have been completed after the original @@ -9081,13 +12443,17 @@ components: provider_id: description: The id of the Notification Provider that handles the Notification. type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time notification_resend: title: Notification Resend @@ -9095,76 +12461,123 @@ components: x-resourceId: notification_resend properties: id: - description: The id of the Notification. This value will be prefixed by `noti_`. + description: The notification resend's ID type: string + example: noti_01F0YET45G9NHP08Z66CE4QKBS event_name: description: The name of the event that the notification was sent for. type: string + example: order.placed resource_type: description: The type of resource that the Notification refers to. type: string + example: order resource_id: - description: The id of the resource that the Notification refers to. + description: The ID of the resource that the Notification refers to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + customer_id: + description: The ID of the Customer that the Notification was sent to. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object to: description: >- 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 type: string + example: user@example.com data: description: >- The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend. type: object + example: {} parent_id: - description: The id of the Notification that was originally sent. + description: The ID of the Notification that was originally sent. type: string + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + parent_notification: + description: Available if the relation `parent_notification` is expanded. + $ref: '#/components/schemas/notification' provider_id: - description: The id of the Notification Provider that handles the Notification. + description: The ID of the Notification Provider that handles the Notification. type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time OAuth: title: OAuth description: Represent an OAuth app x-resourceId: OAuth + required: + - id + - display_name + - application_name properties: id: type: string + description: The app's ID + example: example_app display_name: type: string + description: The app's display name + example: Example app application_name: type: string + description: The app's name + example: example install_url: type: string + description: The URL to install the app + format: uri uninstall_url: - type: integer + type: string + description: The URL to uninstall the app + format: uri data: type: object + description: Any data necessary to the app. + example: {} order: title: Order description: Represents an order x-resourceId: order + required: + - customer_id + - email + - region_id + - currency_code properties: id: type: string + description: The order's ID + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK status: type: string + description: The order's status enum: - pending - completed - archived - canceled - requires_action + default: pending fulfillment_status: type: string + description: The order's fulfillment status enum: - not_fulfilled - partially_fulfilled @@ -9175,8 +12588,10 @@ components: - returned - canceled - requires_action + default: not_fulfilled payment_status: type: string + description: The order's payment status enum: - not_paid - awaiting @@ -9185,134 +12600,246 @@ components: - refuneded - canceled - requires_action + default: not_paid display_id: type: integer + description: The order's display ID + example: 2 cart_id: type: string - currency_code: - type: string - tax_rate: - type: number - discounts: - type: array - items: - $ref: '#/components/schemas/discount' - email: - type: string - billing_address_id: - type: string - billing_address: - anyOf: - - $ref: '#/components/schemas/address' - shipping_address_id: - type: string - shipping_address: - anyOf: - - $ref: '#/components/schemas/address' - items: - type: array - items: - $ref: '#/components/schemas/line_item' - region_id: - type: string - region: - anyOf: - - $ref: '#/components/schemas/region' - gift_cards: - type: array - items: - $ref: '#/components/schemas/gift_card' + description: The ID of the cart associated with the order + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object customer_id: type: string + description: The ID of the customer associated with the order + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 customer: - anyOf: - - $ref: '#/components/schemas/customer' - payment_session: - anyOf: - - $ref: '#/components/schemas/payment_session' - payment_sessions: + description: A customer object. Available if the relation `customer` is expanded. + type: object + email: + description: The email associated with the order + type: string + format: email + billing_address_id: + type: string + description: The ID of the billing address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_address_id: + type: string + description: The ID of the shipping address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + currency_code: + description: The 3 character currency code that is used in the order + type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' + tax_rate: + description: The order's tax rate + type: number + example: 0 + discounts: type: array + description: >- + The discounts used in the order. Available if the relation + `discounts` is expanded. items: - $ref: '#/components/schemas/payment_session' - payments: + type: object + description: A discount object. + gift_cards: type: array + description: >- + The gift cards used in the order. Available if the relation + `gift_cards` is expanded. items: - $ref: '#/components/schemas/payment' + type: object + description: A gift card object. shipping_methods: type: array + description: >- + The shipping methods used in the order. Available if the relation + `shipping_methods` is expanded. items: $ref: '#/components/schemas/shipping_method' + payments: + type: array + description: >- + The payments used in the order. Available if the relation `payments` + is expanded. + items: + $ref: '#/components/schemas/payment' fulfillments: type: array + description: >- + The fulfillments used in the order. Available if the relation + `fulfillments` is expanded. items: $ref: '#/components/schemas/fulfillment' returns: type: array + description: >- + The returns associated with the order. Available if the relation + `returns` is expanded. items: - $ref: '#/components/schemas/return' + type: object + description: A return object. claims: type: array + description: >- + The claims associated with the order. Available if the relation + `claims` is expanded. items: - $ref: '#/components/schemas/claim_order' + type: object + description: A claim order object. refunds: type: array + description: >- + The refunds associated with the order. Available if the relation + `refunds` is expanded. items: - $ref: '#/components/schemas/refund' + type: object + description: A refund object. swaps: type: array + description: >- + The swaps associated with the order. Available if the relation + `swaps` is expanded. items: - $ref: '#/components/schemas/refund' + type: object + description: A swap object. + draft_order_id: + type: string + description: The ID of the draft order this order is associated with. + example: null + draft_order: + description: >- + A draft order object. Available if the relation `draft_order` is + expanded. + type: object + items: + type: array + description: >- + The line items that belong to the order. Available if the relation + `items` is expanded. + items: + $ref: '#/components/schemas/line_item' gift_card_transactions: type: array + description: >- + The gift card transactions used in the order. Available if the + relation `gift_card_transactions` is expanded. items: $ref: '#/components/schemas/gift_card_transaction' canceled_at: type: string + description: The date the order was canceled on. format: date-time - created_at: - type: string - format: date-time - update_at: - type: string - format: date-time - deleted_at: - type: string - format: date-time - metadata: - type: object - shipping_total: - type: integer - discount_total: - type: integer - tax_total: - type: integer - subtotal: - type: integer - refundable_amount: - type: integer - gift_card_total: - type: integer - paid_total: - type: integer no_notification: description: >- Flag for describing whether or not notifications related to this should be send. type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the processing of the order + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + external_id: + description: The ID of an external order. + type: string + example: null + sales_channel_id: + type: string + description: The ID of the sales channel this order is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: The total amount refunded if the order is returned. + example: 0 + total: + type: integer + description: The total amount of the order + example: 8200 + subtotal: + type: integer + description: The subtotal of the order + example: 8000 + paid_total: + type: integer + description: The total amount paid + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 payment_provider: title: Payment Provider description: Represents a Payment Provider plugin and holds its installation status. x-resourceId: payment_provider + required: + - id properties: id: description: The id of the payment provider as given by the plugin. type: string + example: manual is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + default: true payment_session: title: Payment Session description: >- @@ -9323,25 +12850,34 @@ components: Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc. x-resourceId: payment_session + required: + - cart_id + - provider_id + - status properties: id: - description: >- - The id of the Payment Session. This value will be prefixed with - `ps_`. type: string + description: The payment session's ID + example: ps_01G901XNSRM2YS3ASN9H5KG3FZ cart_id: description: The id of the Cart that the Payment Session is created for. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object provider_id: description: >- The id of the Payment Provider that is responsible for the Payment Session type: string + example: manual is_selected: description: >- A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase. type: boolean + example: true status: description: >- Indicates the status of the Payment Session. Will default to @@ -9355,6 +12891,7 @@ components: - requires_more - error - canceled + example: pending data: description: >- The data required for the Payment Provider to identify, modify and @@ -9362,13 +12899,23 @@ components: holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state. type: object - created_at: - description: The date with timezone at which the resource was created. + example: {} + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time payment: title: Payment @@ -9376,33 +12923,59 @@ components: Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded. x-resourceId: payment + required: + - amount + - currency_code + - provider_id properties: id: - description: The id of the Payment. This value will be prefixed with `pay_`. type: string + description: The payment's ID + example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE swap_id: - description: The id of the Swap that the Payment is used for. - type: string - order_id: - description: The id of the Order that the Payment is used for. + description: The ID of the Swap that the Payment is used for. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object cart_id: description: The id of the Cart that the Payment Session is created for. type: string + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Payment is used for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object amount: description: The amount that the Payment has been authorized for. type: integer + example: 100 currency_code: description: The 3 character ISO currency code that the Payment is completed in. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' amount_refunded: description: >- The amount of the original Payment amount that has been refunded back to the Customer. type: integer + example: 0 provider_id: description: The id of the Payment Provider that is responsible for the Payment type: string + example: manual data: description: >- The data required for the Payment Provider to identify, modify and @@ -9410,6 +12983,7 @@ components: id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state. type: object + example: {} captured_at: description: The date with timezone at which the Payment was captured. type: string @@ -9418,27 +12992,50 @@ components: description: The date with timezone at which the Payment was canceled. type: string format: date-time - created_at: - description: The date with timezone at which the resource was created. + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of a payment + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white price_list: title: Price List description: >- Price Lists represents a set of prices that overrides the default price for one or more product variants. x-resourceId: price_list + required: + - name + - description properties: id: - description: The id of the Price List. This value will be prefixed by `pl_`. type: string + description: The price list's ID + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + name: + type: string + description: The price list's name + example: VIP Prices + description: + type: string + description: The price list's description + example: Prices for VIP customers type: description: >- The type of Price List. This can be one of either `sale` or @@ -9447,6 +13044,14 @@ components: enum: - sale - override + default: sale + status: + description: The status of the Price List + type: string + enum: + - active + - draft + default: draft starts_at: description: The date with timezone that the Price List starts being valid. type: string @@ -9456,60 +13061,78 @@ components: type: string format: date-time customer_groups: - description: The Customer Groups that the Price List applies to. + description: >- + The Customer Groups that the Price List applies to. Available if the + relation `customer_groups` is expanded. type: array items: - $ref: '#/components/schemas/customer_group' + type: object + description: A customer group object. + prices: + description: >- + The Money Amounts that are associated with the Price List. Available + if the relation `prices` is expanded. + type: array + items: + $ref: '#/components/schemas/money_amount' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time product_collection: title: Product Collection description: Product Collections represents a group of Products that are related. x-resourceId: product_collection + required: + - title properties: id: - description: >- - The id of the Product Collection. This value will be prefixed with - `pcol_`. type: string + description: The product collection's ID + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG title: description: The title that the Product Collection is identified by. type: string + example: Summer Collection handle: description: >- A unique string that identifies the Product Collection - can for example be used in slug structures. type: string + example: summer-collection products: - description: The Products contained in the Product Collection. + description: >- + The Products contained in the Product Collection. Available if the + relation `products` is expanded. type: array items: - $ref: '#/components/schemas/product' + type: object + description: A product collection object. created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_option_value: title: Product Option Value description: >- @@ -9517,43 +13140,57 @@ components: Product Option Value for each of the Product Options defined on the Product. x-resourceId: product_option_value + required: + - value + - option_id + - variant_id properties: id: - description: >- - The id of the Product Option Value. This value will be prefixed with - `optval_`. type: string + description: The product option value's ID + example: optval_01F0YESHR7S6ECD03RF6W12DSJ value: description: >- The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is "Size" this value could be "Small", "Medium" or "Large"). type: string + example: large option_id: description: >- - The id of the Product Option that the Product Option Value is + The ID of the Product Option that the Product Option Value is defined for. type: string + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + option: + description: Available if the relation `option` is expanded. + $ref: '#/components/schemas/product_option' variant_id: description: >- - The id of the Product Variant that the Product Option Value is + The ID of the Product Variant that the Product Option Value is defined for. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: Available if the relation `variant` is expanded. + $ref: '#/components/schemas/product_variant' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_option: title: Product Option description: >- @@ -9561,150 +13198,189 @@ components: variants of a Product. Common Product Options are "Size" and "Color", but Medusa doesn't limit what Product Options that can be defined. x-resourceId: product_option + required: + - title + - product_id properties: id: - description: >- - The id of the Product Option. This value will be prefixed with - `opt_`. type: string + description: The product option's ID + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 title: description: The title that the Product Option is defined by (e.g. "Size"). type: string + example: Size values: - description: The Product Option Values that are defined for the Product Option. + description: >- + The Product Option Values that are defined for the Product Option. + Available if the relation `values` is expanded. type: array items: $ref: '#/components/schemas/product_option_value' product_id: - description: The id of the Product that the Product Option is defined for. + description: The ID of the Product that the Product Option is defined for. type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_tag: title: Product Tag description: Product Tags can be added to Products for easy filtering and grouping. x-resourceId: product_tag + required: + - value properties: id: - description: The id of the Product Tag. This value will be prefixed with `ptag_`. type: string + description: The product tag's ID + example: ptag_01G8K2MTMG9168F2B70S1TAVK3 value: - description: The value that the Product Tag represents (e.g. "Pants"). + description: The value that the Product Tag represents type: string + example: Pants created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_tax_rate: title: Product Tax Rate description: >- Associates a tax rate with a product to indicate that the product is taxed in a certain way x-resourceId: product_tax_rate + required: + - product_id + - rate_id properties: product_id: - description: The id of the Product + description: The ID of the Product type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: Available if the relation `product` is expanded. + $ref: '#/components/schemas/product' rate_id: - description: The id of the Tax Rate + description: The ID of the Tax Rate type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: '#/components/schemas/tax_rate' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_type_tax_rate: title: Product Type Tax Rate description: >- Associates a tax rate with a product type to indicate that the product type is taxed in a certain way x-resourceId: product_type_tax_rate + required: + - product_type_id + - rate_id properties: product_type_id: - description: The id of the Product type + description: The ID of the Product type type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: '#/components/schemas/product_type' rate_id: description: The id of the Tax Rate type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: '#/components/schemas/tax_rate' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_type: title: Product Type description: >- Product Type can be added to Products for filtering and reporting purposes. x-resourceId: product_type + required: + - value properties: id: - description: >- - The id of the Product Type. This value will be prefixed with - `ptyp_`. type: string + description: The product type's ID + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A value: - description: The value that the Product Type represents (e.g. "Clothing"). + description: The value that the Product Type represents. type: string + example: Clothing created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_variant: title: Product Variant description: >- @@ -9713,25 +13389,33 @@ components: Product can have is given by the number of available Product Option combinations. x-resourceId: product_variant + required: + - title + - product_id + - inventory_quantity properties: id: - description: >- - The id of the Product Variant. This value will be prefixed with - `variant_`. type: string + description: The product variant's ID + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 title: description: >- A title that can be displayed for easy identification of the Product Variant. type: string + example: Small product_id: - description: The id of the Product that the Product Variant belongs to. + description: The ID of the Product that the Product Variant belongs to. type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object prices: description: >- The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific - Region. + Region. Available if the relation `prices` is expanded. type: array items: $ref: '#/components/schemas/money_amount' @@ -9741,96 +13425,119 @@ components: This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems. type: string + example: shirt-123 barcode: description: >- A generic field for a GTIN number that can be used to identify the Product Variant. type: string + example: null ean: description: >- An EAN barcode number that can be used to identify the Product Variant. type: string + example: null upc: description: >- A UPC barcode number that can be used to identify the Product Variant. type: string + example: null + variant_rank: + description: The ranking of this variant + type: number + default: 0 inventory_quantity: description: The current quantity of the item that is stocked. type: integer + example: 100 allow_backorder: description: >- Whether the Product Variant should be purchasable when `inventory_quantity` is 0. type: boolean + default: false manage_inventory: description: Whether Medusa should manage inventory for the Product Variant. type: boolean + default: true hs_code: description: >- The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null origin_country: description: >- The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null mid_code: description: >- The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null material: description: >- The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null weight: description: >- The weight of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null height: description: >- The height of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null width: description: >- The width of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null length: description: >- The length of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null options: - description: The Product Option Values specified for the Product Variant. + description: >- + The Product Option Values specified for the Product Variant. + Available if the relation `options` is expanded. type: array items: $ref: '#/components/schemas/product_option_value' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product: title: Product description: >- @@ -9838,15 +13545,20 @@ components: such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. x-resourceId: product + required: + - title + - profile_id properties: id: - description: The id of the Product. This value will be prefixed with `prod_`. type: string + description: The product's ID + example: prod_01G1G5V2MBA328390B5AXJ610F title: description: >- A title that can be displayed for easy identification of the Product. type: string + example: Medusa Coffee Mug subtitle: description: >- An optional subtitle that can be used to further specify the @@ -9855,121 +13567,174 @@ components: description: description: A short description of the Product. type: string + example: Every programmer's best friend. handle: description: A unique identifier for the Product (e.g. for slug structure). type: string + example: coffee-mug is_giftcard: description: >- Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased. type: boolean - discountable: - description: >- - Whether the Product can be discounted. Discounts will not apply to - Line Items of this Product when this flag is set to `false`. - type: boolean + default: false + status: + description: The status of the product + type: string + enum: + - draft + - proposed + - published + - rejected + default: draft images: - description: Images of the Product + description: >- + Images of the Product. Available if the relation `images` is + expanded. type: array items: $ref: '#/components/schemas/image' thumbnail: description: A URL to an image file that can be used to identify the Product. type: string + format: uri options: description: >- The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product - Option Values. + Option Values. Available if the relation `options` is expanded. type: array items: $ref: '#/components/schemas/product_option' variants: description: >- The Product Variants that belong to the Product. Each will have a - unique combination of Product Option Values. + unique combination of Product Option Values. Available if the + relation `variants` is expanded. type: array items: $ref: '#/components/schemas/product_variant' profile_id: description: >- - The id of the Shipping Profile that the Product belongs to. Shipping + The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products. type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: '#/components/schemas/shipping_profile' + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null hs_code: description: >- The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null origin_country: description: >- The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null mid_code: description: >- The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null material: description: >- The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string - weight: - description: >- - The weight of the Product Variant. May be used in shipping rate - calculations. + example: null + collection_id: type: string - height: - description: >- - The height of the Product Variant. May be used in shipping rate - calculations. - type: string - width: - description: >- - The width of the Product Variant. May be used in shipping rate - calculations. - type: string - length: - description: >- - The length of the Product Variant. May be used in shipping rate - calculations. - type: string - type: - description: The Product Type of the Product (e.g. "Clothing") - anyOf: - - $ref: '#/components/schemas/product_type' + description: The Product Collection that the Product belongs to + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG collection: - description: The Product Collection that the Product belongs to (e.g. "SS20") - anyOf: - - $ref: '#/components/schemas/product_collection' + description: >- + A product collection object. Available if the relation `collection` + is expanded. + type: object + type_id: + type: string + description: The Product type that the Product belongs to + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: Available if the relation `type` is expanded. + $ref: '#/components/schemas/product_type' tags: - description: The Product Tags assigned to the Product. + description: >- + The Product Tags assigned to the Product. Available if the relation + `tags` is expanded. type: array items: $ref: '#/components/schemas/product_tag' - created_at: - description: The date with timezone at which the resource was created. + discountable: + description: >- + Whether the Product can be discounted. Discounts will not apply to + Line Items of this Product when this flag is set to `false`. + type: boolean + default: true + external_id: + description: The external ID of the product type: string + example: null + sales_channels: + description: >- + The sales channels the product is associated with. Available if the + relation `sales_channels` is expanded. + type: array + items: + type: object + description: A sales channel object. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white refund: title: Refund description: >- @@ -9977,19 +13742,26 @@ components: a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by a store operator. x-resourceId: refund + required: + - order_id + - amount properties: id: - description: The id of the Refund. This value will be prefixed with `ref_`. type: string + description: The refund's ID + example: ref_01G1G5V27GYX4QXNARRQCW1N8T order_id: description: The id of the Order that the Refund is related to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK amount: description: The amount that has be refunded to the Customer. type: integer + example: 1000 note: description: An optional note explaining why the amount was refunded. type: string + example: I didn't like it reason: description: >- The reason given for the Refund, will automatically be set when @@ -10001,17 +13773,33 @@ components: - swap - claim - other - created_at: - description: The date with timezone at which the resource was created. + example: return + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of the refund + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white region: title: Region description: >- @@ -10020,137 +13808,212 @@ components: Region can consist of multiple countries to accomodate common shopping settings across countries. x-resourceId: region + required: + - name + - currency_code + - tax_rate properties: id: - description: The id of the Region. This value will be prefixed with `reg_`. type: string + description: The cart's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G name: description: >- The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name. type: string + example: EU currency_code: - description: >- - The 3 character ISO currency code that Customers will shop in in the - Region. + description: The 3 character currency code that the Region uses. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' tax_rate: description: The tax rate that should be charged on purchases in the Region. type: number + example: 0 + tax_rates: + description: >- + The tax rates that are included in the Region. Available if the + relation `tax_rates` is expanded. + type: array + items: + $ref: '#/components/schemas/tax_rate' tax_code: description: >- The tax code used on purchases in the Region. This may be used by other systems for accounting purposes. type: string + example: null + gift_cards_taxable: + description: Whether the gift cards are taxable or not in this region. + type: boolean + default: true + automatic_taxes: + description: Whether taxes should be automated in this region. + type: boolean + default: true countries: - description: The countries that are included in the Region. + description: >- + The countries that are included in the Region. Available if the + relation `countries` is expanded. type: array items: $ref: '#/components/schemas/country' + tax_provider_id: + type: string + description: The ID of the tax provider used in this region + example: null + tax_provider: + description: Available if the relation `tax_provider` is expanded. + $ref: '#/components/schemas/tax_provider' payment_providers: description: >- The Payment Providers that can be used to process Payments in the - Region. + Region. Available if the relation `payment_providers` is expanded. type: array items: $ref: '#/components/schemas/payment_provider' fulfillment_providers: description: >- The Fulfillment Providers that can be used to fulfill orders in the - Region. + Region. Available if the relation `payment_providers` is expanded. type: array items: $ref: '#/components/schemas/fulfillment_provider' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white return_item: title: Return Item description: >- Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned. x-resourceId: return_item + required: + - return_id + - item_id properties: return_id: description: The id of the Return that the Return Item belongs to. type: string + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + return_order: + description: Available if the relation `return_order` is expanded. + $ref: '#/components/schemas/return' item_id: description: The id of the Line Item that the Return Item references. type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN item: - description: The Line Item that the Return Item references. - anyOf: - - $ref: '#/components/schemas/line_item' + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' quantity: description: The quantity of the Line Item that is included in the Return. type: integer + example: 1 is_requested: description: >- Whether the Return Item was requested initially or received unexpectedly in the warehouse. type: boolean + default: true requested_quantity: description: The quantity that was originally requested to be returned. type: integer + example: 1 recieved_quantity: description: The quantity that was received in the warehouse. type: integer + example: 1 + reason_id: + description: The ID of the reason for returning the item. + type: string + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ reason: - description: The reason for returning the item. - anyOf: - - $ref: '#/components/schemas/return_reason' + description: Available if the relation `reason` is expanded. + $ref: '#/components/schemas/return_reason' note: description: An optional note with additional details about the Return. type: string + example: I didn't like it. metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white return_reason: title: Return Reason description: >- A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned. x-resourceId: return_reason + required: + - value + - label properties: id: - description: The id of the Return Reason will start with `rr_`. type: string + description: The cart's ID + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ description: description: A description of the Reason. type: string + example: Items that are damaged label: description: A text that can be displayed to the Customer as a reason. type: string + example: Damaged goods value: description: The value to identify the reason by. type: string - created_at: - description: The date with timezone at which the resource was created. + example: damaged + parent_return_reason_id: type: string + description: The ID of the parent reason. + example: null + parent_return_reason: + description: Available if the relation `parent_return_reason` is expanded. + $ref: '#/components/schemas/return_reason' + return_reason_children: + description: Available if the relation `return_reason_children` is expanded. + $ref: '#/components/schemas/return_reason' + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white return: title: Return description: >- @@ -10158,10 +14021,13 @@ components: to send back, along with how the items will be returned. Returns can be used as part of a Swap. x-resourceId: return + required: + - refund_amount properties: id: - description: The id of the Return. This value will be prefixed with `ret_`. type: string + description: The return's ID + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V status: description: Status of the Return. type: string @@ -10169,53 +14035,168 @@ components: - requested - received - requires_action + - canceled + default: requested items: description: >- - The Return Items that will be shipped back to the warehouse. type: - array items: $ref: + The Return Items that will be shipped back to the warehouse. + Available if the relation `items` is expanded. + type: array + items: + $ref: '#/components/schemas/return_item' swap_id: - description: The id of the Swap that the Return is a part of. + description: The ID of the Swap that the Return is a part of. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object order_id: - description: The id of the Order that the Return is made from. + description: The ID of the Order that the Return is made from. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object claim_order_id: - description: The id of the Claim that the Return is a part of. + description: The ID of the Claim that the Return is a part of. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object shipping_method: description: >- The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves. - anyOf: - - $ref: '#/components/schemas/shipping_method' + Available if the relation `shipping_method` is expanded. + type: array + items: + $ref: '#/components/schemas/shipping_method' shipping_data: description: >- Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment. type: object + example: {} refund_amount: description: The amount that should be refunded as a result of the return. type: integer - received_at: - description: The date with timezone at which the return was received. - type: string - format: date-time - created_at: - description: The date with timezone at which the resource was created. - type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time + example: 1000 no_notification: description: >- When set to true, no notification will be sent related to this return. type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the return + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + received_at: + description: The date with timezone at which the return was received. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white + sales_channel: + title: Sales Channel + description: A Sales Channel + x-resourceId: sales_channel + required: + - name + properties: + id: + type: string + description: The sales channel's ID + example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + name: + description: The name of the sales channel. + type: string + example: Market + description: + description: The description of the sales channel. + type: string + example: Multi-vendor market + is_disabled: + description: Specify if the sales channel is enabled or disabled. + type: boolean + default: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + sales_channel_tax_line: + title: Sales Channel + description: A Sales Channel + x-resourceId: sales_channel_tax_line + required: + - shipping_method_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + shipping_method_id: + type: string + description: The ID of the line item + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_method: + description: Available if the relation `shipping_method` is expanded. + $ref: '#/components/schemas/shipping_method' + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white shipping_method: title: Shipping Method description: >- @@ -10224,65 +14205,105 @@ components: contain additional details, that can be necessary for the Fulfillment Provider to handle the shipment. x-resourceId: shipping_method + required: + - shipping_option_id + - price properties: id: - description: >- - The id of the Shipping Method. This value will be prefixed with - `sm_`. type: string + description: The shipping method's ID + example: sm_01F0YET7DR2E7CYVSDHM593QG2 shipping_option_id: description: >- The id of the Shipping Option that the Shipping Method is built from. type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T shipping_option: - description: The Shipping Option that the Shipping Method is built from. - anyOf: - - $ref: '#/components/schemas/shipping_option' + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' order_id: description: The id of the Order that the Shipping Method is used on. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object return_id: description: The id of the Return that the Shipping Method is used on. type: string + example: null + return_order: + description: >- + A return object. Available if the relation `return_order` is + expanded. + type: object swap_id: description: The id of the Swap that the Shipping Method is used on. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object cart_id: description: The id of the Cart that the Shipping Method is used on. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object claim_order_id: description: The id of the Claim that the Shipping Method is used on. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + type: array + description: Available if the relation `tax_lines` is expanded. + items: + $ref: '#/components/schemas/tax_line' price: description: >- The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of. type: integer + example: 200 data: description: >- Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id. type: object + example: {} shipping_option_requirement: title: Shipping Option Requirement description: >- A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart. x-resourceId: shipping_option_requirement + required: + - shipping_option_id + - type + - amount properties: id: - description: >- - The id of the Shipping Option Requirement. This value will be - prefixed with `sor_`. type: string + description: The shipping option requirement's ID + example: sor_01G1G5V29AB4CTNDRFSRWSRKWD shipping_option_id: description: >- - The id of the Shipping Option that the Shipping Option Requirement - belongs to. + The id of the Shipping Option that the hipping option requirement + belongs to type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' type: description: >- The type of the requirement, this defines how the value will be @@ -10294,9 +14315,15 @@ components: enum: - min_subtotal - max_subtotal + example: min_subtotal amount: description: The amount to compare the Cart subtotal to. type: integer + example: 100 + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time shipping_option: title: Shipping Option description: >- @@ -10307,35 +14334,49 @@ components: Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. x-resourceId: shipping_option + required: + - name + - region_id + - profile_id + - provider_id + - price_type properties: id: - description: >- - The id of the Shipping Option. This value will be prefixed with - `so_`. type: string + description: The shipping option's ID + example: so_01G1G5V27GYX4QXNARRQCW1N8T name: description: >- The name given to the Shipping Option - this may be displayed to the Customer. type: string + example: PostFake Standard region_id: - description: The id of the Region that the Shipping Option belongs to. type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - description: The id of the Region that the Shipping Option belongs to. - anyOf: - - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object profile_id: description: >- - The id of the Shipping Profile that the Shipping Option belongs to. + The ID of the Shipping Profile that the shipping option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products. type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: '#/components/schemas/shipping_profile' provider_id: description: >- The id of the Fulfillment Provider, that will be used to process Fulfillments from the Shipping Option. type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/fulfillment_provider' price_type: description: >- The type of pricing calculation that is used when creatin Shipping @@ -10346,20 +14387,24 @@ components: enum: - flat_rate - calculated + example: flat_rate amount: description: >- The amount to charge for shipping when the Shipping Option price type is `flat_rate`. type: integer + example: 200 is_return: description: >- Flag to indicate if the Shipping Option can be used for Return shipments. type: boolean + default: false requirements: description: >- The requirements that must be satisfied for the Shipping Option to - be available for a Cart. + be available for a Cart. Available if the relation `requirements` is + expanded. type: array items: $ref: '#/components/schemas/shipping_option_requirement' @@ -10368,38 +14413,44 @@ components: The data needed for the Fulfillment Provider to identify the Shipping Option. type: object + example: {} created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white shipping_profile: title: Shipping Profile description: >- Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. x-resourceId: shipping_profile + required: + - name + - type properties: id: - description: >- - The id of the Shipping Profile. This value will be prefixed with - `sp_`. type: string + description: The shipping profile's ID + example: sp_01G1G5V239ENSZ5MV4JAR737BM name: description: >- The name given to the Shipping profile - this may be displayed to the Customer. type: string + example: Default Shipping Profile type: description: >- The type of the Shipping Profile, may be `default`, `gift_card` or @@ -10409,99 +14460,156 @@ components: - default - gift_card - custom + example: default products: - description: The Products that the Shipping Profile defines Shipping Options for. + description: >- + The Products that the Shipping Profile defines Shipping Options for. + Available if the relation `products` is expanded. type: array items: - $ref: '#/components/schemas/product' + type: object + description: A product object. shipping_options: description: >- The Shipping Options that can be used to fulfill the Products in the - Shipping Profile. + Shipping Profile. Available if the relation `shipping_options` is + expanded. type: array items: - anyOf: - - $ref: '#/components/schemas/shipping_option' + $ref: '#/components/schemas/shipping_option' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white shipping_tax_rate: title: Shipping Tax Rate description: >- Associates a tax rate with a shipping option to indicate that the shipping option is taxed in a certain way x-resourceId: shipping_tax_rate + required: + - shipping_option_id + - rate_id properties: shipping_option_id: - description: The id of the Shipping Option + description: The ID of the Shipping Option type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' rate_id: - description: The id of the Tax Rate + description: The ID of the Tax Rate type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: '#/components/schemas/tax_rate' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white + staged_job: + title: Staged Job + description: A staged job resource + x-resourceId: staged_job + required: + - event_name + properties: + id: + type: string + description: The staged job's ID + example: job_01F0YET7BZTARY9MKN1SJ7AAXF + event_name: + description: The name of the event + type: string + example: order.placed + data: + description: Data necessary for the job + type: object + example: {} store: title: Store description: 'Holds settings for the Store, such as name, currencies, etc.' x-resourceId: store properties: id: - description: The id of the Store. This value will be prefixed with `store_`. type: string + description: The store's ID + example: store_01G1G5V21KADXNGH29BJMAJ4B4 name: description: The name of the Store - this may be displayed to the Customer. type: string + example: Medusa Store default_currency_code: - description: >- - The default currency code used when no other currency code is - specified. + description: The 3 character currency code that is the default of the store. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + default_currency: + description: Available if the relation `default_currency` is expanded. + $ref: '#/components/schemas/currency' currencies: - description: The currencies that are enabled for the Store. + description: >- + The currencies that are enabled for the Store. Available if the + relation `currencies` is expanded. type: array items: $ref: '#/components/schemas/currency' swap_link_template: description: >- - A template to generate Swap links from use {{cart_id}} to include + A template to generate Swap links from. Use {{cart_id}} to include the Swap's `cart_id` in the link. type: string - created_at: - description: The date with timezone at which the resource was created. + example: null + payment_link_template: + description: >- + A template to generate Payment links from. Use {{cart_id}} to + include the payment's `cart_id` in the link. type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. + example: null + invite_link_template: + description: A template to generate Invite links from type: string - format: date-time - metadata: - description: An optional key-value map with additional information. + example: null + default_sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + default_sales_channel: + description: >- + A sales channel object. Available if the relation + `default_sales_channel` is expanded. type: object + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white swap: title: Swap description: >- @@ -10513,23 +14621,25 @@ components: Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference. x-resourceId: swap + required: + - fulfillment_status + - payment_status + - order_id properties: id: - description: The id of the Swap. This value will be prefixed with `swap_`. type: string + description: The swap's ID + example: swap_01F0YET86Y9G92D3YDR9Y6V676 fulfillment_status: description: The status of the Fulfillment of the Swap. type: string enum: - not_fulfilled - - partially_fulfilled - fulfilled - - partially_shipped - shipped - - partially_returned - - returned - canceled - requires_action + example: not_fulfilled payment_status: description: >- The status of the Payment of the Swap. The payment may either refer @@ -10539,71 +14649,96 @@ components: - not_paid - awaiting - captured + - confirmed - canceled - difference_refunded + - partially_refunded + - refunded - requires_action + example: not_paid order_id: description: >- - The id of the Order where the Line Items to be returned where + The ID of the Order where the Line Items to be returned where purchased. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object additional_items: - description: The new Line Items to ship to the Customer. + description: >- + The new Line Items to ship to the Customer. Available if the + relation `additional_items` is expanded. type: array items: $ref: '#/components/schemas/line_item' return_order: - description: The Return that is issued for the return part of the Swap. - anyOf: - - $ref: '#/components/schemas/return' + description: >- + A return order object. The Return that is issued for the return part + of the Swap. Available if the relation `return_order` is expanded. + type: object fulfillments: - description: The Fulfillments used to send the new Line Items. + description: >- + The Fulfillments used to send the new Line Items. Available if the + relation `fulfillments` is expanded. type: array items: $ref: '#/components/schemas/fulfillment' payment: description: >- The Payment authorized when the Swap requires an additional amount - to be charged from the Customer. - anyOf: - - $ref: '#/components/schemas/payment' + to be charged from the Customer. Available if the relation `payment` + is expanded. + $ref: '#/components/schemas/payment' difference_due: description: >- The difference that is paid or refunded as a result of the Swap. May be negative when the amount paid for the returned items exceed the total of the new Products. type: integer - shipping_address: + example: 0 + shipping_address_id: description: >- The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order. - anyOf: - - $ref: '#/components/schemas/address' + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' shipping_methods: - description: The Shipping Methods used to fulfill the addtional items purchased. + description: >- + The Shipping Methods used to fulfill the addtional items purchased. + Available if the relation `shipping_methods` is expanded. type: array items: $ref: '#/components/schemas/shipping_method' cart_id: description: The id of the Cart that the Customer will use to confirm the Swap. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object allow_backorder: description: 'If true, swaps can be completed with items out of stock' type: boolean + default: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the swap + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. confirmed_at: description: >- The date with timezone at which the Swap was confirmed by the Customer. type: string format: date-time - created_at: - description: The date with timezone at which the resource was created. - type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time canceled_at: description: The date with timezone at which the Swap was canceled. type: string @@ -10611,37 +14746,61 @@ components: no_notification: description: 'If set to true, no notification will be sent related to this swap' type: boolean + example: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white tax_line: title: Tax Line description: Line item that specifies an amount of tax to add to a line item. x-resourceId: tax_line + required: + - rate + - name properties: id: - description: The id of the Tax Line. This value will be prefixed by `tl_`. type: string + description: The tax line's ID + example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 code: description: A code to identify the tax type by type: string + example: tax01 name: description: A human friendly name for the tax type: string + example: Tax Example rate: description: The numeric rate to charge tax by type: number + example: 10 created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white tax_provider: title: Tax Provider description: The tax service used to calculate taxes @@ -10650,50 +14809,96 @@ components: id: description: The id of the tax provider as given by the plugin. type: string + example: manual is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + default: true tax_rate: title: Tax Rate description: >- A Tax Rate can be used to associate a certain rate to charge on products within a given Region x-resourceId: line_item + required: + - name + - region_id properties: id: - description: The id of the Tax Rate. This value will be prefixed by `txr_`. type: string + description: The tax rate's ID + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR rate: description: The numeric rate to charge type: number + example: 10 code: description: A code to identify the tax type by type: string + example: tax01 name: description: A human friendly name for the tax type: string + example: Tax Example region_id: + type: string description: The id of the Region that the rate belongs to - type: string + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + products: + type: array + description: >- + The products that belong to this tax rate. Available if the relation + `products` is expanded. + items: + type: object + description: A product object. + product_types: + type: array + description: >- + The product types that belong to this tax rate. Available if the + relation `product_types` is expanded. + items: + type: object + description: A product type object. + shipping_options: + type: array + description: >- + The shipping options that belong to this tax rate. Available if the + relation `shipping_options` is expanded. + items: + type: object + description: A shipping option object. + product_count: + description: The count of products + type: integer + example: null + product_type_count: + description: The count of product types + type: integer + example: null + shipping_option_count: + description: The count of shipping options + type: integer + example: null created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object - refundable: - description: >- - The amount that can be refunded from the given Line Item. Takes - taxes and discounts into consideration. - type: integer + description: An optional key-value map with additional details + example: + car: white tracking_link: title: Tracking Link description: >- @@ -10701,61 +14906,96 @@ components: Fulfillment. Tracking Links can optionally contain a URL that can be visited to see the status of the shipment. x-resourceId: tracking_link + required: + - tracking_number + - fulfillment_id properties: id: - description: >- - The id of the Tracking Link. This value will be prefixed with - `tlink_`. type: string + description: The tracking link's ID + example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 url: description: The URL at which the status of the shipment can be tracked. type: string + format: uri tracking_number: description: The tracking number given by the shipping carrier. type: string + format: RH370168054CN fulfillment_id: + type: string description: The id of the Fulfillment that the Tracking Link references. + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + fulfillment: + description: Available if the relation `fulfillment` is expanded. + $ref: '#/components/schemas/fulfillment' + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of a process + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white user: title: User description: Represents a User who can manage store settings. x-resourceId: user + required: + - email properties: id: - description: The unique id of the User. This will be prefixed with `usr_` type: string + description: The user's ID + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V email: description: The email of the User type: string + format: email first_name: + description: The first name of the User type: string + example: Levi last_name: - description: The Customer's billing address. - anyOf: - - $ref: '#/components/schemas/address' + description: The last name of the User + type: string + example: Bogan + api_token: + description: An API token associated with the user. + type: string + example: null created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/OAuth.yaml b/docs/api/admin/components/schemas/OAuth.yaml new file mode 100644 index 0000000000..a9afba0974 --- /dev/null +++ b/docs/api/admin/components/schemas/OAuth.yaml @@ -0,0 +1,32 @@ +title: OAuth +description: Represent an OAuth app +x-resourceId: OAuth +required: + - id + - display_name + - application_name +properties: + id: + type: string + description: The app's ID + example: example_app + display_name: + type: string + description: The app's display name + example: Example app + application_name: + type: string + description: The app's name + example: example + install_url: + type: string + description: The URL to install the app + format: uri + uninstall_url: + type: string + description: The URL to uninstall the app + format: uri + data: + type: object + description: Any data necessary to the app. + example: {} diff --git a/docs/api/admin/components/schemas/address.yaml b/docs/api/admin/components/schemas/address.yaml new file mode 100644 index 0000000000..ff413792f1 --- /dev/null +++ b/docs/api/admin/components/schemas/address.yaml @@ -0,0 +1,82 @@ +title: Address +description: An address. +x-resourceId: address +properties: + id: + type: string + description: ID of the address + example: addr_01G8ZC9VS1XVE149MGH2J7QSSH + customer_id: + type: string + description: ID of the customer this address belongs to + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: Available if the relation `customer` is expanded. + type: array + items: + type: object + description: A customer object. + company: + type: string + description: Company name + example: Acme + first_name: + type: string + description: First name + example: Arno + last_name: + type: string + description: Last name + example: Willms + address_1: + type: string + description: Address line 1 + example: 14433 Kemmer Court + address_2: + type: string + description: Address line 2 + example: Suite 369 + city: + type: string + description: City + example: South Geoffreyview + country_code: + type: string + description: The 2 character ISO code of the country in lower case + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + example: st + country: + description: A country object. Available if the relation `country` is expanded. + type: object + province: + type: string + description: Province + example: Kentucky + postal_code: + type: string + description: Postal Code + example: 72093 + phone: + type: string + description: Phone Number + example: 16128234334802 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/batch_job.yaml b/docs/api/admin/components/schemas/batch_job.yaml new file mode 100644 index 0000000000..dcb63d5f55 --- /dev/null +++ b/docs/api/admin/components/schemas/batch_job.yaml @@ -0,0 +1,139 @@ +title: Batch Job +description: A Batch Job. +x-resourceId: batch_job +required: + - type +properties: + id: + type: string + description: The unique identifier for the batch job. + example: batch_01G8T782965PYFG0751G0Z38B4 + type: + type: string + description: The type of batch job. + enum: + - product-import + - product-export + status: + type: string + description: The status of the batch job. + enum: + - created + - pre_processed + - confirmed + - processing + - completed + - canceled + - failed + default: created + created_by: + type: string + description: The unique identifier of the user that created the batch job. + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + created_by_user: + description: A user object. Available if the relation `created_by_user` is expanded. + type: object + context: + type: object + description: >- + The context of the batch job, the type of the batch job determines what + the context should contain. + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images + dry_run: + type: boolean + description: Specify if the job must apply the modifications or not. + default: false + result: + type: object + description: The result of the batch job. + properties: + count: + type: number + advancement_count: + type: number + progress: + type: number + errors: + type: object + properties: + message: + type: string + code: + oneOf: + - type: string + - type: number + err: + type: array + stat_descriptors: + type: object + properties: + key: + type: string + name: + type: string + message: + type: string + file_key: + type: string + file_size: + type: number + example: + errors: + - err: [] + code: unknown + message: Method not implemented. + stat_descriptors: + - key: product-export-count + name: Product count to export + message: There will be 8 products exported by this action + pre_processed_at: + type: string + description: The date from which the job has been pre processed. + format: date-time + processing_at: + type: string + description: The date the job is processing at. + format: date-time + confirmed_at: + type: string + description: The date when the confirmation has been done. + format: date-time + completed_at: + type: string + description: The date of the completion. + format: date-time + canceled_at: + type: string + description: The date of the concellation. + format: date-time + failed_at: + type: string + description: The date when the job failed. + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was last updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/admin/components/schemas/cart.yaml b/docs/api/admin/components/schemas/cart.yaml new file mode 100644 index 0000000000..0881621115 --- /dev/null +++ b/docs/api/admin/components/schemas/cart.yaml @@ -0,0 +1,174 @@ +title: Cart +description: Represents a user cart +x-resourceId: cart +properties: + id: + type: string + description: The cart's ID + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + email: + type: string + description: The email associated with the cart + format: email + billing_address_id: + type: string + description: The billing address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: ./address.yaml + shipping_address_id: + type: string + description: The shipping address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + items: + description: Available if the relation `items` is expanded. + type: array + items: + $ref: ./line_item.yaml + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + discounts: + type: array + description: Available if the relation `discounts` is expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: Available if the relation `gift_cards` is expanded. + items: + type: object + description: A gift card object. + customer_id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + payment_session: + description: The selected payment session in the cart. + $ref: ./payment_session.yaml + payment_sessions: + type: array + description: The payment sessions created on the cart. + items: + $ref: ./payment_session.yaml + payment_id: + type: string + description: The payment's ID if available + example: pay_01G8ZCC5W42ZNY842124G7P5R9 + payment: + description: Available if the relation `payment` is expanded. + $ref: ./payment.yaml + shipping_methods: + type: array + description: The shipping methods added to the cart. + items: + $ref: ./shipping_method.yaml + type: + type: string + description: The cart's type. + enum: + - default + - swap + - draft_order + - payment_link + - claim + default: default + completed_at: + type: string + description: The date with timezone at which the cart was completed. + format: date-time + payment_authorized_at: + type: string + description: The date with timezone at which the payment was authorized. + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in case + of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + context: + type: object + description: The context of the cart which can include info like IP or user agent. + example: + ip: '::1' + user_agent: PostmanRuntime/7.29.2 + sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: >- + The total amount refunded if the order associated with this cart is + returned. + example: 0 + total: + type: integer + description: The total amount of the cart + example: 8200 + subtotal: + type: integer + description: The subtotal of the cart + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 diff --git a/docs/api/admin/components/schemas/claim_image.yaml b/docs/api/admin/components/schemas/claim_image.yaml new file mode 100644 index 0000000000..5b2d04e74b --- /dev/null +++ b/docs/api/admin/components/schemas/claim_image.yaml @@ -0,0 +1,38 @@ +title: Claim Image +description: Represents photo documentation of a claim. +x-resourceId: claim_image +required: + - claim_item_id + - url +properties: + id: + type: string + description: The claim image's ID + example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 + claim_item_id: + type: string + description: The ID of the claim item associated with the image + claim_item: + description: A claim item object. Available if the relation `claim_item` is expanded. + type: object + url: + type: string + description: The URL of the image + format: uri + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/claim_item.yaml b/docs/api/admin/components/schemas/claim_item.yaml new file mode 100644 index 0000000000..ccec3c8ebf --- /dev/null +++ b/docs/api/admin/components/schemas/claim_item.yaml @@ -0,0 +1,83 @@ +title: Claim Item +description: >- + Represents a claimed item along with information about the reasons for the + claim. +x-resourceId: claim_item +required: + - claim_order_id + - item_id + - variant_id + - reason + - quantity +properties: + id: + type: string + description: The claim item's ID + example: citm_01G8ZH853Y6TFXWPG5EYE81X63 + images: + type: array + description: Available if the relation `images` is expanded. + items: + $ref: ./claim_image.yaml + claim_order_id: + description: The ID of the claim this item is associated with. + type: string + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + item_id: + description: The ID of the line item that the claim item refers to. + type: string + example: item_01G8ZM25TN49YV9EQBE2NC27KC + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + variant_id: + description: The ID of the product variant that is claimed. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: A variant object. Available if the relation `variant` is expanded. + type: object + reason: + description: The reason for the claim + type: string + enum: + - missing_item + - wrong_item + - production_failure + - other + note: + description: An optional note about the claim, for additional information + type: string + example: I don't like it. + quantity: + description: >- + The quantity of the item that is being claimed; must be less than or equal + to the amount purchased in the original order. + type: integer + example: 1 + tags: + description: >- + User defined tags for easy filtering and grouping. Available if the + relation 'tags' is expanded. + type: array + items: + $ref: ./claim_tag.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/claim_order.yaml b/docs/api/admin/components/schemas/claim_order.yaml new file mode 100644 index 0000000000..1d26758cec --- /dev/null +++ b/docs/api/admin/components/schemas/claim_order.yaml @@ -0,0 +1,121 @@ +title: Claim Order +description: >- + Claim Orders represent a group of faulty or missing items. Each claim order + consists of a subset of items associated with an original order, and can + contain additional information about fulfillments and returns. +x-resourceId: claim_order +required: + - type + - order_id +properties: + id: + type: string + description: The claim's ID + example: claim_01G8ZH853Y6TFXWPG5EYE81X63 + type: + type: string + enum: + - refund + - replace + payment_status: + type: string + description: The status of the claim's payment + enum: + - na + - not_refunded + - refunded + default: na + fulfillment_status: + type: string + enum: + - not_fulfilled + - partially_fulfilled + - fulfilled + - partially_shipped + - shipped + - partially_returned + - returned + - canceled + - requires_action + default: not_fulfilled + claim_items: + description: The items that have been claimed + type: array + items: + $ref: ./claim_item.yaml + additional_items: + description: >- + Refers to the new items to be shipped when the claim order has the type + `replace` + type: array + items: + $ref: ./line_item.yaml + order_id: + description: The ID of the order that the claim comes from. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + return_order: + description: >- + A return object. Holds information about the return if the claim is to be + returned. Available if the relation 'return_order' is expanded + type: object + shipping_address_id: + description: The ID of the address that the new items should be shipped to + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + shipping_methods: + description: The shipping methods that the claim order will be shipped with. + type: array + items: + $ref: ./shipping_method.yaml + fulfillments: + description: The fulfillments of the new items to be shipped + type: array + items: + $ref: ./fulfillment.yaml + refund_amount: + description: The amount that will be refunded in conjunction with the claim + type: integer + example: 1000 + canceled_at: + description: The date with timezone at which the claim was canceled. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + no_notification: + description: >- + Flag for describing whether or not notifications related to this should be + send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the claim in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. diff --git a/docs/api/admin/components/schemas/claim_tag.yaml b/docs/api/admin/components/schemas/claim_tag.yaml new file mode 100644 index 0000000000..bf7b96a3db --- /dev/null +++ b/docs/api/admin/components/schemas/claim_tag.yaml @@ -0,0 +1,33 @@ +title: Claim Tag +description: >- + Claim Tags are user defined tags that can be assigned to claim items for easy + filtering and grouping. +x-resourceId: claim_tag +required: + - value +properties: + id: + type: string + description: The claim tag's ID + example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 + value: + description: The value that the claim tag holds + type: string + example: Damaged + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/country.yaml b/docs/api/admin/components/schemas/country.yaml new file mode 100644 index 0000000000..8bd271c77c --- /dev/null +++ b/docs/api/admin/components/schemas/country.yaml @@ -0,0 +1,53 @@ +title: Country +description: Country details +x-resourceId: country +required: + - iso_2 + - iso_3 + - num_code + - name + - display_name +properties: + id: + type: string + description: The country's ID + example: 109 + iso_2: + type: string + description: The 2 character ISO code of the country in lower case + example: it + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + iso_3: + type: string + description: The 2 character ISO code of the country in lower case + example: ita + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements + description: See a list of codes. + num_code: + description: The numerical ISO code for the country. + type: string + example: 380 + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements + description: See a list of codes. + name: + description: The normalized country name in upper case. + type: string + example: ITALY + display_name: + description: The country name appropriate for display. + type: string + example: Italy + region_id: + type: string + description: The region ID this country is associated with. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object diff --git a/docs/api/admin/components/schemas/currency.yaml b/docs/api/admin/components/schemas/currency.yaml new file mode 100644 index 0000000000..aecf3200e2 --- /dev/null +++ b/docs/api/admin/components/schemas/currency.yaml @@ -0,0 +1,28 @@ +title: Currency +description: Currency +x-resourceId: currency +required: + - code + - symbol + - symbol_native + - name +properties: + code: + description: The 3 character ISO code for the currency. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + symbol: + description: The symbol used to indicate the currency. + type: string + example: $ + symbol_native: + description: The native symbol used to indicate the currency. + type: string + example: $ + name: + description: The written name of the currency + type: string + example: US Dollar diff --git a/docs/api/admin/components/schemas/custom_shipping_option.yaml b/docs/api/admin/components/schemas/custom_shipping_option.yaml new file mode 100644 index 0000000000..488258a5cb --- /dev/null +++ b/docs/api/admin/components/schemas/custom_shipping_option.yaml @@ -0,0 +1,53 @@ +title: Custom Shipping Option +description: >- + Custom Shipping Options are 'overriden' Shipping Options. Store managers can + attach a Custom Shipping Option to a cart in order to set a custom price for a + particular Shipping Option +x-resourceId: custom_shipping_option +required: + - price + - shipping_option_id +properties: + id: + type: string + description: The custom shipping option's ID + example: cso_01G8X99XNB77DMFBJFWX6DN9V9 + price: + description: >- + The custom price set that will override the shipping option's original + price + type: integer + example: 1000 + shipping_option_id: + description: The ID of the Shipping Option that the custom shipping option overrides + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: >- + A shipping option object. Available if the relation `shipping_option` is + expanded. + type: object + cart_id: + description: The ID of the Cart that the custom shipping option is attached to + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/customer.yaml b/docs/api/admin/components/schemas/customer.yaml new file mode 100644 index 0000000000..e3df6d690b --- /dev/null +++ b/docs/api/admin/components/schemas/customer.yaml @@ -0,0 +1,72 @@ +title: Customer +description: Represents a customer +x-resourceId: customer +required: + - email +properties: + id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + email: + type: string + description: The customer's email + format: email + first_name: + type: string + description: The customer's first name + example: Arno + last_name: + type: string + description: The customer's first name + example: Willms + billing_address_id: + type: string + description: The customer's billing address ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: ./address.yaml + shipping_addresses: + description: Available if the relation `shipping_addresses` is expanded. + type: array + items: + $ref: ./address.yaml + phone: + type: string + description: The customer's phone number + example: 16128234334802 + has_account: + type: boolean + description: Whether the customer has an account or not + default: false + orders: + description: Available if the relation `orders` is expanded. + type: array + items: + type: object + description: An order object. + groups: + description: >- + The customer groups the customer belongs to. Available if the relation + `groups` is expanded. + type: array + items: + $ref: ./customer_group.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/customer_group.yaml b/docs/api/admin/components/schemas/customer_group.yaml new file mode 100644 index 0000000000..d99e3a5923 --- /dev/null +++ b/docs/api/admin/components/schemas/customer_group.yaml @@ -0,0 +1,46 @@ +title: Customer Group +description: Represents a customer group +x-resourceId: customer_group +required: + - name +properties: + id: + type: string + description: The customer group's ID + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + name: + type: string + description: The name of the customer group + example: VIP + customers: + type: array + description: >- + The customers that belong to the customer group. Available if the relation + `customers` is expanded. + items: + type: object + description: A customer object. + price_lists: + type: array + description: >- + The price lists that are associated with the customer group. Available if + the relation `price_lists` is expanded. + items: + $ref: ./price_list.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount.yaml b/docs/api/admin/components/schemas/discount.yaml new file mode 100644 index 0000000000..48f090532a --- /dev/null +++ b/docs/api/admin/components/schemas/discount.yaml @@ -0,0 +1,91 @@ +title: Discount +description: Represents a discount that can be applied to a cart for promotional purposes. +x-resourceId: discount +required: + - code + - is_dynamic +properties: + id: + type: string + description: The discount's ID + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + code: + description: >- + A unique code for the discount - this will be used by the customer to + apply the discount + type: string + example: 10DISC + is_dynamic: + description: >- + A flag to indicate if multiple instances of the discount can be generated. + I.e. for newsletter discounts + type: boolean + example: false + rule_id: + type: string + description: The Discount Rule that governs the behaviour of the Discount + example: dru_01F0YESMVK96HVX7N419E3CJ7C + rule: + description: Available if the relation `rule` is expanded. + $ref: ./discount_rule.yaml + is_disabled: + description: >- + Whether the Discount has been disabled. Disabled discounts cannot be + applied to carts + type: boolean + example: false + parent_discount_id: + type: string + description: >- + The Discount that the discount was created from. This will always be a + dynamic discount + example: disc_01G8ZH853YPY9B94857DY91YGW + parent_discount: + description: Available if the relation `parent_discount` is expanded. + $ref: ./discount.yaml + starts_at: + description: The time at which the discount can be used. + type: string + format: date-time + ends_at: + description: The time at which the discount can no longer be used. + type: string + format: date-time + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + regions: + description: >- + The Regions in which the Discount can be used. Available if the relation + `regions` is expanded. + type: array + items: + type: object + description: A region object. + usage_limit: + description: The maximum number of times that a discount can be used. + type: integer + example: 100 + usage_count: + description: The number of times a discount has been used. + type: integer + example: 50 + default: 0 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_condition.yaml b/docs/api/admin/components/schemas/discount_condition.yaml new file mode 100644 index 0000000000..57a0dea0b9 --- /dev/null +++ b/docs/api/admin/components/schemas/discount_condition.yaml @@ -0,0 +1,92 @@ +title: Discount Condition +description: Holds rule conditions for when a discount is applicable +x-resourceId: discount_condition +required: + - type + - operator + - discount_rule_id +properties: + id: + type: string + description: The discount condition's ID + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: The type of the Condition + type: string + enum: + - products + - product_types + - product_collections + - product_tags + - customer_groups + operator: + description: The operator of the Condition + type: string + enum: + - in + - not_in + discount_rule_id: + type: string + description: The ID of the discount rule associated with the condition + example: dru_01F0YESMVK96HVX7N419E3CJ7C + discount_rule: + description: Available if the relation `discount_rule` is expanded. + $ref: ./discount_rule.yaml + products: + description: >- + products associated with this condition if type = products. Available if + the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + product_types: + description: >- + product types associated with this condition if type = product_types. + Available if the relation `product_types` is expanded. + type: array + items: + type: object + description: A product type object. + product_tags: + description: >- + product tags associated with this condition if type = product_tags. + Available if the relation `product_tags` is expanded. + type: array + items: + type: object + description: A product tag object. + product_collections: + description: >- + product collections associated with this condition if type = + product_collections. Available if the relation `product_collections` is + expanded. + type: array + items: + type: object + description: A product collection object. + customer_groups: + description: >- + customer groups associated with this condition if type = customer_groups. + Available if the relation `customer_groups` is expanded. + type: array + items: + type: object + description: A customer group object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_condition_customer_group.yaml b/docs/api/admin/components/schemas/discount_condition_customer_group.yaml new file mode 100644 index 0000000000..ad6527d260 --- /dev/null +++ b/docs/api/admin/components/schemas/discount_condition_customer_group.yaml @@ -0,0 +1,34 @@ +title: Product Tag Discount Condition +description: Associates a discount condition with a customer group +x-resourceId: discount_condition_customer_group +required: + - customer_group_id + - condition_id +properties: + customer_group_id: + description: The ID of the Product Tag + type: string + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + customer_group: + description: Available if the relation `customer_group` is expanded. + $ref: ./customer_group.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_condition_product.yaml b/docs/api/admin/components/schemas/discount_condition_product.yaml new file mode 100644 index 0000000000..77f4fa6b9e --- /dev/null +++ b/docs/api/admin/components/schemas/discount_condition_product.yaml @@ -0,0 +1,34 @@ +title: Product Discount Condition +description: Associates a discount condition with a product +x-resourceId: discount_condition_product +required: + - product_id + - condition_id +properties: + product_id: + description: The ID of the Product Tag + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product: + description: Available if the relation `product` is expanded. + $ref: ./product.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_condition_product_collection.yaml b/docs/api/admin/components/schemas/discount_condition_product_collection.yaml new file mode 100644 index 0000000000..43c7548e34 --- /dev/null +++ b/docs/api/admin/components/schemas/discount_condition_product_collection.yaml @@ -0,0 +1,34 @@ +title: Product Collection Discount Condition +description: Associates a discount condition with a product collection +x-resourceId: discount_condition_product_collection +required: + - product_collection_id + - condition_id +properties: + product_collection_id: + description: The ID of the Product Collection + type: string + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_collection: + description: Available if the relation `product_collection` is expanded. + $ref: ./product_collection.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_condition_product_tag.yaml b/docs/api/admin/components/schemas/discount_condition_product_tag.yaml new file mode 100644 index 0000000000..ed3a8b2e79 --- /dev/null +++ b/docs/api/admin/components/schemas/discount_condition_product_tag.yaml @@ -0,0 +1,34 @@ +title: Product Tag Discount Condition +description: Associates a discount condition with a product tag +x-resourceId: discount_condition_product_tag +required: + - product_tag_id + - condition_id +properties: + product_tag_id: + description: The ID of the Product Tag + type: string + example: ptag_01F0YESHPZYY3H4SJ3A5918SBN + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_tag: + description: Available if the relation `product_tag` is expanded. + $ref: ./product_tag.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_condition_product_type.yaml b/docs/api/admin/components/schemas/discount_condition_product_type.yaml new file mode 100644 index 0000000000..3125b2119c --- /dev/null +++ b/docs/api/admin/components/schemas/discount_condition_product_type.yaml @@ -0,0 +1,34 @@ +title: Product Type Discount Condition +description: Associates a discount condition with a product type +x-resourceId: discount_condition_product +required: + - product_type_id + - condition_id +properties: + product_type_id: + description: The ID of the Product Tag + type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: ./product_type.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/discount_rule.yaml b/docs/api/admin/components/schemas/discount_rule.yaml new file mode 100644 index 0000000000..328171368f --- /dev/null +++ b/docs/api/admin/components/schemas/discount_rule.yaml @@ -0,0 +1,66 @@ +title: Discount Rule +description: >- + Holds the rules that governs how a Discount is calculated when applied to a + Cart. +x-resourceId: discount_rule +required: + - type + - value +properties: + id: + type: string + description: The discount rule's ID + example: dru_01F0YESMVK96HVX7N419E3CJ7C + type: + description: >- + The type of the Discount, can be `fixed` for discounts that reduce the + price by a fixed amount, `percentage` for percentage reductions or + `free_shipping` for shipping vouchers. + type: string + enum: + - fixed + - percentage + - free_shipping + example: percentage + description: + description: A short description of the discount + type: string + example: 10 Percent + value: + description: >- + The value that the discount represents; this will depend on the type of + the discount + type: integer + example: 10 + allocation: + description: The scope that the discount should apply to. + type: string + enum: + - total + - item + example: total + conditions: + description: >- + A set of conditions that can be used to limit when the discount can be + used. Available if the relation `conditions` is expanded. + type: array + items: + type: object + description: A discount condition object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/draft-order.yaml b/docs/api/admin/components/schemas/draft-order.yaml new file mode 100644 index 0000000000..12152dc3e0 --- /dev/null +++ b/docs/api/admin/components/schemas/draft-order.yaml @@ -0,0 +1,71 @@ +title: DraftOrder +description: Represents a draft order +x-resourceId: draft-order +properties: + id: + type: string + description: The draft order's ID + example: dorder_01G8TJFKBG38YYFQ035MSVG03C + status: + type: string + description: The status of the draft order + enum: + - open + - completed + default: open + display_id: + type: string + description: The draft order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the draft order. + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + type: string + description: The ID of the order associated with the draft order. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + canceled_at: + type: string + description: The date the draft order was canceled at. + format: date-time + completed_at: + type: string + description: The date the draft order was completed at. + format: date-time + no_notification_order: + type: boolean + description: Whether to send the customer notifications regarding order updates. + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the draft order in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/fulfillment.yaml b/docs/api/admin/components/schemas/fulfillment.yaml new file mode 100644 index 0000000000..0ea09f97e5 --- /dev/null +++ b/docs/api/admin/components/schemas/fulfillment.yaml @@ -0,0 +1,117 @@ +title: Fulfillment +description: >- + Fulfillments are created once store operators can prepare the purchased goods. + Fulfillments will eventually be shipped and hold information about how to + track shipments. Fulfillments are created through a provider, which is + typically an external shipping aggregator, shipping partner og 3PL, most + plugins will have asynchronous communications with these providers through + webhooks in order to automatically update and synchronize the state of + Fulfillments. +x-resourceId: fulfillment +required: + - provider_id +properties: + id: + type: string + description: The cart's ID + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + claim_order_id: + description: The id of the Claim that the Fulfillment belongs to. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Fulfillment belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The id of the Order that the Fulfillment belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + provider_id: + description: >- + The id of the Fulfillment Provider responsible for handling the + fulfillment + type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: ./fulfillment_provider.yaml + items: + description: >- + The Fulfillment Items in the Fulfillment - these hold information about + how many of each Line Item has been fulfilled. Available if the relation + `items` is expanded. + type: array + items: + $ref: ./fulfillment_item.yaml + tracking_links: + description: >- + The Tracking Links that can be used to track the status of the + Fulfillment, these will usually be provided by the Fulfillment Provider. + Available if the relation `tracking_links` is expanded. + type: array + items: + $ref: ./tracking_link.yaml + tracking_numbers: + deprecated: true + description: >- + The tracking numbers that can be used to track the status of the + fulfillment. + type: array + items: + type: string + data: + description: >- + This contains all the data necessary for the Fulfillment provider to + handle the fulfillment. + type: object + example: {} + shipped_at: + description: The date with timezone at which the Fulfillment was shipped. + type: string + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this should be + send. + type: boolean + example: false + canceled_at: + description: The date with timezone at which the Fulfillment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the fulfillment + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/fulfillment_item.yaml b/docs/api/admin/components/schemas/fulfillment_item.yaml new file mode 100644 index 0000000000..29fe0f87b9 --- /dev/null +++ b/docs/api/admin/components/schemas/fulfillment_item.yaml @@ -0,0 +1,28 @@ +title: Fulfillment Item +description: >- + Correlates a Line Item with a Fulfillment, keeping track of the quantity of + the Line Item. +x-resourceId: fulfillment_item +required: + - fulfillment_id + - item_id + - quantity +properties: + fulfillment_id: + description: The id of the Fulfillment that the Fulfillment Item belongs to. + type: string + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + item_id: + description: The id of the Line Item that the Fulfillment Item references. + type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + fulfillment: + description: A fulfillment object. Available if the relation `fulfillment` is expanded. + type: object + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + quantity: + description: The quantity of the Line Item that is included in the Fulfillment. + type: integer + example: 1 diff --git a/docs/api/admin/components/schemas/fulfillment_provider.yaml b/docs/api/admin/components/schemas/fulfillment_provider.yaml new file mode 100644 index 0000000000..d6fdd8ce64 --- /dev/null +++ b/docs/api/admin/components/schemas/fulfillment_provider.yaml @@ -0,0 +1,15 @@ +title: Fulfillment Provider +description: Represents a fulfillment provider plugin and holds its installation status. +x-resourceId: fulfillment_provider +properties: + id: + description: The id of the fulfillment provider as given by the plugin. + type: string + example: manual + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + example: true diff --git a/docs/api/admin/components/schemas/gift_card.yaml b/docs/api/admin/components/schemas/gift_card.yaml new file mode 100644 index 0000000000..713a2a39fc --- /dev/null +++ b/docs/api/admin/components/schemas/gift_card.yaml @@ -0,0 +1,70 @@ +title: Gift Card +description: >- + Gift Cards are redeemable and represent a value that can be used towards the + payment of an Order. +x-resourceId: gift_card +required: + - code + - value + - balance + - region_id +properties: + id: + type: string + description: The cart's ID + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ + code: + description: >- + The unique code that identifies the Gift Card. This is used by the + Customer to redeem the value of the Gift Card. + type: string + example: 3RFT-MH2C-Y4YZ-XMN4 + value: + description: The value that the Gift Card represents. + type: integer + example: 10 + balance: + description: The remaining value on the Gift Card. + type: integer + example: 10 + region_id: + type: string + description: The id of the Region in which the Gift Card is available. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + order_id: + type: string + description: The id of the Order that the Gift Card was purchased in. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + is_disabled: + description: >- + Whether the Gift Card has been disabled. Disabled Gift Cards cannot be + applied to carts. + type: boolean + example: false + ends_at: + description: The time at which the Gift Card can no longer be used. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/gift_card_transaction.yaml b/docs/api/admin/components/schemas/gift_card_transaction.yaml new file mode 100644 index 0000000000..0d923b3653 --- /dev/null +++ b/docs/api/admin/components/schemas/gift_card_transaction.yaml @@ -0,0 +1,43 @@ +title: Gift Card Transaction +description: >- + Gift Card Transactions are created once a Customer uses a Gift Card to pay for + their Order +x-resourceId: gift_card_transaction +required: + - gift_card_id + - amount +properties: + id: + type: string + description: The gift card transaction's ID + example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A + gift_card_id: + description: The ID of the Gift Card that was used in the transaction. + type: string + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ + gift_card: + description: A gift card object. Available if the relation `gift_card` is expanded. + type: object + order_id: + description: The ID of the Order that the Gift Card was used to pay for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + amount: + description: The amount that was used from the Gift Card. + type: integer + example: 10 + created_at: + description: The date with timezone at which the resource was created. + type: string + format: date-time + is_taxable: + description: Whether the transaction is taxable or not. + type: boolean + example: false + tax_rate: + description: The tax rate of the transaction + type: number + example: 0 diff --git a/docs/api/admin/components/schemas/idempotency_key.yaml b/docs/api/admin/components/schemas/idempotency_key.yaml new file mode 100644 index 0000000000..ac4f6b63b7 --- /dev/null +++ b/docs/api/admin/components/schemas/idempotency_key.yaml @@ -0,0 +1,55 @@ +title: Idempotency Key +description: >- + Idempotency Key is used to continue a process in case of any failure that + might occur. +x-resourceId: idempotency_key +required: + - idempotency_key +properties: + id: + type: string + description: The idempotency key's ID + example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A + idempotency_key: + description: >- + The unique randomly generated key used to determine the state of a + process. + type: string + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + locked_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + request_method: + description: The method of the request + type: string + example: POST + request_params: + type: object + description: The parameters passed to the request + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + request_path: + description: The request's path + type: string + example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + response_code: + type: string + description: The response's code. + example: 200 + response_body: + type: object + description: The response's body + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + recovery_point: + type: string + description: Where to continue from. + default: started diff --git a/docs/api/admin/components/schemas/image.yaml b/docs/api/admin/components/schemas/image.yaml new file mode 100644 index 0000000000..24bf973e75 --- /dev/null +++ b/docs/api/admin/components/schemas/image.yaml @@ -0,0 +1,31 @@ +title: Image +description: Images holds a reference to a URL at which the image file can be found. +x-resourceId: image +required: + - url +properties: + id: + type: string + description: The image's ID + example: img_01G749BFYR6T8JTVW6SGW3K3E6 + url: + description: The URL at which the image file can be found. + type: string + format: uri + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/invite.yaml b/docs/api/admin/components/schemas/invite.yaml new file mode 100644 index 0000000000..492a71eeb2 --- /dev/null +++ b/docs/api/admin/components/schemas/invite.yaml @@ -0,0 +1,50 @@ +title: Invite +description: Represents an invite +x-resourceId: invite +required: + - user_email +properties: + id: + type: string + description: The invite's ID + example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 + user_email: + type: string + description: The email of the user being invited. + format: email + role: + type: string + description: The user's role. + enum: + - admin + - member + - developer + default: member + accepted: + type: boolean + description: Whether the invite was accepted or not. + example: false + token: + type: string + description: The token used to accept the invite. + expores_at: + type: string + description: The date the invite expires at. + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/line_item.yaml b/docs/api/admin/components/schemas/line_item.yaml new file mode 100644 index 0000000000..d949a50d95 --- /dev/null +++ b/docs/api/admin/components/schemas/line_item.yaml @@ -0,0 +1,172 @@ +title: Line Item +description: >- + Line Items represent purchasable units that can be added to a Cart for + checkout. When Line Items are purchased they will get copied to the resulting + order and can eventually be referenced in Fulfillments and Returns. Line Items + may also be created when processing Swaps and Claims. +x-resourceId: line_item +required: + - title + - unit_price + - quantity +properties: + id: + type: string + description: The cart's ID + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + cart_id: + description: The ID of the Cart that the Line Item belongs to. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Line Item belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Line Item belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Line Item belongs to. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + tax_lines: + description: Available if the relation `tax_lines` is expanded. + type: array + items: + $ref: ./line_item_tax_line.yaml + adjustments: + description: Available if the relation `adjustments` is expanded. + type: array + items: + $ref: ./line_item_adjustment.yaml + title: + description: >- + The title of the Line Item, this should be easily identifiable by the + Customer. + type: string + example: Medusa Coffee Mug + description: + description: A more detailed description of the contents of the Line Item. + type: string + example: One Size + thumbnail: + description: A URL string to a small image of the contents of the Line Item. + type: string + format: uri + example: https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png + is_return: + description: Is the item being returned + type: boolean + example: false + is_giftcard: + description: Flag to indicate if the Line Item is a Gift Card. + type: boolean + example: false + should_merge: + description: >- + Flag to indicate if new Line Items with the same variant should be merged + or added as an additional Line Item. + type: boolean + example: false + allow_discounts: + description: >- + Flag to indicate if the Line Item should be included when doing discount + calculations. + type: boolean + example: false + has_shipping: + description: Flag to indicate if the Line Item has fulfillment associated with it. + type: boolean + example: false + unit_price: + description: >- + The price of one unit of the content in the Line Item. This should be in + the currency defined by the Cart/Order/Swap/Claim that the Line Item + belongs to. + type: boolean + example: 8000 + variant_id: + description: The id of the Product Variant contained in the Line Item. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + A product variant object. The Product Variant contained in the Line Item. + Available if the relation `variant` is expanded. + type: object + quantity: + description: The quantity of the content in the Line Item. + type: integer + example: 1 + fulfilled_quantity: + description: The quantity of the Line Item that has been fulfilled. + type: integer + example: 0 + returned_quantity: + description: The quantity of the Line Item that has been returned. + type: integer + example: 0 + shipped_quantity: + description: The quantity of the Line Item that has been shipped. + type: integer + example: 0 + refundable: + description: >- + The amount that can be refunded from the given Line Item. Takes taxes and + discounts into consideration. + type: integer + example: 0 + subtotal: + type: integer + description: The subtotal of the line item + example: 8000 + tax_total: + type: integer + description: The total of tax of the line item + example: 0 + total: + type: integer + description: The total amount of the line item + example: 8000 + original_total: + type: integer + description: The original total amount of the line item + example: 8000 + original_tax_total: + type: integer + description: The original tax total amount of the line item + example: 0 + discount_total: + type: integer + description: The total of discount of the line item + example: 0 + gift_card_total: + type: integer + description: The total of the gift card of the line item + example: 0 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/line_item_adjustment.yaml b/docs/api/admin/components/schemas/line_item_adjustment.yaml new file mode 100644 index 0000000000..8ae889c8dc --- /dev/null +++ b/docs/api/admin/components/schemas/line_item_adjustment.yaml @@ -0,0 +1,39 @@ +title: Line Item Adjustment +description: Represents an Line Item Adjustment +x-resourceId: line_item_adjustment +required: + - item_id + - description + - amount +properties: + id: + type: string + description: The invite's ID + example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + description: + type: string + description: The line item's adjustment description + example: Adjusted item's price. + discount_id: + type: string + description: The ID of the discount associated with the adjustment + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + discount: + description: Available if the relation `discount` is expanded. + $ref: ./discount.yaml + amount: + type: number + description: The adjustment amount + example: 1000 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/line_item_tax_line.yaml b/docs/api/admin/components/schemas/line_item_tax_line.yaml new file mode 100644 index 0000000000..9320de67e3 --- /dev/null +++ b/docs/api/admin/components/schemas/line_item_tax_line.yaml @@ -0,0 +1,44 @@ +title: Line Item Tax Line +description: Represents an Line Item Tax Line +x-resourceId: line_item_tax_line +required: + - item_id + - rate + - name +properties: + id: + type: string + description: The line item tax line's ID + example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/money_amount.yaml b/docs/api/admin/components/schemas/money_amount.yaml new file mode 100644 index 0000000000..f54d7e4a7a --- /dev/null +++ b/docs/api/admin/components/schemas/money_amount.yaml @@ -0,0 +1,84 @@ +title: Money Amount +description: >- + Money Amounts represents an amount that a given Product Variant can be + purcased for. Each Money Amount either has a Currency or Region associated + with it to indicate the pricing in a given Currency or, for fully region-based + pricing, the given price in a specific Region. If region-based pricing is used + the amount will be in the currency defined for the Reigon. +x-resourceId: money_amount +required: + - currency_code + - amount +properties: + id: + type: string + description: The money amount's ID + example: ma_01F0YESHRFQNH5S8Q0PK84YYZN + currency_code: + description: The 3 character currency code that the Money Amount is given in. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + amount: + description: >- + The amount in the smallest currecny unit (e.g. cents 100 cents to charge + $1) that the Product Variant will cost. + type: integer + example: 100 + min_quantity: + description: >- + The minimum quantity that the Money Amount applies to. If this value is + not set, the Money Amount applies to all quantities. + type: integer + example: 1 + max_quantity: + description: >- + The maximum quantity that the Money Amount applies to. If this value is + not set, the Money Amount applies to all quantities. + type: integer + example: 1 + price_list_id: + type: string + description: The ID of the price list associated with the money amount + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + price_list: + description: Available if the relation `price_list` is expanded. + $ref: ./price_list.yaml + variant_id: + description: The id of the Product Variant contained in the Line Item. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + The Product Variant contained in the Line Item. Available if the relation + `variant` is expanded. + type: object + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/note.yaml b/docs/api/admin/components/schemas/note.yaml new file mode 100644 index 0000000000..9333e49472 --- /dev/null +++ b/docs/api/admin/components/schemas/note.yaml @@ -0,0 +1,50 @@ +title: Note +description: >- + Notes are elements which we can use in association with different resources to + allow users to describe additional information in relation to these. +x-resourceId: note +required: + - value + - resource_type + - resource_id +properties: + id: + type: string + description: The note's ID + example: note_01G8TM8ENBMC7R90XRR1G6H26Q + resource_type: + description: The type of resource that the Note refers to. + type: string + example: order + resource_id: + description: The ID of the resource that the Note refers to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + value: + description: The contents of the note. + type: string + example: This order must be fulfilled on Monday + author_id: + type: string + description: The ID of the author (user) + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + author: + description: Available if the relation `author` is expanded. + $ref: ./user.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/notification.yaml b/docs/api/admin/components/schemas/notification.yaml new file mode 100644 index 0000000000..559d58d79a --- /dev/null +++ b/docs/api/admin/components/schemas/notification.yaml @@ -0,0 +1,67 @@ +title: Notification +description: >- + Notifications a communications sent via Notification Providers as a reaction + to internal events such as `order.placed`. Notifications can be used to show a + chronological timeline for communications sent to a Customer regarding an + Order, and enables resends. +x-resourceId: notification +required: + - resource_type + - resource_id + - to +properties: + id: + type: string + description: The notification's ID + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + event_name: + description: The name of the event that the notification was sent for. + type: string + example: order.placed + resource_type: + description: The type of resource that the Notification refers to. + type: string + example: order + resource_id: + description: The ID of the resource that the Notification refers to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + customer_id: + description: The ID of the Customer that the Notification was sent to. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + to: + description: >- + 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 + type: string + example: user@example.com + data: + description: >- + The data that the Notification was sent with. This contains all the data + necessary for the Notification Provider to initiate a resend. + type: object + example: {} + resends: + description: The resends that have been completed after the original Notification. + type: array + items: + $ref: ./notification_resend.yaml + provider_id: + description: The id of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: ./notification_provider.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time diff --git a/docs/api/admin/components/schemas/notification_provider.yaml b/docs/api/admin/components/schemas/notification_provider.yaml new file mode 100644 index 0000000000..6ac490109f --- /dev/null +++ b/docs/api/admin/components/schemas/notification_provider.yaml @@ -0,0 +1,17 @@ +title: Notification Provider +description: Represents a notification provider plugin and holds its installation status. +x-resourceId: notification_provider +required: + - id +properties: + id: + description: The id of the notification provider as given by the plugin. + type: string + example: sendgrid + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + default: true diff --git a/docs/api/admin/components/schemas/notification_resend.yaml b/docs/api/admin/components/schemas/notification_resend.yaml new file mode 100644 index 0000000000..c5cfe4431f --- /dev/null +++ b/docs/api/admin/components/schemas/notification_resend.yaml @@ -0,0 +1,61 @@ +title: Notification Resend +description: A resend of a Notification. +x-resourceId: notification_resend +properties: + id: + description: The notification resend's ID + type: string + example: noti_01F0YET45G9NHP08Z66CE4QKBS + event_name: + description: The name of the event that the notification was sent for. + type: string + example: order.placed + resource_type: + description: The type of resource that the Notification refers to. + type: string + example: order + resource_id: + description: The ID of the resource that the Notification refers to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + customer_id: + description: The ID of the Customer that the Notification was sent to. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + to: + description: >- + 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 + type: string + example: user@example.com + data: + description: >- + The data that the Notification was sent with. This contains all the data + necessary for the Notification Provider to initiate a resend. + type: object + example: {} + parent_id: + description: The ID of the Notification that was originally sent. + type: string + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + parent_notification: + description: Available if the relation `parent_notification` is expanded. + $ref: ./notification.yaml + provider_id: + description: The ID of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: ./notification_provider.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time diff --git a/docs/api/admin/components/schemas/order.yaml b/docs/api/admin/components/schemas/order.yaml new file mode 100644 index 0000000000..45e495fab3 --- /dev/null +++ b/docs/api/admin/components/schemas/order.yaml @@ -0,0 +1,268 @@ +title: Order +description: Represents an order +x-resourceId: order +required: + - customer_id + - email + - region_id + - currency_code +properties: + id: + type: string + description: The order's ID + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + status: + type: string + description: The order's status + enum: + - pending + - completed + - archived + - canceled + - requires_action + default: pending + fulfillment_status: + type: string + description: The order's fulfillment status + enum: + - not_fulfilled + - partially_fulfilled + - fulfilled + - partially_shipped + - shipped + - partially_returned + - returned + - canceled + - requires_action + default: not_fulfilled + payment_status: + type: string + description: The order's payment status + enum: + - not_paid + - awaiting + - captured + - partially_refunded + - refuneded + - canceled + - requires_action + default: not_paid + display_id: + type: integer + description: The order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the order + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + customer_id: + type: string + description: The ID of the customer associated with the order + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + email: + description: The email associated with the order + type: string + format: email + billing_address_id: + type: string + description: The ID of the billing address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: ./address.yaml + shipping_address_id: + type: string + description: The ID of the shipping address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + currency_code: + description: The 3 character currency code that is used in the order + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + tax_rate: + description: The order's tax rate + type: number + example: 0 + discounts: + type: array + description: >- + The discounts used in the order. Available if the relation `discounts` is + expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: >- + The gift cards used in the order. Available if the relation `gift_cards` + is expanded. + items: + type: object + description: A gift card object. + shipping_methods: + type: array + description: >- + The shipping methods used in the order. Available if the relation + `shipping_methods` is expanded. + items: + $ref: ./shipping_method.yaml + payments: + type: array + description: >- + The payments used in the order. Available if the relation `payments` is + expanded. + items: + $ref: ./payment.yaml + fulfillments: + type: array + description: >- + The fulfillments used in the order. Available if the relation + `fulfillments` is expanded. + items: + $ref: ./fulfillment.yaml + returns: + type: array + description: >- + The returns associated with the order. Available if the relation `returns` + is expanded. + items: + type: object + description: A return object. + claims: + type: array + description: >- + The claims associated with the order. Available if the relation `claims` + is expanded. + items: + type: object + description: A claim order object. + refunds: + type: array + description: >- + The refunds associated with the order. Available if the relation `refunds` + is expanded. + items: + type: object + description: A refund object. + swaps: + type: array + description: >- + The swaps associated with the order. Available if the relation `swaps` is + expanded. + items: + type: object + description: A swap object. + draft_order_id: + type: string + description: The ID of the draft order this order is associated with. + example: null + draft_order: + description: A draft order object. Available if the relation `draft_order` is expanded. + type: object + items: + type: array + description: >- + The line items that belong to the order. Available if the relation `items` + is expanded. + items: + $ref: ./line_item.yaml + gift_card_transactions: + type: array + description: >- + The gift card transactions used in the order. Available if the relation + `gift_card_transactions` is expanded. + items: + $ref: ./gift_card_transaction.yaml + canceled_at: + type: string + description: The date the order was canceled on. + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this should be + send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the processing of the order in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + external_id: + description: The ID of an external order. + type: string + example: null + sales_channel_id: + type: string + description: The ID of the sales channel this order is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: The total amount refunded if the order is returned. + example: 0 + total: + type: integer + description: The total amount of the order + example: 8200 + subtotal: + type: integer + description: The subtotal of the order + example: 8000 + paid_total: + type: integer + description: The total amount paid + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 diff --git a/docs/api/admin/components/schemas/payment.yaml b/docs/api/admin/components/schemas/payment.yaml new file mode 100644 index 0000000000..92294bd2e6 --- /dev/null +++ b/docs/api/admin/components/schemas/payment.yaml @@ -0,0 +1,96 @@ +title: Payment +description: >- + Payments represent an amount authorized with a given payment method, Payments + can be captured, canceled or refunded. +x-resourceId: payment +required: + - amount + - currency_code + - provider_id +properties: + id: + type: string + description: The payment's ID + example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE + swap_id: + description: The ID of the Swap that the Payment is used for. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Payment is used for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + amount: + description: The amount that the Payment has been authorized for. + type: integer + example: 100 + currency_code: + description: The 3 character ISO currency code that the Payment is completed in. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + amount_refunded: + description: >- + The amount of the original Payment amount that has been refunded back to + the Customer. + type: integer + example: 0 + provider_id: + description: The id of the Payment Provider that is responsible for the Payment + type: string + example: manual + data: + description: >- + The data required for the Payment Provider to identify, modify and process + the Payment. Typically this will be an object that holds an id to the + external payment session, but can be an empty object if the Payment + Provider doesn't hold any state. + type: object + example: {} + captured_at: + description: The date with timezone at which the Payment was captured. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Payment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a payment in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/payment_provider.yaml b/docs/api/admin/components/schemas/payment_provider.yaml new file mode 100644 index 0000000000..7f39ed6355 --- /dev/null +++ b/docs/api/admin/components/schemas/payment_provider.yaml @@ -0,0 +1,17 @@ +title: Payment Provider +description: Represents a Payment Provider plugin and holds its installation status. +x-resourceId: payment_provider +required: + - id +properties: + id: + description: The id of the payment provider as given by the plugin. + type: string + example: manual + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + default: true diff --git a/docs/api/admin/components/schemas/payment_session.yaml b/docs/api/admin/components/schemas/payment_session.yaml new file mode 100644 index 0000000000..c9f52a749b --- /dev/null +++ b/docs/api/admin/components/schemas/payment_session.yaml @@ -0,0 +1,74 @@ +title: Payment Session +description: >- + Payment Sessions are created when a Customer initilizes the checkout flow, and + can be used to hold the state of a payment flow. Each Payment Session is + controlled by a Payment Provider, who is responsible for the communication + with external payment services. Authorized Payment Sessions will eventually + get promoted to Payments to indicate that they are authorized for + capture/refunds/etc. +x-resourceId: payment_session +required: + - cart_id + - provider_id + - status +properties: + id: + type: string + description: The payment session's ID + example: ps_01G901XNSRM2YS3ASN9H5KG3FZ + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + provider_id: + description: The id of the Payment Provider that is responsible for the Payment Session + type: string + example: manual + is_selected: + description: >- + A flag to indicate if the Payment Session has been selected as the method + that will be used to complete the purchase. + type: boolean + example: true + status: + description: >- + Indicates the status of the Payment Session. Will default to `pending`, + and will eventually become `authorized`. Payment Sessions may have the + status of `requires_more` to indicate that further actions are to be + completed by the Customer. + type: string + enum: + - authorized + - pending + - requires_more + - error + - canceled + example: pending + data: + description: >- + The data required for the Payment Provider to identify, modify and process + the Payment Session. Typically this will be an object that holds an id to + the external payment session, but can be an empty object if the Payment + Provider doesn't hold any state. + type: object + example: {} + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in case + of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time diff --git a/docs/api/admin/components/schemas/price_list.yaml b/docs/api/admin/components/schemas/price_list.yaml new file mode 100644 index 0000000000..a39b820583 --- /dev/null +++ b/docs/api/admin/components/schemas/price_list.yaml @@ -0,0 +1,70 @@ +title: Price List +description: >- + Price Lists represents a set of prices that overrides the default price for + one or more product variants. +x-resourceId: price_list +required: + - name + - description +properties: + id: + type: string + description: The price list's ID + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + name: + type: string + description: The price list's name + example: VIP Prices + description: + type: string + description: The price list's description + example: Prices for VIP customers + type: + description: The type of Price List. This can be one of either `sale` or `override`. + type: string + enum: + - sale + - override + default: sale + status: + description: The status of the Price List + type: string + enum: + - active + - draft + default: draft + starts_at: + description: The date with timezone that the Price List starts being valid. + type: string + format: date-time + ends_at: + description: The date with timezone that the Price List stops being valid. + type: string + format: date-time + customer_groups: + description: >- + The Customer Groups that the Price List applies to. Available if the + relation `customer_groups` is expanded. + type: array + items: + type: object + description: A customer group object. + prices: + description: >- + The Money Amounts that are associated with the Price List. Available if + the relation `prices` is expanded. + type: array + items: + $ref: ./money_amount.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/admin/components/schemas/product.yaml b/docs/api/admin/components/schemas/product.yaml new file mode 100644 index 0000000000..41bf53f444 --- /dev/null +++ b/docs/api/admin/components/schemas/product.yaml @@ -0,0 +1,188 @@ +title: Product +description: >- + Products are a grouping of Product Variants that have common properties such + as images and descriptions. Products can have multiple options which define + the properties that Product Variants differ by. +x-resourceId: product +required: + - title + - profile_id +properties: + id: + type: string + description: The product's ID + example: prod_01G1G5V2MBA328390B5AXJ610F + title: + description: A title that can be displayed for easy identification of the Product. + type: string + example: Medusa Coffee Mug + subtitle: + description: An optional subtitle that can be used to further specify the Product. + type: string + description: + description: A short description of the Product. + type: string + example: Every programmer's best friend. + handle: + description: A unique identifier for the Product (e.g. for slug structure). + type: string + example: coffee-mug + is_giftcard: + description: >- + Whether the Product represents a Gift Card. Products that represent Gift + Cards will automatically generate a redeemable Gift Card code once they + are purchased. + type: boolean + default: false + status: + description: The status of the product + type: string + enum: + - draft + - proposed + - published + - rejected + default: draft + images: + description: Images of the Product. Available if the relation `images` is expanded. + type: array + items: + $ref: ./image.yaml + thumbnail: + description: A URL to an image file that can be used to identify the Product. + type: string + format: uri + options: + description: >- + The Product Options that are defined for the Product. Product Variants of + the Product will have a unique combination of Product Option Values. + Available if the relation `options` is expanded. + type: array + items: + $ref: ./product_option.yaml + variants: + description: >- + The Product Variants that belong to the Product. Each will have a unique + combination of Product Option Values. Available if the relation `variants` + is expanded. + type: array + items: + $ref: ./product_variant.yaml + profile_id: + description: >- + The ID of the Shipping Profile that the Product belongs to. Shipping + Profiles have a set of defined Shipping Options that can be used to + Fulfill a given set of Products. + type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: ./shipping_profile.yaml + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + hs_code: + description: >- + The Harmonized System code of the Product Variant. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + origin_country: + description: >- + The country in which the Product Variant was produced. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + mid_code: + description: >- + The Manufacturers Identification code that identifies the manufacturer of + the Product Variant. May be used by Fulfillment Providers to pass customs + information to shipping carriers. + type: string + example: null + material: + description: >- + The material and composition that the Product Variant is made of, May be + used by Fulfillment Providers to pass customs information to shipping + carriers. + type: string + example: null + collection_id: + type: string + description: The Product Collection that the Product belongs to + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + collection: + description: >- + A product collection object. Available if the relation `collection` is + expanded. + type: object + type_id: + type: string + description: The Product type that the Product belongs to + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: Available if the relation `type` is expanded. + $ref: ./product_type.yaml + tags: + description: >- + The Product Tags assigned to the Product. Available if the relation `tags` + is expanded. + type: array + items: + $ref: ./product_tag.yaml + discountable: + description: >- + Whether the Product can be discounted. Discounts will not apply to Line + Items of this Product when this flag is set to `false`. + type: boolean + default: true + external_id: + description: The external ID of the product + type: string + example: null + sales_channels: + description: >- + The sales channels the product is associated with. Available if the + relation `sales_channels` is expanded. + type: array + items: + type: object + description: A sales channel object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_collection.yaml b/docs/api/admin/components/schemas/product_collection.yaml new file mode 100644 index 0000000000..711acc6c10 --- /dev/null +++ b/docs/api/admin/components/schemas/product_collection.yaml @@ -0,0 +1,45 @@ +title: Product Collection +description: Product Collections represents a group of Products that are related. +x-resourceId: product_collection +required: + - title +properties: + id: + type: string + description: The product collection's ID + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + title: + description: The title that the Product Collection is identified by. + type: string + example: Summer Collection + handle: + description: >- + A unique string that identifies the Product Collection - can for example + be used in slug structures. + type: string + example: summer-collection + products: + description: >- + The Products contained in the Product Collection. Available if the + relation `products` is expanded. + type: array + items: + type: object + description: A product collection object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_option.yaml b/docs/api/admin/components/schemas/product_option.yaml new file mode 100644 index 0000000000..66fd46f4fd --- /dev/null +++ b/docs/api/admin/components/schemas/product_option.yaml @@ -0,0 +1,49 @@ +title: Product Option +description: >- + Product Options define properties that may vary between different variants of + a Product. Common Product Options are "Size" and "Color", but Medusa doesn't + limit what Product Options that can be defined. +x-resourceId: product_option +required: + - title + - product_id +properties: + id: + type: string + description: The product option's ID + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + title: + description: The title that the Product Option is defined by (e.g. "Size"). + type: string + example: Size + values: + description: >- + The Product Option Values that are defined for the Product Option. + Available if the relation `values` is expanded. + type: array + items: + $ref: ./product_option_value.yaml + product_id: + description: The ID of the Product that the Product Option is defined for. + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_option_value.yaml b/docs/api/admin/components/schemas/product_option_value.yaml new file mode 100644 index 0000000000..3b8606ea53 --- /dev/null +++ b/docs/api/admin/components/schemas/product_option_value.yaml @@ -0,0 +1,54 @@ +title: Product Option Value +description: >- + A value given to a Product Variant's option set. Product Variant have a + Product Option Value for each of the Product Options defined on the Product. +x-resourceId: product_option_value +required: + - value + - option_id + - variant_id +properties: + id: + type: string + description: The product option value's ID + example: optval_01F0YESHR7S6ECD03RF6W12DSJ + value: + description: >- + The value that the Product Variant has defined for the specific Product + Option (e.g. if the Product Option is "Size" this value could be "Small", + "Medium" or "Large"). + type: string + example: large + option_id: + description: The ID of the Product Option that the Product Option Value is defined for. + type: string + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + option: + description: Available if the relation `option` is expanded. + $ref: ./product_option.yaml + variant_id: + description: >- + The ID of the Product Variant that the Product Option Value is defined + for. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: Available if the relation `variant` is expanded. + $ref: ./product_variant.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_tag.yaml b/docs/api/admin/components/schemas/product_tag.yaml new file mode 100644 index 0000000000..cdfa21d4ad --- /dev/null +++ b/docs/api/admin/components/schemas/product_tag.yaml @@ -0,0 +1,31 @@ +title: Product Tag +description: Product Tags can be added to Products for easy filtering and grouping. +x-resourceId: product_tag +required: + - value +properties: + id: + type: string + description: The product tag's ID + example: ptag_01G8K2MTMG9168F2B70S1TAVK3 + value: + description: The value that the Product Tag represents + type: string + example: Pants + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_tax_rate.yaml b/docs/api/admin/components/schemas/product_tax_rate.yaml new file mode 100644 index 0000000000..f72e8896a8 --- /dev/null +++ b/docs/api/admin/components/schemas/product_tax_rate.yaml @@ -0,0 +1,36 @@ +title: Product Tax Rate +description: >- + Associates a tax rate with a product to indicate that the product is taxed in + a certain way +x-resourceId: product_tax_rate +required: + - product_id + - rate_id +properties: + product_id: + description: The ID of the Product + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: Available if the relation `product` is expanded. + $ref: ./product.yaml + rate_id: + description: The ID of the Tax Rate + type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: ./tax_rate.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_type.yaml b/docs/api/admin/components/schemas/product_type.yaml new file mode 100644 index 0000000000..e2be2bf920 --- /dev/null +++ b/docs/api/admin/components/schemas/product_type.yaml @@ -0,0 +1,31 @@ +title: Product Type +description: Product Type can be added to Products for filtering and reporting purposes. +x-resourceId: product_type +required: + - value +properties: + id: + type: string + description: The product type's ID + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + value: + description: The value that the Product Type represents. + type: string + example: Clothing + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_type_tax_rate.yaml b/docs/api/admin/components/schemas/product_type_tax_rate.yaml new file mode 100644 index 0000000000..5bc7d5c302 --- /dev/null +++ b/docs/api/admin/components/schemas/product_type_tax_rate.yaml @@ -0,0 +1,36 @@ +title: Product Type Tax Rate +description: >- + Associates a tax rate with a product type to indicate that the product type is + taxed in a certain way +x-resourceId: product_type_tax_rate +required: + - product_type_id + - rate_id +properties: + product_type_id: + description: The ID of the Product type + type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: ./product_type.yaml + rate_id: + description: The id of the Tax Rate + type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: ./tax_rate.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/product_variant.yaml b/docs/api/admin/components/schemas/product_variant.yaml new file mode 100644 index 0000000000..aa7386d615 --- /dev/null +++ b/docs/api/admin/components/schemas/product_variant.yaml @@ -0,0 +1,149 @@ +title: Product Variant +description: >- + Product Variants represent a Product with a specific set of Product Option + configurations. The maximum number of Product Variants that a Product can have + is given by the number of available Product Option combinations. +x-resourceId: product_variant +required: + - title + - product_id + - inventory_quantity +properties: + id: + type: string + description: The product variant's ID + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + title: + description: >- + A title that can be displayed for easy identification of the Product + Variant. + type: string + example: Small + product_id: + description: The ID of the Product that the Product Variant belongs to. + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object + prices: + description: >- + The Money Amounts defined for the Product Variant. Each Money Amount + represents a price in a given currency or a price in a specific Region. + Available if the relation `prices` is expanded. + type: array + items: + $ref: ./money_amount.yaml + sku: + description: >- + The unique stock keeping unit used to identify the Product Variant. This + will usually be a unqiue identifer for the item that is to be shipped, and + can be referenced across multiple systems. + type: string + example: shirt-123 + barcode: + description: >- + A generic field for a GTIN number that can be used to identify the Product + Variant. + type: string + example: null + ean: + description: An EAN barcode number that can be used to identify the Product Variant. + type: string + example: null + upc: + description: A UPC barcode number that can be used to identify the Product Variant. + type: string + example: null + variant_rank: + description: The ranking of this variant + type: number + default: 0 + inventory_quantity: + description: The current quantity of the item that is stocked. + type: integer + example: 100 + allow_backorder: + description: >- + Whether the Product Variant should be purchasable when + `inventory_quantity` is 0. + type: boolean + default: false + manage_inventory: + description: Whether Medusa should manage inventory for the Product Variant. + type: boolean + default: true + hs_code: + description: >- + The Harmonized System code of the Product Variant. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + origin_country: + description: >- + The country in which the Product Variant was produced. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + mid_code: + description: >- + The Manufacturers Identification code that identifies the manufacturer of + the Product Variant. May be used by Fulfillment Providers to pass customs + information to shipping carriers. + type: string + example: null + material: + description: >- + The material and composition that the Product Variant is made of, May be + used by Fulfillment Providers to pass customs information to shipping + carriers. + type: string + example: null + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + options: + description: >- + The Product Option Values specified for the Product Variant. Available if + the relation `options` is expanded. + type: array + items: + $ref: ./product_option_value.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/refund.yaml b/docs/api/admin/components/schemas/refund.yaml new file mode 100644 index 0000000000..c1fc4cfc0f --- /dev/null +++ b/docs/api/admin/components/schemas/refund.yaml @@ -0,0 +1,64 @@ +title: Refund +description: >- + Refund represent an amount of money transfered back to the Customer for a + given reason. Refunds may occur in relation to Returns, Swaps and Claims, but + can also be initiated by a store operator. +x-resourceId: refund +required: + - order_id + - amount +properties: + id: + type: string + description: The refund's ID + example: ref_01G1G5V27GYX4QXNARRQCW1N8T + order_id: + description: The id of the Order that the Refund is related to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + amount: + description: The amount that has be refunded to the Customer. + type: integer + example: 1000 + note: + description: An optional note explaining why the amount was refunded. + type: string + example: I didn't like it + reason: + description: >- + The reason given for the Refund, will automatically be set when processed + as part of a Swap, Claim or Return. + type: string + enum: + - discount + - return + - swap + - claim + - other + example: return + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the refund in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/region.yaml b/docs/api/admin/components/schemas/region.yaml new file mode 100644 index 0000000000..877489af02 --- /dev/null +++ b/docs/api/admin/components/schemas/region.yaml @@ -0,0 +1,102 @@ +title: Region +description: >- + Regions hold settings for how Customers in a given geographical location shop. + The is, for example, where currencies and tax rates are defined. A Region can + consist of multiple countries to accomodate common shopping settings across + countries. +x-resourceId: region +required: + - name + - currency_code + - tax_rate +properties: + id: + type: string + description: The cart's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + name: + description: >- + The name of the region as displayed to the customer. If the Region only + has one country it is recommended to write the country name. + type: string + example: EU + currency_code: + description: The 3 character currency code that the Region uses. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + tax_rate: + description: The tax rate that should be charged on purchases in the Region. + type: number + example: 0 + tax_rates: + description: >- + The tax rates that are included in the Region. Available if the relation + `tax_rates` is expanded. + type: array + items: + $ref: ./tax_rate.yaml + tax_code: + description: >- + The tax code used on purchases in the Region. This may be used by other + systems for accounting purposes. + type: string + example: null + gift_cards_taxable: + description: Whether the gift cards are taxable or not in this region. + type: boolean + default: true + automatic_taxes: + description: Whether taxes should be automated in this region. + type: boolean + default: true + countries: + description: >- + The countries that are included in the Region. Available if the relation + `countries` is expanded. + type: array + items: + $ref: ./country.yaml + tax_provider_id: + type: string + description: The ID of the tax provider used in this region + example: null + tax_provider: + description: Available if the relation `tax_provider` is expanded. + $ref: ./tax_provider.yaml + payment_providers: + description: >- + The Payment Providers that can be used to process Payments in the Region. + Available if the relation `payment_providers` is expanded. + type: array + items: + $ref: ./payment_provider.yaml + fulfillment_providers: + description: >- + The Fulfillment Providers that can be used to fulfill orders in the + Region. Available if the relation `payment_providers` is expanded. + type: array + items: + $ref: ./fulfillment_provider.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/return.yaml b/docs/api/admin/components/schemas/return.yaml new file mode 100644 index 0000000000..a475900106 --- /dev/null +++ b/docs/api/admin/components/schemas/return.yaml @@ -0,0 +1,98 @@ +title: Return +description: >- + Return orders hold information about Line Items that a Customer wishes to send + back, along with how the items will be returned. Returns can be used as part + of a Swap. +x-resourceId: return +required: + - refund_amount +properties: + id: + type: string + description: The return's ID + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + status: + description: Status of the Return. + type: string + enum: + - requested + - received + - requires_action + - canceled + default: requested + items: + description: >- + The Return Items that will be shipped back to the warehouse. Available if + the relation `items` is expanded. + type: array + items: + $ref: ./return_item.yaml + swap_id: + description: The ID of the Swap that the Return is a part of. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The ID of the Order that the Return is made from. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + claim_order_id: + description: The ID of the Claim that the Return is a part of. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + shipping_method: + description: >- + The Shipping Method that will be used to send the Return back. Can be null + if the Customer facilitates the return shipment themselves. Available if + the relation `shipping_method` is expanded. + type: array + items: + $ref: ./shipping_method.yaml + shipping_data: + description: >- + Data about the return shipment as provided by the Fulfilment Provider that + handles the return shipment. + type: object + example: {} + refund_amount: + description: The amount that should be refunded as a result of the return. + type: integer + example: 1000 + no_notification: + description: When set to true, no notification will be sent related to this return. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the return in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + received_at: + description: The date with timezone at which the return was received. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/return_item.yaml b/docs/api/admin/components/schemas/return_item.yaml new file mode 100644 index 0000000000..3c45a35003 --- /dev/null +++ b/docs/api/admin/components/schemas/return_item.yaml @@ -0,0 +1,57 @@ +title: Return Item +description: >- + Correlates a Line Item with a Return, keeping track of the quantity of the + Line Item that will be returned. +x-resourceId: return_item +required: + - return_id + - item_id +properties: + return_id: + description: The id of the Return that the Return Item belongs to. + type: string + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + return_order: + description: Available if the relation `return_order` is expanded. + $ref: ./return.yaml + item_id: + description: The id of the Line Item that the Return Item references. + type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + quantity: + description: The quantity of the Line Item that is included in the Return. + type: integer + example: 1 + is_requested: + description: >- + Whether the Return Item was requested initially or received unexpectedly + in the warehouse. + type: boolean + default: true + requested_quantity: + description: The quantity that was originally requested to be returned. + type: integer + example: 1 + recieved_quantity: + description: The quantity that was received in the warehouse. + type: integer + example: 1 + reason_id: + description: The ID of the reason for returning the item. + type: string + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + reason: + description: Available if the relation `reason` is expanded. + $ref: ./return_reason.yaml + note: + description: An optional note with additional details about the Return. + type: string + example: I didn't like it. + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/return_reason.yaml b/docs/api/admin/components/schemas/return_reason.yaml new file mode 100644 index 0000000000..7873cfc3f2 --- /dev/null +++ b/docs/api/admin/components/schemas/return_reason.yaml @@ -0,0 +1,52 @@ +title: Return Reason +description: >- + A Reason for why a given product is returned. A Return Reason can be used on + Return Items in order to indicate why a Line Item was returned. +x-resourceId: return_reason +required: + - value + - label +properties: + id: + type: string + description: The cart's ID + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + description: + description: A description of the Reason. + type: string + example: Items that are damaged + label: + description: A text that can be displayed to the Customer as a reason. + type: string + example: Damaged goods + value: + description: The value to identify the reason by. + type: string + example: damaged + parent_return_reason_id: + type: string + description: The ID of the parent reason. + example: null + parent_return_reason: + description: Available if the relation `parent_return_reason` is expanded. + $ref: ./return_reason.yaml + return_reason_children: + description: Available if the relation `return_reason_children` is expanded. + $ref: ./return_reason.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/sales_channel.yaml b/docs/api/admin/components/schemas/sales_channel.yaml new file mode 100644 index 0000000000..0523299105 --- /dev/null +++ b/docs/api/admin/components/schemas/sales_channel.yaml @@ -0,0 +1,34 @@ +title: Sales Channel +description: A Sales Channel +x-resourceId: sales_channel +required: + - name +properties: + id: + type: string + description: The sales channel's ID + example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + name: + description: The name of the sales channel. + type: string + example: Market + description: + description: The description of the sales channel. + type: string + example: Multi-vendor market + is_disabled: + description: Specify if the sales channel is enabled or disabled. + type: boolean + default: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/admin/components/schemas/sales_channel_tax_line.yaml b/docs/api/admin/components/schemas/sales_channel_tax_line.yaml new file mode 100644 index 0000000000..8aac42859c --- /dev/null +++ b/docs/api/admin/components/schemas/sales_channel_tax_line.yaml @@ -0,0 +1,44 @@ +title: Sales Channel +description: A Sales Channel +x-resourceId: sales_channel_tax_line +required: + - shipping_method_id + - rate + - name +properties: + id: + type: string + description: The line item tax line's ID + example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + shipping_method_id: + type: string + description: The ID of the line item + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_method: + description: Available if the relation `shipping_method` is expanded. + $ref: ./shipping_method.yaml + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/shipping_method.yaml b/docs/api/admin/components/schemas/shipping_method.yaml new file mode 100644 index 0000000000..d53bafb241 --- /dev/null +++ b/docs/api/admin/components/schemas/shipping_method.yaml @@ -0,0 +1,76 @@ +title: Shipping Method +description: >- + Shipping Methods represent a way in which an Order or Return can be shipped. + Shipping Methods are built from a Shipping Option, but may contain additional + details, that can be necessary for the Fulfillment Provider to handle the + shipment. +x-resourceId: shipping_method +required: + - shipping_option_id + - price +properties: + id: + type: string + description: The shipping method's ID + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_option_id: + description: The id of the Shipping Option that the Shipping Method is built from. + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: ./shipping_option.yaml + order_id: + description: The id of the Order that the Shipping Method is used on. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + return_id: + description: The id of the Return that the Shipping Method is used on. + type: string + example: null + return_order: + description: A return object. Available if the relation `return_order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Shipping Method is used on. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Shipping Method is used on. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Shipping Method is used on. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + tax_lines: + type: array + description: Available if the relation `tax_lines` is expanded. + items: + $ref: ./tax_line.yaml + price: + description: >- + The amount to charge for the Shipping Method. The currency of the price is + defined by the Region that the Order that the Shipping Method belongs to + is a part of. + type: integer + example: 200 + data: + description: >- + Additional data that the Fulfillment Provider needs to fulfill the + shipment. This is used in combination with the Shipping Options data, and + may contain information such as a drop point id. + type: object + example: {} diff --git a/docs/api/admin/components/schemas/shipping_option.yaml b/docs/api/admin/components/schemas/shipping_option.yaml new file mode 100644 index 0000000000..61f298af6f --- /dev/null +++ b/docs/api/admin/components/schemas/shipping_option.yaml @@ -0,0 +1,103 @@ +title: Shipping Option +description: >- + Shipping Options represent a way in which an Order or Return can be shipped. + Shipping Options have an associated Fulfillment Provider that will be used + when the fulfillment of an Order is initiated. Shipping Options themselves + cannot be added to Carts, but serve as a template for Shipping Methods. This + distinction makes it possible to customize individual Shipping Methods with + additional information. +x-resourceId: shipping_option +required: + - name + - region_id + - profile_id + - provider_id + - price_type +properties: + id: + type: string + description: The shipping option's ID + example: so_01G1G5V27GYX4QXNARRQCW1N8T + name: + description: >- + The name given to the Shipping Option - this may be displayed to the + Customer. + type: string + example: PostFake Standard + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + profile_id: + description: >- + The ID of the Shipping Profile that the shipping option belongs to. + Shipping Profiles have a set of defined Shipping Options that can be used + to Fulfill a given set of Products. + type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: ./shipping_profile.yaml + provider_id: + description: >- + The id of the Fulfillment Provider, that will be used to process + Fulfillments from the Shipping Option. + type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: ./fulfillment_provider.yaml + price_type: + description: >- + The type of pricing calculation that is used when creatin Shipping Methods + from the Shipping Option. Can be `flat_rate` for fixed prices or + `calculated` if the Fulfillment Provider can provide price calulations. + type: string + enum: + - flat_rate + - calculated + example: flat_rate + amount: + description: >- + The amount to charge for shipping when the Shipping Option price type is + `flat_rate`. + type: integer + example: 200 + is_return: + description: Flag to indicate if the Shipping Option can be used for Return shipments. + type: boolean + default: false + requirements: + description: >- + The requirements that must be satisfied for the Shipping Option to be + available for a Cart. Available if the relation `requirements` is + expanded. + type: array + items: + $ref: ./shipping_option_requirement.yaml + data: + description: >- + The data needed for the Fulfillment Provider to identify the Shipping + Option. + type: object + example: {} + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/shipping_option_requirement.yaml b/docs/api/admin/components/schemas/shipping_option_requirement.yaml new file mode 100644 index 0000000000..559d21de44 --- /dev/null +++ b/docs/api/admin/components/schemas/shipping_option_requirement.yaml @@ -0,0 +1,43 @@ +title: Shipping Option Requirement +description: >- + A requirement that a Cart must satisfy for the Shipping Option to be available + to the Cart. +x-resourceId: shipping_option_requirement +required: + - shipping_option_id + - type + - amount +properties: + id: + type: string + description: The shipping option requirement's ID + example: sor_01G1G5V29AB4CTNDRFSRWSRKWD + shipping_option_id: + description: >- + The id of the Shipping Option that the hipping option requirement belongs + to + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: ./shipping_option.yaml + type: + description: >- + The type of the requirement, this defines how the value will be compared + to the Cart's total. `min_subtotal` requirements define the minimum + subtotal that is needed for the Shipping Option to be available, while the + `max_subtotal` defines the maximum subtotal that the Cart can have for the + Shipping Option to be available. + type: string + enum: + - min_subtotal + - max_subtotal + example: min_subtotal + amount: + description: The amount to compare the Cart subtotal to. + type: integer + example: 100 + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/admin/components/schemas/shipping_profile.yaml b/docs/api/admin/components/schemas/shipping_profile.yaml new file mode 100644 index 0000000000..cb55e4f134 --- /dev/null +++ b/docs/api/admin/components/schemas/shipping_profile.yaml @@ -0,0 +1,62 @@ +title: Shipping Profile +description: >- + Shipping Profiles have a set of defined Shipping Options that can be used to + fulfill a given set of Products. +x-resourceId: shipping_profile +required: + - name + - type +properties: + id: + type: string + description: The shipping profile's ID + example: sp_01G1G5V239ENSZ5MV4JAR737BM + name: + description: >- + The name given to the Shipping profile - this may be displayed to the + Customer. + type: string + example: Default Shipping Profile + type: + description: >- + The type of the Shipping Profile, may be `default`, `gift_card` or + `custom`. + type: string + enum: + - default + - gift_card + - custom + example: default + products: + description: >- + The Products that the Shipping Profile defines Shipping Options for. + Available if the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + shipping_options: + description: >- + The Shipping Options that can be used to fulfill the Products in the + Shipping Profile. Available if the relation `shipping_options` is + expanded. + type: array + items: + $ref: ./shipping_option.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/shipping_tax_rate.yaml b/docs/api/admin/components/schemas/shipping_tax_rate.yaml new file mode 100644 index 0000000000..ddf13f172a --- /dev/null +++ b/docs/api/admin/components/schemas/shipping_tax_rate.yaml @@ -0,0 +1,36 @@ +title: Shipping Tax Rate +description: >- + Associates a tax rate with a shipping option to indicate that the shipping + option is taxed in a certain way +x-resourceId: shipping_tax_rate +required: + - shipping_option_id + - rate_id +properties: + shipping_option_id: + description: The ID of the Shipping Option + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: ./shipping_option.yaml + rate_id: + description: The ID of the Tax Rate + type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: ./tax_rate.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/staged_job.yaml b/docs/api/admin/components/schemas/staged_job.yaml new file mode 100644 index 0000000000..95fd6aaf34 --- /dev/null +++ b/docs/api/admin/components/schemas/staged_job.yaml @@ -0,0 +1,18 @@ +title: Staged Job +description: A staged job resource +x-resourceId: staged_job +required: + - event_name +properties: + id: + type: string + description: The staged job's ID + example: job_01F0YET7BZTARY9MKN1SJ7AAXF + event_name: + description: The name of the event + type: string + example: order.placed + data: + description: Data necessary for the job + type: object + example: {} diff --git a/docs/api/admin/components/schemas/store.yaml b/docs/api/admin/components/schemas/store.yaml new file mode 100644 index 0000000000..09844ff155 --- /dev/null +++ b/docs/api/admin/components/schemas/store.yaml @@ -0,0 +1,59 @@ +title: Store +description: Holds settings for the Store, such as name, currencies, etc. +x-resourceId: store +properties: + id: + type: string + description: The store's ID + example: store_01G1G5V21KADXNGH29BJMAJ4B4 + name: + description: The name of the Store - this may be displayed to the Customer. + type: string + example: Medusa Store + default_currency_code: + description: The 3 character currency code that is the default of the store. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + default_currency: + description: Available if the relation `default_currency` is expanded. + $ref: ./currency.yaml + currencies: + description: >- + The currencies that are enabled for the Store. Available if the relation + `currencies` is expanded. + type: array + items: + $ref: ./currency.yaml + swap_link_template: + description: >- + A template to generate Swap links from. Use {{cart_id}} to include the + Swap's `cart_id` in the link. + type: string + example: null + payment_link_template: + description: >- + A template to generate Payment links from. Use {{cart_id}} to include the + payment's `cart_id` in the link. + type: string + example: null + invite_link_template: + description: A template to generate Invite links from + type: string + example: null + default_sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + default_sales_channel: + description: >- + A sales channel object. Available if the relation `default_sales_channel` + is expanded. + type: object + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/swap.yaml b/docs/api/admin/components/schemas/swap.yaml new file mode 100644 index 0000000000..35a81eed87 --- /dev/null +++ b/docs/api/admin/components/schemas/swap.yaml @@ -0,0 +1,149 @@ +title: Swap +description: >- + Swaps can be created when a Customer wishes to exchange Products that they + have purchased to different Products. Swaps consist of a Return of previously + purchased Products and a Fulfillment of new Products, the amount paid for the + Products being returned will be used towards payment for the new Products. In + the case where the amount paid for the the Products being returned exceed the + amount to be paid for the new Products, a Refund will be issued for the + difference. +x-resourceId: swap +required: + - fulfillment_status + - payment_status + - order_id +properties: + id: + type: string + description: The swap's ID + example: swap_01F0YET86Y9G92D3YDR9Y6V676 + fulfillment_status: + description: The status of the Fulfillment of the Swap. + type: string + enum: + - not_fulfilled + - fulfilled + - shipped + - canceled + - requires_action + example: not_fulfilled + payment_status: + description: >- + The status of the Payment of the Swap. The payment may either refer to the + refund of an amount or the authorization of a new amount. + type: string + enum: + - not_paid + - awaiting + - captured + - confirmed + - canceled + - difference_refunded + - partially_refunded + - refunded + - requires_action + example: not_paid + order_id: + description: The ID of the Order where the Line Items to be returned where purchased. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + additional_items: + description: >- + The new Line Items to ship to the Customer. Available if the relation + `additional_items` is expanded. + type: array + items: + $ref: ./line_item.yaml + return_order: + description: >- + A return order object. The Return that is issued for the return part of + the Swap. Available if the relation `return_order` is expanded. + type: object + fulfillments: + description: >- + The Fulfillments used to send the new Line Items. Available if the + relation `fulfillments` is expanded. + type: array + items: + $ref: ./fulfillment.yaml + payment: + description: >- + The Payment authorized when the Swap requires an additional amount to be + charged from the Customer. Available if the relation `payment` is + expanded. + $ref: ./payment.yaml + difference_due: + description: >- + The difference that is paid or refunded as a result of the Swap. May be + negative when the amount paid for the returned items exceed the total of + the new Products. + type: integer + example: 0 + shipping_address_id: + description: >- + The Address to send the new Line Items to - in most cases this will be the + same as the shipping address on the Order. + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + shipping_methods: + description: >- + The Shipping Methods used to fulfill the addtional items purchased. + Available if the relation `shipping_methods` is expanded. + type: array + items: + $ref: ./shipping_method.yaml + cart_id: + description: The id of the Cart that the Customer will use to confirm the Swap. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + allow_backorder: + description: If true, swaps can be completed with items out of stock + type: boolean + default: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the swap in case + of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + confirmed_at: + description: The date with timezone at which the Swap was confirmed by the Customer. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Swap was canceled. + type: string + format: date-time + no_notification: + description: If set to true, no notification will be sent related to this swap + type: boolean + example: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/tax_line.yaml b/docs/api/admin/components/schemas/tax_line.yaml new file mode 100644 index 0000000000..491a7e0c00 --- /dev/null +++ b/docs/api/admin/components/schemas/tax_line.yaml @@ -0,0 +1,36 @@ +title: Tax Line +description: Line item that specifies an amount of tax to add to a line item. +x-resourceId: tax_line +required: + - rate + - name +properties: + id: + type: string + description: The tax line's ID + example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/tax_provider.yaml b/docs/api/admin/components/schemas/tax_provider.yaml new file mode 100644 index 0000000000..267d162eae --- /dev/null +++ b/docs/api/admin/components/schemas/tax_provider.yaml @@ -0,0 +1,15 @@ +title: Tax Provider +description: The tax service used to calculate taxes +x-resourceId: tax_provider +properties: + id: + description: The id of the tax provider as given by the plugin. + type: string + example: manual + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + default: true diff --git a/docs/api/admin/components/schemas/tax_rate.yaml b/docs/api/admin/components/schemas/tax_rate.yaml new file mode 100644 index 0000000000..29f7e0e0a9 --- /dev/null +++ b/docs/api/admin/components/schemas/tax_rate.yaml @@ -0,0 +1,81 @@ +title: Tax Rate +description: >- + A Tax Rate can be used to associate a certain rate to charge on products + within a given Region +x-resourceId: line_item +required: + - name + - region_id +properties: + id: + type: string + description: The tax rate's ID + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + rate: + description: The numeric rate to charge + type: number + example: 10 + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + region_id: + type: string + description: The id of the Region that the rate belongs to + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + products: + type: array + description: >- + The products that belong to this tax rate. Available if the relation + `products` is expanded. + items: + type: object + description: A product object. + product_types: + type: array + description: >- + The product types that belong to this tax rate. Available if the relation + `product_types` is expanded. + items: + type: object + description: A product type object. + shipping_options: + type: array + description: >- + The shipping options that belong to this tax rate. Available if the + relation `shipping_options` is expanded. + items: + type: object + description: A shipping option object. + product_count: + description: The count of products + type: integer + example: null + product_type_count: + description: The count of product types + type: integer + example: null + shipping_option_count: + description: The count of shipping options + type: integer + example: null + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/tracking_link.yaml b/docs/api/admin/components/schemas/tracking_link.yaml new file mode 100644 index 0000000000..2a79689722 --- /dev/null +++ b/docs/api/admin/components/schemas/tracking_link.yaml @@ -0,0 +1,55 @@ +title: Tracking Link +description: >- + Tracking Link holds information about tracking numbers for a Fulfillment. + Tracking Links can optionally contain a URL that can be visited to see the + status of the shipment. +x-resourceId: tracking_link +required: + - tracking_number + - fulfillment_id +properties: + id: + type: string + description: The tracking link's ID + example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 + url: + description: The URL at which the status of the shipment can be tracked. + type: string + format: uri + tracking_number: + description: The tracking number given by the shipping carrier. + type: string + format: RH370168054CN + fulfillment_id: + type: string + description: The id of the Fulfillment that the Tracking Link references. + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + fulfillment: + description: Available if the relation `fulfillment` is expanded. + $ref: ./fulfillment.yaml + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a process in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/components/schemas/user.yaml b/docs/api/admin/components/schemas/user.yaml new file mode 100644 index 0000000000..5083be44de --- /dev/null +++ b/docs/api/admin/components/schemas/user.yaml @@ -0,0 +1,43 @@ +title: User +description: Represents a User who can manage store settings. +x-resourceId: user +required: + - email +properties: + id: + type: string + description: The user's ID + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + email: + description: The email of the User + type: string + format: email + first_name: + description: The first name of the User + type: string + example: Levi + last_name: + description: The last name of the User + type: string + example: Bogan + api_token: + description: An API token associated with the user. + type: string + example: null + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/admin/openapi.yaml b/docs/api/admin/openapi.yaml new file mode 100644 index 0000000000..d374333fbb --- /dev/null +++ b/docs/api/admin/openapi.yaml @@ -0,0 +1,353 @@ +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: + /auth: + $ref: paths/auth.yaml + /batch-jobs/{id}/cancel: + $ref: paths/batch-jobs_{id}_cancel.yaml + /batch-jobs/{id}/confirm: + $ref: paths/batch-jobs_{id}_confirm.yaml + /batch-jobs: + $ref: paths/batch-jobs.yaml + /batch-jobs/{id}: + $ref: paths/batch-jobs_{id}.yaml + /collections/{id}/products/batch: + $ref: paths/collections_{id}_products_batch.yaml + /collections: + $ref: paths/collections.yaml + /collections/{id}: + $ref: paths/collections_{id}.yaml + /customer-groups/{id}/customers/batch: + $ref: paths/customer-groups_{id}_customers_batch.yaml + /customer-groups: + $ref: paths/customer-groups.yaml + /customer-groups/{id}: + $ref: paths/customer-groups_{id}.yaml + /customer-groups/{id}/customers: + $ref: paths/customer-groups_{id}_customers.yaml + /customers: + $ref: paths/customers.yaml + /customers/{id}: + $ref: paths/customers_{id}.yaml + /discounts/{id}/regions/{region_id}: + $ref: paths/discounts_{id}_regions_{region_id}.yaml + /discounts/{discount_id}/conditions: + $ref: paths/discounts_{discount_id}_conditions.yaml + /discounts: + $ref: paths/discounts.yaml + /discounts/{id}/dynamic-codes: + $ref: paths/discounts_{id}_dynamic-codes.yaml + /discounts/{discount_id}/conditions/{condition_id}: + $ref: paths/discounts_{discount_id}_conditions_{condition_id}.yaml + /discounts/{id}: + $ref: paths/discounts_{id}.yaml + /discounts/{id}/dynamic-codes/{code}: + $ref: paths/discounts_{id}_dynamic-codes_{code}.yaml + /discounts/code/{code}: + $ref: paths/discounts_code_{code}.yaml + /apps/authorizations: + $ref: paths/apps_authorizations.yaml + /apps: + $ref: paths/apps.yaml + /draft-orders: + $ref: paths/draft-orders.yaml + /draft-orders/{id}/line-items: + $ref: paths/draft-orders_{id}_line-items.yaml + /draft-orders/{id}: + $ref: paths/draft-orders_{id}.yaml + /draft-orders/{id}/line-items/{line_id}: + $ref: paths/draft-orders_{id}_line-items_{line_id}.yaml + /draft-orders/{id}/pay: + $ref: paths/draft-orders_{id}_pay.yaml + /admin/draft-orders/{id}: + $ref: paths/admin_draft-orders_{id}.yaml + /gift-cards: + $ref: paths/gift-cards.yaml + /gift-cards/{id}: + $ref: paths/gift-cards_{id}.yaml + /invites/accept: + $ref: paths/invites_accept.yaml + /invites: + $ref: paths/invites.yaml + /invites/{invite_id}: + $ref: paths/invites_{invite_id}.yaml + /invites/{invite_id}/resend: + $ref: paths/invites_{invite_id}_resend.yaml + /notes: + $ref: paths/notes.yaml + /notes/{id}: + $ref: paths/notes_{id}.yaml + /notifications: + $ref: paths/notifications.yaml + /notifications/{id}/resend: + $ref: paths/notifications_{id}_resend.yaml + /orders/{id}/shipping-methods: + $ref: paths/orders_{id}_shipping-methods.yaml + /orders/{id}/archive: + $ref: paths/orders_{id}_archive.yaml + /orders/{id}/claims/{claim_id}/cancel: + $ref: paths/orders_{id}_claims_{claim_id}_cancel.yaml + /orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel: + $ref: >- + paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml + /orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel: + $ref: >- + paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml + /orders/{id}/fulfillments/{fulfillment_id}/cancel: + $ref: paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml + /orders/{id}/cancel: + $ref: paths/orders_{id}_cancel.yaml + /orders/{id}/swaps/{swap_id}/cancel: + $ref: paths/orders_{id}_swaps_{swap_id}_cancel.yaml + /orders/{id}/capture: + $ref: paths/orders_{id}_capture.yaml + /orders/{id}/complete: + $ref: paths/orders_{id}_complete.yaml + /orders/{id}/claims/{claim_id}/shipments: + $ref: paths/orders_{id}_claims_{claim_id}_shipments.yaml + /order/{id}/claims: + $ref: paths/order_{id}_claims.yaml + /orders/{id}/fulfillment: + $ref: paths/orders_{id}_fulfillment.yaml + /orders/{id}/shipment: + $ref: paths/orders_{id}_shipment.yaml + /orders/{id}/swaps/{swap_id}/shipments: + $ref: paths/orders_{id}_swaps_{swap_id}_shipments.yaml + /order/{id}/swaps: + $ref: paths/order_{id}_swaps.yaml + /orders/{id}/claims/{claim_id}/fulfillments: + $ref: paths/orders_{id}_claims_{claim_id}_fulfillments.yaml + /orders/{id}/swaps/{swap_id}/fulfillments: + $ref: paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml + /orders/{id}: + $ref: paths/orders_{id}.yaml + /orders: + $ref: paths/orders.yaml + /orders/{id}/swaps/{swap_id}/process-payment: + $ref: paths/orders_{id}_swaps_{swap_id}_process-payment.yaml + /orders/{id}/refund: + $ref: paths/orders_{id}_refund.yaml + /orders/{id}/return: + $ref: paths/orders_{id}_return.yaml + /order/{id}/claims/{claim_id}: + $ref: paths/order_{id}_claims_{claim_id}.yaml + /price-lists/{id}/prices/batch: + $ref: paths/price-lists_{id}_prices_batch.yaml + /price-lists: + $ref: paths/price-lists.yaml + /price-lists/{id}: + $ref: paths/price-lists_{id}.yaml + /price-lists/{id}/products/{product_id}/prices: + $ref: paths/price-lists_{id}_products_{product_id}_prices.yaml + /price-lists/{id}/variants/{variant_id}/prices: + $ref: paths/price-lists_{id}_variants_{variant_id}_prices.yaml + /price-lists/:id/products: + $ref: paths/price-lists_:id_products.yaml + /product-tags: + $ref: paths/product-tags.yaml + /product-types: + $ref: paths/product-types.yaml + /products/{id}/options: + $ref: paths/products_{id}_options.yaml + /products: + $ref: paths/products.yaml + /products/{id}/variants: + $ref: paths/products_{id}_variants.yaml + /products/{id}/options/{option_id}: + $ref: paths/products_{id}_options_{option_id}.yaml + /products/{id}: + $ref: paths/products_{id}.yaml + /products/{id}/variants/{variant_id}: + $ref: paths/products_{id}_variants_{variant_id}.yaml + /products/tag-usage: + $ref: paths/products_tag-usage.yaml + /products/types: + $ref: paths/products_types.yaml + /products/{id}/metadata: + $ref: paths/products_{id}_metadata.yaml + /regions/{id}/countries: + $ref: paths/regions_{id}_countries.yaml + /regions/{id}/fulfillment-providers: + $ref: paths/regions_{id}_fulfillment-providers.yaml + /regions/{id}/payment-providers: + $ref: paths/regions_{id}_payment-providers.yaml + /regions: + $ref: paths/regions.yaml + /regions/{id}: + $ref: paths/regions_{id}.yaml + /regions/{id}/fulfillment-options: + $ref: paths/regions_{id}_fulfillment-options.yaml + /regions/{id}/countries/{country_code}: + $ref: paths/regions_{id}_countries_{country_code}.yaml + /regions/{id}/fulfillment-providers/{provider_id}: + $ref: paths/regions_{id}_fulfillment-providers_{provider_id}.yaml + /regions/{id}/payment-providers/{provider_id}: + $ref: paths/regions_{id}_payment-providers_{provider_id}.yaml + /return-reasons: + $ref: paths/return-reasons.yaml + /return-reasons/{id}: + $ref: paths/return-reasons_{id}.yaml + /returns/{id}/cancel: + $ref: paths/returns_{id}_cancel.yaml + /returns: + $ref: paths/returns.yaml + /returns/{id}/receive: + $ref: paths/returns_{id}_receive.yaml + /sales-channels/{id}/products/batch: + $ref: paths/sales-channels_{id}_products_batch.yaml + /sales-channels: + $ref: paths/sales-channels.yaml + /sales-channels/{id}: + $ref: paths/sales-channels_{id}.yaml + /shipping-options: + $ref: paths/shipping-options.yaml + /shipping-options/{id}: + $ref: paths/shipping-options_{id}.yaml + /shipping-profiles: + $ref: paths/shipping-profiles.yaml + /shipping-profiles/{id}: + $ref: paths/shipping-profiles_{id}.yaml + /store/currencies/{code}: + $ref: paths/store_currencies_{code}.yaml + /store: + $ref: paths/store.yaml + /store/payment-providers: + $ref: paths/store_payment-providers.yaml + /store/tax-providers: + $ref: paths/store_tax-providers.yaml + /swaps/{id}: + $ref: paths/swaps_{id}.yaml + /swaps: + $ref: paths/swaps.yaml + /tax-rates/:id/product-types/batch: + $ref: paths/tax-rates_:id_product-types_batch.yaml + /tax-rates/:id/products/batch: + $ref: paths/tax-rates_:id_products_batch.yaml + /tax-rates/:id/shipping-options/batch: + $ref: paths/tax-rates_:id_shipping-options_batch.yaml + /tax-rates: + $ref: paths/tax-rates.yaml + /tax-rates/{id}: + $ref: paths/tax-rates_{id}.yaml + /tax-rates/:id: + $ref: paths/tax-rates_:id.yaml + /uploads: + $ref: paths/uploads.yaml + /users: + $ref: paths/users.yaml + /users/{id}: + $ref: paths/users_{id}.yaml + /users/password-token: + $ref: paths/users_password-token.yaml + /users/reset-password: + $ref: paths/users_reset-password.yaml + /variants: + $ref: paths/variants.yaml diff --git a/docs/api/admin/paths/admin_draft-orders_{id}.yaml b/docs/api/admin/paths/admin_draft-orders_{id}.yaml new file mode 100644 index 0000000000..4855247cef --- /dev/null +++ b/docs/api/admin/paths/admin_draft-orders_{id}.yaml @@ -0,0 +1,67 @@ +post: + operationId: PostDraftOrdersDraftOrder + summary: Update a Draft Order" + description: Updates a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The ID of the Region to create the Draft Order in. + country_code: + type: string + description: The 2 character ISO code for the Country. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + email: + type: string + description: An email to be used on the Draft Order. + format: email + billing_address: + description: The Address to be used for billing purposes. + $ref: ../components/schemas/address.yaml + shipping_address: + description: The Address to be used for shipping. + $ref: ../components/schemas/address.yaml + discounts: + description: An array of Discount codes to add to the Draft Order. + type: array + items: + type: object + required: + - code + properties: + code: + description: The code that a Discount is identifed by. + type: string + no_notification_order: + description: >- + An optional flag passed to the resulting order to determine use + of notifications. + type: boolean + customer_id: + description: The ID of the Customer to associate the Draft Order with. + type: string + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_order: + $ref: ../components/schemas/draft-order.yaml diff --git a/docs/api/admin/paths/apps.yaml b/docs/api/admin/paths/apps.yaml new file mode 100644 index 0000000000..c29526c571 --- /dev/null +++ b/docs/api/admin/paths/apps.yaml @@ -0,0 +1,18 @@ +get: + operationId: GetApps + summary: List applications + description: Retrieve a list of applications. + x-authenticated: true + tags: + - App + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + apps: + type: array + items: + $ref: ../components/schemas/OAuth.yaml diff --git a/docs/api/admin/paths/apps_authorizations.yaml b/docs/api/admin/paths/apps_authorizations.yaml new file mode 100644 index 0000000000..7d61982e8c --- /dev/null +++ b/docs/api/admin/paths/apps_authorizations.yaml @@ -0,0 +1,34 @@ +post: + operationId: PostApps + summary: Generates a token for an application. + description: Generates a token for an application. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - application_name + - state + - code + properties: + application_name: + type: string + description: Name of the application for the token to be generated for. + state: + type: string + description: State of the application. + code: + type: string + description: The code for the generated token. + tags: + - App + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + apps: + $ref: ../components/schemas/OAuth.yaml diff --git a/docs/api/admin/paths/auth.yaml b/docs/api/admin/paths/auth.yaml new file mode 100644 index 0000000000..b49b934669 --- /dev/null +++ b/docs/api/admin/paths/auth.yaml @@ -0,0 +1,62 @@ +post: + operationId: PostAuth + summary: Authenticate a User + x-authenticated: false + description: Logs a User in and authorizes them to manage Store settings. + parameters: [] + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + description: The User's email. + password: + type: string + description: The User's password. + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml + '401': + description: The user doesn't exist or the credentials are incorrect. +delete: + operationId: DeleteAuth + summary: Delete Session + x-authenticated: true + description: Deletes the current session for the logged in user. + tags: + - Auth + responses: + '200': + description: OK +get: + operationId: GetAuth + summary: Get Session + x-authenticated: true + description: Gets the currently logged in User. + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml + '400': + description: An error occurred. diff --git a/docs/api/admin/paths/batch-jobs.yaml b/docs/api/admin/paths/batch-jobs.yaml new file mode 100644 index 0000000000..6b660c9a2f --- /dev/null +++ b/docs/api/admin/paths/batch-jobs.yaml @@ -0,0 +1,318 @@ +post: + operationId: PostBatchJobs + summary: Create a Batch Job + description: Creates a Batch Job. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - type + - context + properties: + type: + type: string + description: The type of batch job to start. + example: product-export + context: + type: object + description: >- + Additional infomration regarding the batch to be used for + processing. + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images + dry_run: + type: boolean + description: >- + Set a batch job in dry_run mode to get some information on what + will be done without applying any modifications. + default: false + tags: + - Batch Job + responses: + '201': + description: OK + content: + application/json: + schema: + properties: + batch_job: + $ref: ../components/schemas/batch_job.yaml +get: + operationId: GetBatchJobs + summary: List Batch Jobs + description: Retrieve a list of Batch Jobs. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of batch jobs to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The number of batch jobs to skip before results. + schema: + type: integer + default: 0 + - in: query + name: id + style: form + explode: false + description: Filter by the batch ID + schema: + oneOf: + - type: string + description: batch job ID + - type: array + description: multiple batch job IDs + items: + type: string + - in: query + name: type + style: form + explode: false + description: Filter by the batch type + schema: + type: array + items: + type: string + - in: query + name: confirmed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was confirmed, i.e. less + than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: pre_processed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was pre processed, i.e. + less than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: completed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was completed, i.e. less + than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: failed_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was failed, i.e. less + than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: canceled_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was canceled, i.e. less + than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: order + description: Field used to order retrieved batch jobs + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each order of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each order of the + result. + schema: + type: string + - in: query + name: created_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was created, i.e. less + than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + style: form + explode: false + description: >- + Date comparison for when resulting collections was updated, i.e. less + than, greater than etc. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + batch_jobs: + type: array + items: + $ref: ../components/schemas/batch_job.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/batch-jobs_{id}.yaml b/docs/api/admin/paths/batch-jobs_{id}.yaml new file mode 100644 index 0000000000..9d0f4ae7d5 --- /dev/null +++ b/docs/api/admin/paths/batch-jobs_{id}.yaml @@ -0,0 +1,23 @@ +get: + operationId: GetBatchJobsBatchJob + summary: Retrieve a Batch Job + description: Retrieves a Batch Job. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Batch Job + schema: + type: string + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + batch_job: + $ref: ../components/schemas/batch_job.yaml diff --git a/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml b/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml new file mode 100644 index 0000000000..d754a32790 --- /dev/null +++ b/docs/api/admin/paths/batch-jobs_{id}_cancel.yaml @@ -0,0 +1,23 @@ +post: + operationId: PostBatchJobsBatchJobCancel + summary: Marks a batch job as canceled + description: Marks a batch job as canceled + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the batch job. + schema: + type: string + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + batch_job: + $ref: ../components/schemas/batch_job.yaml diff --git a/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml b/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml new file mode 100644 index 0000000000..dc85edfc0f --- /dev/null +++ b/docs/api/admin/paths/batch-jobs_{id}_confirm.yaml @@ -0,0 +1,23 @@ +post: + operationId: PostBatchJobsBatchJobConfirmProcessing + summary: Confirm a batch job + description: Confirms that a previously requested batch job should be executed. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the batch job. + schema: + type: string + tags: + - Batch Job + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + batch_job: + $ref: ../components/schemas/batch_job.yaml diff --git a/docs/api/admin/paths/collections.yaml b/docs/api/admin/paths/collections.yaml new file mode 100644 index 0000000000..9fcc46fd19 --- /dev/null +++ b/docs/api/admin/paths/collections.yaml @@ -0,0 +1,157 @@ +post: + operationId: PostCollections + summary: Create a Product Collection + description: Creates a Product Collection. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - title + properties: + title: + type: string + description: The title to identify the Collection by. + handle: + type: string + description: >- + An optional handle to be used in slugs, if none is provided we + will kebab-case the title. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: ../components/schemas/product_collection.yaml +get: + operationId: GetCollections + summary: List Product Collections + description: Retrieve a list of Product Collection. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of collections to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The number of collections to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: title + description: The title of collections to return. + schema: + type: string + - in: query + name: handle + description: The handle of collections to return. + schema: + type: string + - in: query + name: q + description: a search term to search titles and handles. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting collections were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collections: + type: array + items: + $ref: ../components/schemas/product_collection.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/collections_{id}.yaml b/docs/api/admin/paths/collections_{id}.yaml new file mode 100644 index 0000000000..d949bc5a74 --- /dev/null +++ b/docs/api/admin/paths/collections_{id}.yaml @@ -0,0 +1,96 @@ +delete: + operationId: DeleteCollectionsCollection + summary: Delete a Product Collection + description: Deletes a Product Collection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Collection + object: + type: string + description: The type of the object that was deleted. + default: product-collection + deleted: + type: boolean + description: Whether the collection was deleted successfully or not. + default: true +get: + operationId: GetCollectionsCollection + summary: Retrieve a Product Collection + description: Retrieves a Product Collection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product Collection + schema: + type: string + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: ../components/schemas/product_collection.yaml +post: + operationId: PostCollectionsCollection + summary: Update a Product Collection + description: Updates a Product Collection. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + title: + type: string + description: The title to identify the Collection by. + handle: + type: string + description: >- + An optional handle to be used in slugs, if none is provided we + will kebab-case the title. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: ../components/schemas/product_collection.yaml diff --git a/docs/api/admin/paths/collections_{id}_products_batch.yaml b/docs/api/admin/paths/collections_{id}_products_batch.yaml new file mode 100644 index 0000000000..2d02589d38 --- /dev/null +++ b/docs/api/admin/paths/collections_{id}_products_batch.yaml @@ -0,0 +1,83 @@ +post: + operationId: PostProductsToCollection + summary: Updates products associated with a Product Collection + description: Updates products associated with a Product Collection + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - product_ids + properties: + product_ids: + description: An array of Product IDs to add to the Product Collection. + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: ../components/schemas/product_collection.yaml +delete: + operationId: DeleteProductsFromCollection + summary: Removes products associated with a Product Collection + description: Removes products associated with a Product Collection + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Collection. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - product_ids + properties: + product_ids: + description: An array of Product IDs to remove from the Product Collection. + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the collection + object: + type: string + description: The type of object the removal was executed on + default: product-collection + removed_products: + description: The IDs of the products removed from the collection + type: array + items: + description: The ID of a Product to add to the Product Collection. + type: string diff --git a/docs/api/admin/paths/customer-groups.yaml b/docs/api/admin/paths/customer-groups.yaml new file mode 100644 index 0000000000..6f0f1c2a57 --- /dev/null +++ b/docs/api/admin/paths/customer-groups.yaml @@ -0,0 +1,170 @@ +post: + operationId: PostCustomerGroups + summary: Create a CustomerGroup + description: Creates a CustomerGroup. + x-authenticated: true + parameters: [] + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: ../components/schemas/customer_group.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + description: Name of the customer group + metadata: + type: object + description: Metadata for the customer. +get: + operationId: GetCustomerGroups + summary: Retrieve a list of customer groups + description: Retrieve a list of customer groups. + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching customer group names. + schema: + type: string + - in: query + name: offset + description: How many groups to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: order + description: the field used to order the customer groups. + schema: + type: string + - in: query + name: id + style: form + explode: false + description: Filter by the customer group ID + schema: + oneOf: + - type: string + description: customer group ID + - type: array + description: multiple customer group IDs + items: + type: string + - type: object + properties: + lt: + type: string + description: filter by IDs less than this ID + gt: + type: string + description: filter by IDs greater than this ID + lte: + type: string + description: filter by IDs less than or equal to this ID + gte: + type: string + description: filter by IDs greater than or equal to this ID + - in: query + name: name + style: form + explode: false + description: Filter by the customer group name + schema: + type: array + description: multiple customer group names + items: + type: string + description: customer group name + - in: query + name: created_at + description: Date comparison for when resulting customer groups were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting customer groups were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: limit + description: Limit the number of customer groups returned. + schema: + type: integer + default: 10 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each customer + groups of the result. + schema: + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_groups: + type: array + items: + $ref: ../components/schemas/customer_group.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/customer-groups_{id}.yaml b/docs/api/admin/paths/customer-groups_{id}.yaml new file mode 100644 index 0000000000..d0ea8b72a2 --- /dev/null +++ b/docs/api/admin/paths/customer-groups_{id}.yaml @@ -0,0 +1,99 @@ +delete: + operationId: DeleteCustomerGroupsCustomerGroup + summary: Delete a CustomerGroup + description: Deletes a CustomerGroup. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer Group + schema: + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted customer group. + object: + type: string + description: The type of the object that was deleted. + default: customer_group + deleted: + type: boolean + description: Whether the customer group was deleted successfully or not. + default: true +get: + operationId: GetCustomerGroupsGroup + summary: Retrieve a CustomerGroup + description: Retrieves a Customer Group. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer Group. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the customer group. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the customer group. + schema: + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: ../components/schemas/customer_group.yaml +post: + operationId: PostCustomerGroupsGroup + summary: Update a CustomerGroup + description: Update a CustomerGroup. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the customer group. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: Name of the customer group + type: string + metadata: + description: Metadata for the customer. + type: object + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: ../components/schemas/customer_group.yaml diff --git a/docs/api/admin/paths/customer-groups_{id}_customers.yaml b/docs/api/admin/paths/customer-groups_{id}_customers.yaml new file mode 100644 index 0000000000..93cf62793a --- /dev/null +++ b/docs/api/admin/paths/customer-groups_{id}_customers.yaml @@ -0,0 +1,34 @@ +get: + operationId: GetCustomerGroupsGroupCustomers + summary: List Customers + description: Retrieves a list of customers in a customer group + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the customer group. + schema: + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customers: + type: array + items: + $ref: ../components/schemas/customer.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml b/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml new file mode 100644 index 0000000000..c139980b1f --- /dev/null +++ b/docs/api/admin/paths/customer-groups_{id}_customers_batch.yaml @@ -0,0 +1,80 @@ +post: + operationId: PostCustomerGroupsGroupCustomersBatch + summary: 'Add a list of customers to a customer group ' + description: Adds a list of customers, represented by id's, to a customer group. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the customer group. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - customer_ids + properties: + customer_ids: + description: The ids of the customers to add + type: array + items: + required: + - id + properties: + id: + description: ID of the customer + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: ../components/schemas/customer_group.yaml +delete: + operationId: DeleteCustomerGroupsGroupCustomerBatch + summary: 'Remove a list of customers from a customer group ' + description: Removes a list of customers, represented by id's, from a customer group. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the customer group. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - customer_ids + properties: + customer_ids: + description: The ids of the customers to remove + type: array + items: + required: + - id + properties: + id: + description: ID of the customer + type: string + tags: + - Customer Group + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: ../components/schemas/customer_group.yaml diff --git a/docs/api/admin/paths/customers.yaml b/docs/api/admin/paths/customers.yaml new file mode 100644 index 0000000000..a72518f26b --- /dev/null +++ b/docs/api/admin/paths/customers.yaml @@ -0,0 +1,98 @@ +post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + - first_name + - last_name + - password + properties: + email: + type: string + description: The customer's email. + format: email + first_name: + type: string + description: The customer's first name. + last_name: + type: string + description: The customer's last name. + password: + type: string + description: The customer's password. + format: password + phone: + type: string + description: The customer's phone number. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Customer + responses: + '201': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml +get: + operationId: GetCustomers + summary: List Customers + description: Retrieves a list of Customers. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to return. + schema: + type: integer + default: 50 + - in: query + name: offset + description: The items to skip before result. + schema: + type: integer + default: 0 + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: q + description: a search term to search email, first_name, and last_name. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customers: + type: array + items: + $ref: ../components/schemas/customer.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/customers_{id}.yaml b/docs/api/admin/paths/customers_{id}.yaml new file mode 100644 index 0000000000..22b9979e92 --- /dev/null +++ b/docs/api/admin/paths/customers_{id}.yaml @@ -0,0 +1,103 @@ +get: + operationId: GetCustomersCustomer + summary: Retrieve a Customer + description: Retrieves a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in the customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be included in the customer. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml +post: + operationId: PostCustomersCustomer + summary: Update a Customer + description: Updates a Customer. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Customer. + schema: + type: string + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + email: + type: string + description: The Customer's email. + format: email + first_name: + type: string + description: The Customer's first name. + last_name: + type: string + description: The Customer's last name. + phone: + type: string + description: The Customer's phone number. + password: + type: string + description: The Customer's password. + format: password + groups: + type: array + items: + required: + - id + properties: + id: + description: The ID of a customer group + type: string + description: A list of customer groups to which the customer belongs. + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml diff --git a/docs/api/admin/paths/discounts.yaml b/docs/api/admin/paths/discounts.yaml new file mode 100644 index 0000000000..419c5b4bb5 --- /dev/null +++ b/docs/api/admin/paths/discounts.yaml @@ -0,0 +1,250 @@ +post: + operationId: PostDiscounts + summary: Creates a Discount + x-authenticated: true + description: >- + Creates a Discount with a given set of rules that define how the Discount + behaves. + parameters: + - in: query + name: expand + description: (Comma separated) Which fields should be expanded in each customer. + schema: + type: string + - in: query + name: fields + description: (Comma separated) Which fields should be retrieved in each customer. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - code + - rule + properties: + code: + type: string + description: A unique code that will be used to redeem the Discount + is_dynamic: + type: boolean + description: >- + Whether the Discount should have multiple instances of itself, + each with a different code. This can be useful for automatically + generated codes that all have to follow a common set of rules. + default: false + rule: + description: The Discount Rule that defines how Discounts are calculated + type: object + required: + - type + - value + - allocation + properties: + description: + type: string + description: A short description of the discount + type: + type: string + description: >- + The type of the Discount, can be `fixed` for discounts that + reduce the price by a fixed amount, `percentage` for + percentage reductions or `free_shipping` for shipping + vouchers. + enum: + - fixed + - percentage + - free_shipping + value: + type: number + description: >- + The value that the discount represents; this will depend on + the type of the discount + allocation: + type: string + description: The scope that the discount should apply to. + enum: + - total + - item + conditions: + type: array + description: >- + A set of conditions that can be used to limit when the + discount can be used. Only one of `products`, + `product_types`, `product_collections`, `product_tags`, and + `customer_groups` should be provided. + items: + type: object + required: + - operator + properties: + operator: + type: string + description: Operator of the condition + enum: + - in + - not_in + products: + type: array + description: >- + list of product IDs if the condition is applied on + products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is applied + on product types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is + applied on product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is applied on + product tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is applied + on customer groups. + items: + type: string + is_disabled: + type: boolean + description: >- + Whether the Discount code is disabled on creation. You will have + to enable it later to make it available to Customers. + default: false + starts_at: + type: string + format: date-time + description: The time at which the Discount should be available. + ends_at: + type: string + format: date-time + description: The time at which the Discount should no longer be available. + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + regions: + description: >- + A list of Region ids representing the Regions in which the + Discount can be used. + type: array + items: + type: string + usage_limit: + type: number + description: Maximum times the discount can be used + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml +get: + operationId: GetDiscounts + summary: List Discounts + x-authenticated: true + description: Retrieves a list of Discounts + parameters: + - in: query + name: q + description: Search query applied on the code field. + schema: + type: string + - in: query + name: rule + description: Discount Rules filters to apply on the search + schema: + type: object + properties: + type: + type: string + enum: + - fixed + - percentage + - free_shipping + description: >- + The type of the Discount, can be `fixed` for discounts that reduce + the price by a fixed amount, `percentage` for percentage + reductions or `free_shipping` for shipping vouchers. + allocation: + type: string + enum: + - total + - item + description: >- + The value that the discount represents; this will depend on the + type of the discount + - in: query + name: is_dynamic + description: Return only dynamic discounts. + schema: + type: boolean + - in: query + name: is_disabled + description: Return only disabled discounts. + schema: + type: boolean + - in: query + name: limit + description: The number of items in the response + schema: + type: number + default: '20' + - in: query + name: offset + description: The offset of items in response + schema: + type: number + default: '0' + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discounts: + type: array + items: + $ref: ../components/schemas/discount.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/discounts_code_{code}.yaml b/docs/api/admin/paths/discounts_code_{code}.yaml new file mode 100644 index 0000000000..eea7f4d09e --- /dev/null +++ b/docs/api/admin/paths/discounts_code_{code}.yaml @@ -0,0 +1,33 @@ +get: + operationId: GetDiscountsDiscountCode + summary: Retrieve a Discount by code + description: Retrieves a Discount by its discount code + x-authenticated: true + parameters: + - in: path + name: code + required: true + description: The code of the Discount + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml diff --git a/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml b/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml new file mode 100644 index 0000000000..017f75a49a --- /dev/null +++ b/docs/api/admin/paths/discounts_{discount_id}_conditions.yaml @@ -0,0 +1,86 @@ +post: + operationId: PostDiscountsDiscountConditions + summary: >- + Creates a DiscountCondition. Only one of `products`, `product_types`, + `product_collections`, `product_tags`, and `customer_groups` should be + provided. + x-authenticated: true + parameters: + - in: path + name: discount_id + required: true + description: The ID of the Product. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each product of the + result. + schema: + type: string + description: Creates a DiscountCondition + requestBody: + content: + application/json: + schema: + required: + - operator + properties: + operator: + description: Operator of the condition + type: string + enum: + - in + - not_in + products: + type: array + description: list of product IDs if the condition is applied on products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is applied on product + types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is applied on + product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is applied on product + tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is applied on + customer groups. + items: + type: string + tags: + - Discount Condition + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml diff --git a/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml b/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml new file mode 100644 index 0000000000..757656fb12 --- /dev/null +++ b/docs/api/admin/paths/discounts_{discount_id}_conditions_{condition_id}.yaml @@ -0,0 +1,176 @@ +delete: + operationId: DeleteDiscountsDiscountConditionsCondition + summary: Delete a DiscountCondition + description: Deletes a DiscountCondition + x-authenticated: true + parameters: + - in: path + name: discount_id + required: true + description: The ID of the Discount + schema: + type: string + - in: path + name: condition_id + required: true + description: The ID of the DiscountCondition + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + tags: + - Discount Condition + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted DiscountCondition + object: + type: string + description: The type of the object that was deleted. + default: discount-condition + deleted: + type: boolean + description: >- + Whether the discount condition was deleted successfully or + not. + default: true + discount: + description: The Discount to which the condition used to belong + $ref: ../components/schemas/discount.yaml +get: + operationId: GetDiscountsDiscountConditionsCondition + summary: Gets a DiscountCondition + x-authenticated: true + parameters: + - in: path + name: discount_id + required: true + description: The ID of the Discount. + schema: + type: string + - in: path + name: condition_id + required: true + description: The ID of the DiscountCondition. + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + description: Gets a DiscountCondition + tags: + - Discount Condition + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount_condition: + $ref: ../components/schemas/discount_condition.yaml +post: + operationId: PostDiscountsDiscountConditionsCondition + summary: >- + Updates a DiscountCondition. Only one of `products`, `product_types`, + `product_collections`, `product_tags`, and `customer_groups` should be + provided. + x-authenticated: true + parameters: + - in: path + name: discount_id + required: true + description: The ID of the Product. + schema: + type: string + - in: path + name: condition_id + required: true + description: The ID of the DiscountCondition. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each item of the + result. + schema: + type: string + description: Updates a DiscountCondition + requestBody: + content: + application/json: + schema: + properties: + products: + type: array + description: list of product IDs if the condition is applied on products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is applied on product + types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is applied on + product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is applied on product + tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is applied on + customer groups. + items: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml diff --git a/docs/api/admin/paths/discounts_{id}.yaml b/docs/api/admin/paths/discounts_{id}.yaml new file mode 100644 index 0000000000..d975584355 --- /dev/null +++ b/docs/api/admin/paths/discounts_{id}.yaml @@ -0,0 +1,221 @@ +delete: + operationId: DeleteDiscountsDiscount + summary: Delete a Discount + description: Deletes a Discount. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Discount + object: + type: string + description: The type of the object that was deleted. + default: discount + deleted: + type: boolean + description: Whether the discount was deleted successfully or not. + default: true +get: + operationId: GetDiscountsDiscount + summary: Retrieve a Discount + description: Retrieves a Discount + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount + schema: + type: string + - in: query + name: expand + description: Comma separated list of relations to include in the results. + schema: + type: string + - in: query + name: fields + description: Comma separated list of fields to include in the results. + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml +post: + operationId: PostDiscountsDiscount + summary: Update a Discount + description: >- + Updates a Discount with a given set of rules that define how the Discount + behaves. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each item of the + result. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + code: + type: string + description: A unique code that will be used to redeem the Discount + rule: + description: The Discount Rule that defines how Discounts are calculated + type: object + required: + - id + properties: + id: + type: string + description: The ID of the Rule + description: + type: string + description: A short description of the discount + value: + type: number + description: >- + The value that the discount represents; this will depend on + the type of the discount + allocation: + type: string + description: The scope that the discount should apply to. + enum: + - total + - item + conditions: + type: array + description: >- + A set of conditions that can be used to limit when the + discount can be used. Only one of `products`, + `product_types`, `product_collections`, `product_tags`, and + `customer_groups` should be provided. + items: + type: object + required: + - operator + properties: + id: + type: string + description: The ID of the Rule + operator: + type: string + description: Operator of the condition + enum: + - in + - not_in + products: + type: array + description: >- + list of product IDs if the condition is applied on + products. + items: + type: string + product_types: + type: array + description: >- + list of product type IDs if the condition is applied + on product types. + items: + type: string + product_collections: + type: array + description: >- + list of product collection IDs if the condition is + applied on product collections. + items: + type: string + product_tags: + type: array + description: >- + list of product tag IDs if the condition is applied on + product tags. + items: + type: string + customer_groups: + type: array + description: >- + list of customer group IDs if the condition is applied + on customer groups. + items: + type: string + is_disabled: + type: boolean + description: >- + Whether the Discount code is disabled on creation. You will have + to enable it later to make it available to Customers. + starts_at: + type: string + format: date-time + description: The time at which the Discount should be available. + ends_at: + type: string + format: date-time + description: The time at which the Discount should no longer be available. + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + usage_limit: + type: number + description: Maximum times the discount can be used + regions: + description: >- + A list of Region ids representing the Regions in which the + Discount can be used. + type: array + items: + type: string + metadata: + description: An object containing metadata of the discount + type: object + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml diff --git a/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml b/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml new file mode 100644 index 0000000000..9d88c80442 --- /dev/null +++ b/docs/api/admin/paths/discounts_{id}_dynamic-codes.yaml @@ -0,0 +1,45 @@ +post: + operationId: PostDiscountsDiscountDynamicCodes + summary: Create a dynamic Discount code + description: >- + Creates a unique code that can map to a parent Discount. This is useful if + you want to automatically generate codes with the same behaviour. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount to create the dynamic code from." + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - code + properties: + code: + type: string + description: The unique code that will be used to redeem the Discount. + usage_limit: + type: number + default: '1' + description: amount of times the discount can be applied. + metadata: + type: object + description: >- + An optional set of key-value paris to hold additional + information. diff --git a/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml b/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml new file mode 100644 index 0000000000..7b7eaaf5ff --- /dev/null +++ b/docs/api/admin/paths/discounts_{id}_dynamic-codes_{code}.yaml @@ -0,0 +1,29 @@ +delete: + operationId: DeleteDiscountsDiscountDynamicCodesCode + summary: Delete a dynamic code + description: Deletes a dynamic code from a Discount. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount + schema: + type: string + - in: path + name: code + required: true + description: The ID of the Discount + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml diff --git a/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml b/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml new file mode 100644 index 0000000000..20d08f82be --- /dev/null +++ b/docs/api/admin/paths/discounts_{id}_regions_{region_id}.yaml @@ -0,0 +1,58 @@ +post: + operationId: PostDiscountsDiscountRegionsRegion + summary: Adds Region availability + description: Adds a Region to the list of Regions that a Discount can be used in. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Discount. + schema: + type: string + - in: path + name: region_id + required: true + description: The ID of the Region. + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml +delete: + operationId: DeleteDiscountsDiscountRegionsRegion + summary: Remove Region availability + x-authenticated: true + description: Removes a Region from the list of Regions that a Discount can be used in. + parameters: + - in: path + name: id + required: true + description: The ID of the Discount. + schema: + type: string + - in: path + name: region_id + required: true + description: The ID of the Region. + schema: + type: string + tags: + - Discount + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + discount: + $ref: ../components/schemas/discount.yaml diff --git a/docs/api/admin/paths/draft-orders.yaml b/docs/api/admin/paths/draft-orders.yaml new file mode 100644 index 0000000000..6248fa51be --- /dev/null +++ b/docs/api/admin/paths/draft-orders.yaml @@ -0,0 +1,162 @@ +post: + operationId: PostDraftOrders + summary: Create a Draft Order + description: Creates a Draft Order + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + - items + - region_id + - shipping_methods + properties: + status: + description: The status of the draft order + type: string + enum: + - open + - completed + email: + description: The email of the customer of the draft order + type: string + format: email + billing_address: + description: The Address to be used for billing purposes. + $ref: ../components/schemas/address.yaml + shipping_address: + description: The Address to be used for shipping. + $ref: ../components/schemas/address.yaml + items: + description: The Line Items that have been received. + type: array + items: + type: object + required: + - quantity + properties: + variant_id: + description: >- + The ID of the Product Variant to generate the Line Item + from. + type: string + unit_price: + description: The potential custom price of the item. + type: integer + title: + description: The potential custom title of the item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + metadata: + description: >- + The optional key-value map with additional details about + the Line Item. + type: object + region_id: + description: The ID of the region for the draft order + type: string + discounts: + description: The discounts to add on the draft order + type: array + items: + type: object + required: + - code + properties: + code: + description: The code of the discount to apply + type: string + customer_id: + description: The ID of the customer to add on the draft order + type: string + no_notification_order: + description: >- + An optional flag passed to the resulting order to determine use + of notifications. + type: boolean + shipping_methods: + description: The shipping methods for the draft order + type: array + items: + type: object + required: + - option_id + properties: + option_id: + description: The ID of the shipping option in use + type: string + data: + description: >- + The optional additional data needed for the shipping + method + type: object + price: + description: The potential custom price of the shipping + type: integer + metadata: + description: >- + The optional key-value map with additional details about the + Draft Order. + type: object + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_order: + $ref: ../components/schemas/draft-order.yaml +get: + operationId: GetDraftOrders + summary: List Draft Orders + description: Retrieves an list of Draft Orders + x-authenticated: true + parameters: + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: number + default: '0' + - in: query + name: limit + description: Limit the number of items returned. + schema: + type: number + default: '50' + - in: query + name: q + description: >- + a search term to search emails in carts associated with draft orders and + display IDs of draft orders + schema: + type: string + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_orders: + type: array + items: + $ref: ../components/schemas/draft-order.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/draft-orders_{id}.yaml b/docs/api/admin/paths/draft-orders_{id}.yaml new file mode 100644 index 0000000000..ba4d184535 --- /dev/null +++ b/docs/api/admin/paths/draft-orders_{id}.yaml @@ -0,0 +1,55 @@ +delete: + operationId: DeleteDraftOrdersDraftOrder + summary: Delete a Draft Order + description: Deletes a Draft Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Draft Order. + object: + type: string + description: The type of the object that was deleted. + default: draft-order + deleted: + type: boolean + description: Whether the draft order was deleted successfully or not. + default: true +get: + operationId: GetDraftOrdersDraftOrder + summary: Retrieve a Draft Order + description: Retrieves a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_order: + $ref: ../components/schemas/draft-order.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}_line-items.yaml b/docs/api/admin/paths/draft-orders_{id}_line-items.yaml new file mode 100644 index 0000000000..c148eb193f --- /dev/null +++ b/docs/api/admin/paths/draft-orders_{id}_line-items.yaml @@ -0,0 +1,48 @@ +post: + operationId: PostDraftOrdersDraftOrderLineItems + summary: Create a Line Item for Draft Order + description: Creates a Line Item for the Draft Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - quantity + properties: + variant_id: + description: The ID of the Product Variant to generate the Line Item from. + type: string + unit_price: + description: The potential custom price of the item. + type: integer + title: + description: The potential custom title of the item. + type: string + default: Custom item + quantity: + description: The quantity of the Line Item. + type: integer + metadata: + description: >- + The optional key-value map with additional details about the + Line Item. + type: object + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_order: + $ref: ../components/schemas/draft-order.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml b/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml new file mode 100644 index 0000000000..d9910fda20 --- /dev/null +++ b/docs/api/admin/paths/draft-orders_{id}_line-items_{line_id}.yaml @@ -0,0 +1,77 @@ +delete: + operationId: DeleteDraftOrdersDraftOrderLineItemsItem + summary: Delete a Line Item + description: Removes a Line Item from a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + - in: path + name: line_id + required: true + description: The ID of the Draft Order. + schema: + type: string + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_order: + $ref: ../components/schemas/draft-order.yaml +post: + operationId: PostDraftOrdersDraftOrderLineItemsItem + summary: Update a Line Item for a Draft Order + description: Updates a Line Item for a Draft Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Draft Order. + schema: + type: string + - in: path + name: line_id + required: true + description: The ID of the Line Item. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + unit_price: + description: The potential custom price of the item. + type: integer + title: + description: The potential custom title of the item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + metadata: + description: >- + The optional key-value map with additional details about the + Line Item. + type: object + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + draft_order: + $ref: ../components/schemas/draft-order.yaml diff --git a/docs/api/admin/paths/draft-orders_{id}_pay.yaml b/docs/api/admin/paths/draft-orders_{id}_pay.yaml new file mode 100644 index 0000000000..86e17e1c26 --- /dev/null +++ b/docs/api/admin/paths/draft-orders_{id}_pay.yaml @@ -0,0 +1,23 @@ +post: + summary: Registers a payment for a Draft Order + operationId: PostDraftOrdersDraftOrderRegisterPayment + description: Registers a payment for a Draft Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The Draft Order id. + schema: + type: string + tags: + - Draft Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/draft-order.yaml diff --git a/docs/api/admin/paths/gift-cards.yaml b/docs/api/admin/paths/gift-cards.yaml new file mode 100644 index 0000000000..cc8188b39d --- /dev/null +++ b/docs/api/admin/paths/gift-cards.yaml @@ -0,0 +1,90 @@ +post: + operationId: PostGiftCards + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card is + only valid within 1 region. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - region_id + properties: + value: + type: integer + description: The value (excluding VAT) that the Gift Card should represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have to + enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: The time at which the Gift Card should no longer be available. + region_id: + description: The ID of the Region in which the Gift Card can be used. + type: string + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: ../components/schemas/gift_card.yaml +get: + operationId: GetGiftCards + summary: List Gift Cards + description: Retrieves a list of Gift Cards. + x-authenticated: true + parameters: + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: number + default: '0' + - in: query + name: limit + description: Limit the number of items returned. + schema: + type: number + default: '50' + - in: query + name: q + description: a search term to search by code or display ID + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_cards: + type: array + items: + $ref: ../components/schemas/gift_card.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/gift-cards_{id}.yaml b/docs/api/admin/paths/gift-cards_{id}.yaml new file mode 100644 index 0000000000..14cfd47017 --- /dev/null +++ b/docs/api/admin/paths/gift-cards_{id}.yaml @@ -0,0 +1,105 @@ +delete: + operationId: DeleteGiftCardsGiftCard + summary: Delete a Gift Card + description: Deletes a Gift Card + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Gift Card to delete. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Gift Card + object: + type: string + description: The type of the object that was deleted. + default: gift-card + deleted: + type: boolean + description: Whether the gift card was deleted successfully or not. + default: true +get: + operationId: GetGiftCardsGiftCard + summary: Retrieve a Gift Card + description: Retrieves a Gift Card. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Gift Card. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: ../components/schemas/gift_card.yaml +post: + operationId: PostGiftCardsGiftCard + summary: Create a Gift Card + description: >- + Creates a Gift Card that can redeemed by its unique code. The Gift Card is + only valid within 1 region. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Gift Card. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + balance: + type: integer + description: The value (excluding VAT) that the Gift Card should represent. + is_disabled: + type: boolean + description: >- + Whether the Gift Card is disabled on creation. You will have to + enable it later to make it available to Customers. + ends_at: + type: string + format: date-time + description: The time at which the Gift Card should no longer be available. + region_id: + description: The ID of the Region in which the Gift Card can be used. + type: string + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: ../components/schemas/gift_card.yaml diff --git a/docs/api/admin/paths/invites.yaml b/docs/api/admin/paths/invites.yaml new file mode 100644 index 0000000000..85b31b2ae2 --- /dev/null +++ b/docs/api/admin/paths/invites.yaml @@ -0,0 +1,47 @@ +post: + operationId: PostInvites + summary: Create an Invite + description: Creates an Invite and triggers an 'invite' created event + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - user + - role + properties: + user: + description: The email for the user to be created. + type: string + format: email + role: + description: The role of the user to be created. + type: string + enum: + - admin + - member + - developer + tags: + - Invite + responses: + '200': + description: OK +get: + operationId: GetInvites + summary: Lists all Invites + description: Lists all Invites + x-authenticated: true + tags: + - Invite + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + invites: + type: array + items: + $ref: ../components/schemas/invite.yaml diff --git a/docs/api/admin/paths/invites_accept.yaml b/docs/api/admin/paths/invites_accept.yaml new file mode 100644 index 0000000000..35e7f50f1d --- /dev/null +++ b/docs/api/admin/paths/invites_accept.yaml @@ -0,0 +1,38 @@ +post: + operationId: PostInvitesInviteAccept + summary: Accept an Invite + description: Accepts an Invite and creates a corresponding user + requestBody: + content: + application/json: + schema: + required: + - token + - user + properties: + token: + description: The invite token provided by the admin. + type: string + user: + description: The User to create. + type: object + required: + - first_name + - last_name + - password + properties: + first_name: + type: string + description: the first name of the User + last_name: + type: string + description: the last name of the User + password: + description: The desired password for the User + type: string + format: password + tags: + - Invite + responses: + '200': + description: OK diff --git a/docs/api/admin/paths/invites_{invite_id}.yaml b/docs/api/admin/paths/invites_{invite_id}.yaml new file mode 100644 index 0000000000..4724f1dfc0 --- /dev/null +++ b/docs/api/admin/paths/invites_{invite_id}.yaml @@ -0,0 +1,32 @@ +delete: + operationId: DeleteInvitesInvite + summary: Create an Invite + description: Creates an Invite and triggers an 'invite' created event + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + schema: + type: string + tags: + - Invite + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Invite. + object: + type: string + description: The type of the object that was deleted. + format: invite + deleted: + type: boolean + description: Whether or not the Invite was deleted. + default: true diff --git a/docs/api/admin/paths/invites_{invite_id}_resend.yaml b/docs/api/admin/paths/invites_{invite_id}_resend.yaml new file mode 100644 index 0000000000..6c1f0662a2 --- /dev/null +++ b/docs/api/admin/paths/invites_{invite_id}_resend.yaml @@ -0,0 +1,17 @@ +post: + operationId: PostInvitesInviteResend + summary: Resend an Invite + description: Resends an Invite by triggering the 'invite' created event again + x-authenticated: true + parameters: + - in: path + name: invite_id + required: true + description: The ID of the Invite + schema: + type: string + tags: + - Invite + responses: + '200': + description: OK diff --git a/docs/api/admin/paths/notes.yaml b/docs/api/admin/paths/notes.yaml new file mode 100644 index 0000000000..15e516465b --- /dev/null +++ b/docs/api/admin/paths/notes.yaml @@ -0,0 +1,79 @@ +post: + operationId: PostNotes + summary: Creates a Note + description: Creates a Note which can be associated with any resource as required. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - resource_id + - resource_type + - value + properties: + resource_id: + type: string + description: The ID of the resource which the Note relates to. + resource_type: + type: string + description: The type of resource which the Note relates to. + value: + type: string + description: The content of the Note to create. + tags: + - Note + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + note: + $ref: ../components/schemas/note.yaml +get: + operationId: GetNotes + summary: List Notes + x-authenticated: true + description: Retrieves a list of notes + parameters: + - in: query + name: limit + description: The number of notes to get + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset at which to get notes + schema: + type: number + default: '0' + - in: query + name: resource_id + description: The ID which the notes belongs to + schema: + type: string + tags: + - Note + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + notes: + type: array + items: + $ref: ../components/schemas/note.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/notes_{id}.yaml b/docs/api/admin/paths/notes_{id}.yaml new file mode 100644 index 0000000000..24f0700f3c --- /dev/null +++ b/docs/api/admin/paths/notes_{id}.yaml @@ -0,0 +1,88 @@ +delete: + operationId: DeleteNotesNote + summary: Deletes a Note + description: Deletes a Note. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Note to delete. + schema: + type: string + tags: + - Note + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Note. + object: + type: string + description: The type of the object that was deleted. + default: note + deleted: + type: boolean + description: Whether or not the Note was deleted. + default: true +get: + operationId: GetNotesNote + summary: Get Note + description: Retrieves a single note using its id + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the note to retrieve. + schema: + type: string + tags: + - Note + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + note: + $ref: ../components/schemas/note.yaml +post: + operationId: PostNotesNote + summary: Updates a Note + x-authenticated: true + description: Updates a Note associated with some resource + parameters: + - in: path + name: id + required: true + description: The ID of the Note to update + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - value + properties: + value: + type: string + description: The updated description of the Note. + tags: + - Note + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + note: + $ref: ../components/schemas/note.yaml diff --git a/docs/api/admin/paths/notifications.yaml b/docs/api/admin/paths/notifications.yaml new file mode 100644 index 0000000000..9aa2ca712f --- /dev/null +++ b/docs/api/admin/paths/notifications.yaml @@ -0,0 +1,72 @@ +get: + operationId: GetNotifications + summary: List Notifications + description: Retrieves a list of Notifications. + x-authenticated: true + parameters: + - in: query + name: offset + description: >- + The number of notifications to skip before starting to collect the + notifications set + schema: + type: integer + default: 0 + - in: query + name: limit + description: The number of notifications to return + schema: + type: integer + default: 50 + - in: query + name: fields + description: Comma separated fields to include in the result set + schema: + type: string + - in: query + name: expand + description: Comma separated fields to populate + schema: + type: string + - in: query + name: event_name + description: The name of the event that the notification was sent for. + schema: + type: string + - in: query + name: resource_type + description: The type of resource that the Notification refers to. + schema: + type: string + - in: query + name: resource_id + description: The ID of the resource that the Notification refers to. + schema: + type: string + - in: query + name: to + description: >- + 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 + schema: + type: string + - in: query + name: include_resends + description: >- + A boolean indicating whether the result set should include resent + notifications or not + schema: + type: string + tags: + - Notification + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + notifications: + type: array + items: + $ref: ../components/schemas/notification.yaml diff --git a/docs/api/admin/paths/notifications_{id}_resend.yaml b/docs/api/admin/paths/notifications_{id}_resend.yaml new file mode 100644 index 0000000000..72f58d9fad --- /dev/null +++ b/docs/api/admin/paths/notifications_{id}_resend.yaml @@ -0,0 +1,35 @@ +post: + operationId: PostNotificationsNotificationResend + summary: Resend Notification + description: >- + Resends a previously sent notifications, with the same data but optionally + to a different address + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Notification + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + to: + description: >- + A new address or user identifier that the Notification should be + sent to + type: string + tags: + - Notification + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + notification: + $ref: ../components/schemas/notification.yaml diff --git a/docs/api/admin/paths/order_{id}_claims.yaml b/docs/api/admin/paths/order_{id}_claims.yaml new file mode 100644 index 0000000000..3d27b2d2f5 --- /dev/null +++ b/docs/api/admin/paths/order_{id}_claims.yaml @@ -0,0 +1,144 @@ +post: + operationId: PostOrdersOrderClaims + summary: Create a Claim + description: Creates a Claim. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - type + - claim_items + properties: + type: + description: >- + The type of the Claim. This will determine how the Claim is + treated: `replace` Claims will result in a Fulfillment with new + items being created, while a `refund` Claim will refund the + amount paid for the claimed items. + type: string + enum: + - replace + - refund + claim_items: + description: The Claim Items that the Claim will consist of. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item that will be claimed. + type: string + quantity: + description: The number of items that will be returned + type: integer + note: + description: Short text describing the Claim Item in further detail. + type: string + reason: + description: The reason for the Claim + type: string + enum: + - missing_item + - wrong_item + - production_failure + - other + tags: + description: A list o tags to add to the Claim Item + type: array + items: + type: string + images: + description: >- + A list of image URL's that will be associated with the + Claim + items: + type: string + return_shipping: + description: >- + Optional details for the Return Shipping Method, if the items + are to be sent back. + type: object + properties: + option_id: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + price: + type: integer + description: The price to charge for the Shipping Method. + additional_items: + description: >- + The new items to send to the Customer when the Claim type is + Replace. + type: array + items: + required: + - variant_id + - quantity + properties: + variant_id: + description: The ID of the Product Variant to ship. + type: string + quantity: + description: The quantity of the Product Variant to ship. + type: integer + shipping_methods: + description: The Shipping Methods to send the additional Line Items with. + type: array + items: + properties: + id: + description: The ID of an existing Shipping Method + type: string + option_id: + description: >- + The ID of the Shipping Option to create a Shipping Method + from + type: string + price: + description: The price to charge for the Shipping Method + type: integer + shipping_address: + type: object + description: >- + An optional shipping address to send the claim to. Defaults to + the parent order's shipping address + $ref: ../components/schemas/address.yaml + refund_amount: + description: >- + The amount to refund the Customer when the Claim type is + `refund`. + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Claim. + type: boolean + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml b/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml new file mode 100644 index 0000000000..8e9a412acd --- /dev/null +++ b/docs/api/admin/paths/order_{id}_claims_{claim_id}.yaml @@ -0,0 +1,120 @@ +post: + operationId: PostOrdersOrderClaimsClaim + summary: Update a Claim + description: Updates a Claim. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + claim_items: + description: The Claim Items that the Claim will consist of. + type: array + items: + required: + - id + - images + - tags + properties: + id: + description: The ID of the Claim Item. + type: string + item_id: + description: The ID of the Line Item that will be claimed. + type: string + quantity: + description: The number of items that will be returned + type: integer + note: + description: Short text describing the Claim Item in further detail. + type: string + reason: + description: The reason for the Claim + type: string + enum: + - missing_item + - wrong_item + - production_failure + - other + tags: + description: A list o tags to add to the Claim Item + type: array + items: + type: object + properties: + id: + type: string + description: Tag ID + value: + type: string + description: Tag value + images: + description: >- + A list of image URL's that will be associated with the + Claim + type: array + items: + type: object + properties: + id: + type: string + description: Image ID + url: + type: string + description: Image URL + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + shipping_methods: + description: The Shipping Methods to send the additional Line Items with. + type: array + items: + properties: + id: + description: The ID of an existing Shipping Method + type: string + option_id: + description: >- + The ID of the Shipping Option to create a Shipping Method + from + type: string + price: + description: The price to charge for the Shipping Method + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/order_{id}_swaps.yaml b/docs/api/admin/paths/order_{id}_swaps.yaml new file mode 100644 index 0000000000..85a0f948b1 --- /dev/null +++ b/docs/api/admin/paths/order_{id}_swaps.yaml @@ -0,0 +1,107 @@ +post: + operationId: PostOrdersOrderSwaps + summary: Create a Swap + description: >- + Creates a Swap. Swaps are used to handle Return of previously purchased + goods and Fulfillment of replacements simultaneously. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - return_items + properties: + return_items: + description: The Line Items to return as part of the Swap. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item that will be claimed. + type: string + quantity: + description: The number of items that will be returned + type: integer + reason_id: + description: The ID of the Return Reason to use. + type: string + note: + description: An optional note with information about the Return. + type: string + return_shipping: + description: How the Swap will be returned. + type: object + required: + - option_id + properties: + option_id: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + price: + type: integer + description: The price to charge for the Shipping Method. + additional_items: + description: The new items to send to the Customer. + type: array + items: + required: + - variant_id + - quantity + properties: + variant_id: + description: The ID of the Product Variant to ship. + type: string + quantity: + description: The quantity of the Product Variant to ship. + type: integer + custom_shipping_options: + description: >- + The custom shipping options to potentially create a Shipping + Method from. + type: array + items: + required: + - option_id + - price + properties: + option_id: + description: >- + The ID of the Shipping Option to override with a custom + price. + type: string + price: + description: The custom price of the Shipping Option. + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + allow_backorder: + description: If true, swaps can be completed with items out of stock + type: boolean + default: true + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders.yaml b/docs/api/admin/paths/orders.yaml new file mode 100644 index 0000000000..da9e4f81b9 --- /dev/null +++ b/docs/api/admin/paths/orders.yaml @@ -0,0 +1,241 @@ +get: + operationId: GetOrders + summary: List Orders + description: Retrieves a list of Orders + x-authenticated: true + parameters: + - in: query + name: q + description: >- + Query used for searching orders by shipping address first name, orders' + email, and orders' display ID + schema: + type: string + - in: query + name: id + description: ID of the order to search for. + schema: + type: string + - in: query + name: status + style: form + explode: false + description: Status to search for + schema: + type: array + items: + type: string + enum: + - pending + - completed + - archived + - canceled + - requires_action + - in: query + name: fulfillment_status + style: form + explode: false + description: Fulfillment status to search for. + schema: + type: array + items: + type: string + enum: + - not_fulfilled + - fulfilled + - partially_fulfilled + - shipped + - partially_shipped + - canceled + - returned + - partially_returned + - requires_action + - in: query + name: payment_status + style: form + explode: false + description: Payment status to search for. + schema: + type: array + items: + type: string + enum: + - captured + - awaiting + - not_paid + - refunded + - partially_refunded + - canceled + - requires_action + - in: query + name: display_id + description: Display ID to search for. + schema: + type: string + - in: query + name: cart_id + description: to search for. + schema: + type: string + - in: query + name: customer_id + description: to search for. + schema: + type: string + - in: query + name: email + description: to search for. + schema: + type: string + - in: query + name: region_id + style: form + explode: false + description: Regions to search orders by + schema: + oneOf: + - type: string + description: ID of a Region. + - type: array + items: + type: string + description: ID of a Region. + - in: query + name: currency_code + style: form + explode: false + description: Currency code to search for + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + - in: query + name: tax_rate + description: to search for. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting orders were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting orders were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: canceled_at + description: Date comparison for when resulting orders were canceled. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: sales_channel_id + style: form + explode: false + description: Filter by Sales Channels + schema: + type: array + items: + type: string + description: The ID of a Sales Channel + - in: query + name: offset + description: How many orders to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of orders returned. + schema: + type: integer + default: 50 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each order of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each order of the + result. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + orders: + type: array + items: + $ref: ../components/schemas/order.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/orders_{id}.yaml b/docs/api/admin/paths/orders_{id}.yaml new file mode 100644 index 0000000000..522232cd00 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}.yaml @@ -0,0 +1,114 @@ +get: + operationId: GetOrdersOrder + summary: Retrieve an Order + description: Retrieves an Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml +post: + operationId: PostOrdersOrder + summary: Update an order + description: Updates and order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + email: + description: the email for the order + type: string + billing_address: + description: Billing address + anyOf: + - $ref: ../components/schemas/address.yaml + shipping_address: + description: Shipping address + anyOf: + - $ref: ../components/schemas/address.yaml + items: + description: The Line Items for the order + type: array + items: + $ref: ../components/schemas/line_item.yaml + region: + description: ID of the region where the order belongs + type: string + discounts: + description: Discounts applied to the order + type: array + items: + $ref: ../components/schemas/discount.yaml + customer_id: + description: ID of the customer + type: string + payment_method: + description: payment method chosen for the order + type: object + properties: + provider_id: + type: string + description: ID of the payment provider + data: + description: Data relevant for the given payment method + type: object + shipping_method: + description: The Shipping Method used for shipping the order. + type: object + properties: + provider_id: + type: string + description: The ID of the shipping provider. + profile_id: + type: string + description: The ID of the shipping profile. + price: + type: integer + description: The price of the shipping. + data: + type: object + description: Data relevant to the specific shipping method. + items: + type: array + items: + $ref: ../components/schemas/line_item.yaml + description: Items to ship + no_notification: + description: >- + A flag to indicate if no notifications should be emitted related + to the updated order. + type: boolean + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_archive.yaml b/docs/api/admin/paths/orders_{id}_archive.yaml new file mode 100644 index 0000000000..7e76e76b62 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_archive.yaml @@ -0,0 +1,23 @@ +post: + operationId: PostOrdersOrderArchive + summary: Archive order + description: Archives the order with the given id. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_cancel.yaml new file mode 100644 index 0000000000..eba6094b48 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_cancel.yaml @@ -0,0 +1,26 @@ +post: + operationId: PostOrdersOrderCancel + summary: Cancel an Order + description: >- + Registers an Order as canceled. This triggers a flow that will cancel any + created Fulfillments and Payments, may fail if the Payment or Fulfillment + Provider is unable to cancel the Payment/Fulfillment. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_capture.yaml b/docs/api/admin/paths/orders_{id}_capture.yaml new file mode 100644 index 0000000000..606f7ec1fa --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_capture.yaml @@ -0,0 +1,23 @@ +post: + operationId: PostOrdersOrderCapture + summary: Capture an Order + description: Captures all the Payments associated with an Order. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml new file mode 100644 index 0000000000..f20534fce9 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_cancel.yaml @@ -0,0 +1,29 @@ +post: + operationId: PostOrdersClaimCancel + summary: Cancels a Claim + description: Cancels a Claim + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml new file mode 100644 index 0000000000..cda549a877 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments.yaml @@ -0,0 +1,44 @@ +post: + operationId: PostOrdersOrderClaimsClaimFulfillments + summary: Create a Claim Fulfillment + description: Creates a Fulfillment for a Claim. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + no_notification: + description: >- + If set to true no notification will be send related to this + Claim. + type: boolean + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml new file mode 100644 index 0000000000..55c62e37fe --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -0,0 +1,35 @@ +post: + operationId: PostOrdersClaimFulfillmentsCancel + summary: Cancels a fulfilmment related to a Claim + description: Registers a Fulfillment as canceled. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order which the Claim relates to. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim which the Fulfillment relates to. + schema: + type: string + - in: path + name: fulfillment_id + required: true + description: The ID of the Fulfillment. + schema: + type: string + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml new file mode 100644 index 0000000000..842f6274e5 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_claims_{claim_id}_shipments.yaml @@ -0,0 +1,44 @@ +post: + operationId: PostOrdersOrderClaimsClaimShipments + summary: Create Claim Shipment + description: Registers a Claim Fulfillment as shipped. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: claim_id + required: true + description: The ID of the Claim. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - fulfillment_id + properties: + fulfillment_id: + description: The ID of the Fulfillment. + type: string + tracking_numbers: + description: The tracking numbers for the shipment. + type: array + items: + type: string + tags: + - Claim + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_complete.yaml b/docs/api/admin/paths/orders_{id}_complete.yaml new file mode 100644 index 0000000000..70d77a6e26 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_complete.yaml @@ -0,0 +1,23 @@ +post: + operationId: PostOrdersOrderComplete + summary: Complete an Order + description: Completes an Order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_fulfillment.yaml b/docs/api/admin/paths/orders_{id}_fulfillment.yaml new file mode 100644 index 0000000000..583f527ead --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_fulfillment.yaml @@ -0,0 +1,56 @@ +post: + operationId: PostOrdersOrderFulfillments + summary: Create a Fulfillment + description: >- + Creates a Fulfillment of an Order - will notify Fulfillment Providers to + prepare a shipment. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - items + properties: + items: + description: The Line Items to include in the Fulfillment. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of Line Item to fulfill. + type: string + quantity: + description: The quantity of the Line Item to fulfill. + type: integer + no_notification: + description: >- + If set to true no notification will be send related to this + Swap. + type: boolean + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml new file mode 100644 index 0000000000..59f192d43c --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -0,0 +1,29 @@ +post: + operationId: PostOrdersOrderFulfillmentsCancel + summary: Cancels a fulfilmment + description: Registers a Fulfillment as canceled. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order which the Fulfillment relates to. + schema: + type: string + - in: path + name: fulfillment_id + required: true + description: The ID of the Fulfillment + schema: + type: string + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_refund.yaml b/docs/api/admin/paths/orders_{id}_refund.yaml new file mode 100644 index 0000000000..5e6f41da7d --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_refund.yaml @@ -0,0 +1,45 @@ +post: + operationId: PostOrdersOrderRefunds + summary: Create a Refund + description: Issues a Refund. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - amount + - reason + properties: + amount: + description: The amount to refund. + type: integer + reason: + description: The reason for the Refund. + type: string + note: + description: A note with additional details about the Refund. + type: string + no_notification: + description: >- + If set to true no notification will be send related to this + Refund. + type: boolean + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_return.yaml b/docs/api/admin/paths/orders_{id}_return.yaml new file mode 100644 index 0000000000..5264c4a659 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_return.yaml @@ -0,0 +1,82 @@ +post: + operationId: PostOrdersOrderReturns + summary: Request a Return + description: >- + Requests a Return. If applicable a return label will be created and other + plugins notified. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - items + properties: + items: + description: The Line Items that will be returned. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item. + type: string + reason_id: + description: The ID of the Return Reason to use. + type: string + note: + description: An optional note with information about the Return. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + return_shipping: + description: The Shipping Method to be used to handle the return shipment. + type: object + properties: + option_id: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + price: + type: integer + description: The price to charge for the Shipping Method. + note: + description: An optional note with information about the Return. + type: string + receive_now: + description: >- + A flag to indicate if the Return should be registerd as received + immediately. + type: boolean + default: false + no_notification: + description: >- + A flag to indicate if no notifications should be emitted related + to the requested Return. + type: boolean + refund: + description: The amount to refund. + type: integer + tags: + - Return + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_shipment.yaml b/docs/api/admin/paths/orders_{id}_shipment.yaml new file mode 100644 index 0000000000..a9b3dfdc00 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_shipment.yaml @@ -0,0 +1,43 @@ +post: + operationId: PostOrdersOrderShipment + summary: Create a Shipment + description: Registers a Fulfillment as shipped. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - fulfillment_id + properties: + fulfillment_id: + description: The ID of the Fulfillment. + type: string + tracking_numbers: + description: The tracking numbers for the shipment. + type: array + items: + type: string + no_notification: + description: >- + If set to true no notification will be send related to this + Shipment. + type: boolean + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_shipping-methods.yaml b/docs/api/admin/paths/orders_{id}_shipping-methods.yaml new file mode 100644 index 0000000000..dbed77554a --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_shipping-methods.yaml @@ -0,0 +1,49 @@ +post: + operationId: PostOrdersOrderShippingMethods + summary: Add a Shipping Method + description: >- + Adds a Shipping Method to an Order. If another Shipping Method exists with + the same Shipping Profile, the previous Shipping Method will be replaced. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - price + - option_id + properties: + price: + type: integer + description: >- + The price (excluding VAT) that should be charged for the + Shipping Method + option_id: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + data: + type: object + description: >- + The data required for the Shipping Option to create a Shipping + Method. This will depend on the Fulfillment Provider. diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml new file mode 100644 index 0000000000..dd1dc6425a --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_cancel.yaml @@ -0,0 +1,29 @@ +post: + operationId: PostOrdersSwapCancel + summary: Cancels a Swap + description: Cancels a Swap + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml new file mode 100644 index 0000000000..e8ee04bebc --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments.yaml @@ -0,0 +1,44 @@ +post: + operationId: PostOrdersOrderSwapsSwapFulfillments + summary: Create a Swap Fulfillment + description: Creates a Fulfillment for a Swap. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + metadata: + description: >- + An optional set of key-value pairs to hold additional + information. + type: object + no_notification: + description: >- + If set to true no notification will be send related to this + Claim. + type: boolean + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml new file mode 100644 index 0000000000..8a7bf82d9b --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_fulfillments_{fulfillment_id}_cancel.yaml @@ -0,0 +1,35 @@ +post: + operationId: PostOrdersSwapFulfillmentsCancel + summary: Cancels a fulfilmment related to a Swap + description: Registers a Fulfillment as canceled. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order which the Swap relates to. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap which the Fulfillment relates to. + schema: + type: string + - in: path + name: fulfillment_id + required: true + description: The ID of the Fulfillment. + schema: + type: string + tags: + - Fulfillment + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml new file mode 100644 index 0000000000..35987dcfdd --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_process-payment.yaml @@ -0,0 +1,32 @@ +post: + operationId: PostOrdersOrderSwapsSwapProcessPayment + summary: Process a Swap difference + description: >- + When there are differences between the returned and shipped Products in a + Swap, the difference must be processed. Either a Refund will be issued or a + Payment will be captured. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml new file mode 100644 index 0000000000..3b6e8b7d82 --- /dev/null +++ b/docs/api/admin/paths/orders_{id}_swaps_{swap_id}_shipments.yaml @@ -0,0 +1,49 @@ +post: + operationId: PostOrdersOrderSwapsSwapShipments + summary: Create Swap Shipment + description: Registers a Swap Fulfillment as shipped. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Order. + schema: + type: string + - in: path + name: swap_id + required: true + description: The ID of the Swap. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - fulfillment_id + properties: + fulfillment_id: + description: The ID of the Fulfillment. + type: string + tracking_numbers: + description: The tracking numbers for the shipment. + type: array + items: + type: string + no_notification: + description: >- + If set to true no notification will be send related to this + Claim. + type: boolean + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/price-lists.yaml b/docs/api/admin/paths/price-lists.yaml new file mode 100644 index 0000000000..291cd17026 --- /dev/null +++ b/docs/api/admin/paths/price-lists.yaml @@ -0,0 +1,263 @@ +post: + operationId: PostPriceListsPriceList + summary: Creates a Price List + description: Creates a Price List + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - name + - description + - type + - prices + properties: + name: + description: The name of the Price List + type: string + description: + description: A description of the Price List. + type: string + starts_at: + description: The date with timezone that the Price List starts being valid. + type: string + format: date + ends_at: + description: The date with timezone that the Price List ends being valid. + type: string + format: date + type: + description: The type of the Price List. + type: string + enum: + - sale + - override + status: + description: The status of the Price List. + type: string + enum: + - active + - draft + prices: + description: The prices of the Price List. + type: array + items: + required: + - amount + - variant_id + properties: + region_id: + description: >- + The ID of the Region for which the price is used. Only + required if currecny_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the price will + be used. Only required if region_id is not provided. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + amount: + description: The amount to charge for the Product Variant. + type: integer + variant_id: + description: The ID of the Variant for which the price is used. + type: string + min_quantity: + description: The minimum quantity for which the price will be used. + type: integer + max_quantity: + description: The maximum quantity for which the price will be used. + type: integer + customer_groups: + type: array + description: A list of customer groups that the Price List applies to. + items: + required: + - id + properties: + id: + description: The ID of a customer group + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: ../components/schemas/price_list.yaml +get: + operationId: GetPriceLists + summary: List Price Lists + description: Retrieves a list of Price Lists. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of items to get + schema: + type: number + default: '10' + - in: query + name: offset + description: The offset at which to get items + schema: + type: number + default: '0' + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each item of the + result. + schema: + type: string + - in: query + name: order + description: field to order results by. + schema: + type: string + - in: query + name: id + description: ID to search for. + schema: + type: string + - in: query + name: q + description: >- + query to search in price list description, price list name, and customer + group name fields. + schema: + type: string + - in: query + name: status + style: form + explode: false + description: Status to search for. + schema: + type: array + items: + type: string + enum: + - active + - draft + - in: query + name: name + description: price list name to search for. + schema: + type: string + - in: query + name: customer_groups + style: form + explode: false + description: Customer Group IDs to search for. + schema: + type: array + items: + type: string + - in: query + name: type + style: form + explode: false + description: Type to search for. + schema: + type: array + items: + type: string + enum: + - sale + - override + - in: query + name: created_at + description: Date comparison for when resulting price lists were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting price lists were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting price lists were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_lists: + type: array + items: + $ref: ../components/schemas/price_list.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/price-lists_:id_products.yaml b/docs/api/admin/paths/price-lists_:id_products.yaml new file mode 100644 index 0000000000..1a0b37b37e --- /dev/null +++ b/docs/api/admin/paths/price-lists_:id_products.yaml @@ -0,0 +1,194 @@ +get: + operationId: GetPriceListsPriceListProducts + summary: List Product in a Price List + description: Retrieves a list of Product that are part of a Price List + x-authenticated: true + parameters: + - in: query + name: q + description: >- + Query used for searching product title and description, variant title + and sku, and collection title. + schema: + type: string + - in: query + name: id + description: ID of the product to search for. + schema: + type: string + - in: query + name: status + description: Product status to search for + style: form + explode: false + schema: + type: array + items: + type: string + enum: + - draft + - proposed + - published + - rejected + - in: query + name: collection_id + description: Collection IDs to search for + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: tags + description: Tag IDs to search for + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: title + description: product title to search for. + schema: + type: string + - in: query + name: description + description: product description to search for. + schema: + type: string + - in: query + name: handle + description: product handle to search for. + schema: + type: string + - in: query + name: is_giftcard + description: Search for giftcards using is_giftcard=true. + schema: + type: string + - in: query + name: type + description: to search for. + schema: + type: string + - in: query + name: order + description: field to sort results by. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting products were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting products were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting products were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + default: 50 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each product of the + result. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + products: + type: array + items: + $ref: ../components/schemas/product.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/price-lists_{id}.yaml b/docs/api/admin/paths/price-lists_{id}.yaml new file mode 100644 index 0000000000..7dbabaccfe --- /dev/null +++ b/docs/api/admin/paths/price-lists_{id}.yaml @@ -0,0 +1,155 @@ +delete: + operationId: DeletePriceListsPriceList + summary: Delete a Price List + description: Deletes a Price List + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List to delete. + schema: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Price List. + object: + type: string + description: The type of the object that was deleted. + default: price-list + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetPriceListsPriceList + summary: Retrieve a Price List + description: Retrieves a Price List. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List. + schema: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: ../components/schemas/price_list.yaml +post: + operationId: PostPriceListsPriceListPriceList + summary: Update a Price List + description: Updates a Price List + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Price List + type: string + description: + description: A description of the Price List. + type: string + starts_at: + description: The date with timezone that the Price List starts being valid. + type: string + format: date + ends_at: + description: The date with timezone that the Price List ends being valid. + type: string + format: date + type: + description: The type of the Price List. + type: string + enum: + - sale + - override + status: + description: The status of the Price List. + type: string + enum: + - active + - draft + prices: + description: The prices of the Price List. + type: array + items: + required: + - amount + - variant_id + properties: + id: + description: The ID of the price. + type: string + region_id: + description: >- + The ID of the Region for which the price is used. Only + required if currecny_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the price will + be used. Only required if region_id is not provided. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + variant_id: + description: The ID of the Variant for which the price is used. + type: string + amount: + description: The amount to charge for the Product Variant. + type: integer + min_quantity: + description: The minimum quantity for which the price will be used. + type: integer + max_quantity: + description: The maximum quantity for which the price will be used. + type: integer + customer_groups: + type: array + description: A list of customer groups that the Price List applies to. + items: + required: + - id + properties: + id: + description: The ID of a customer group + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: ../components/schemas/price_list.yaml diff --git a/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml b/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml new file mode 100644 index 0000000000..c3b2707b6c --- /dev/null +++ b/docs/api/admin/paths/price-lists_{id}_prices_batch.yaml @@ -0,0 +1,115 @@ +post: + operationId: PostPriceListsPriceListPricesBatch + summary: Batch update prices for a Price List + description: Batch update prices for a Price List + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Price List to update prices for. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + prices: + description: The prices to update or add. + type: array + items: + required: + - amount + - variant_id + properties: + id: + description: The ID of the price. + type: string + region_id: + description: >- + The ID of the Region for which the price is used. Only + required if currecny_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the price will + be used. Only required if region_id is not provided. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + variant_id: + description: The ID of the Variant for which the price is used. + type: string + amount: + description: The amount to charge for the Product Variant. + type: integer + min_quantity: + description: The minimum quantity for which the price will be used. + type: integer + max_quantity: + description: The maximum quantity for which the price will be used. + type: integer + override: + description: >- + If true the prices will replace all existing prices associated + with the Price List. + type: boolean + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + price_list: + $ref: ../components/schemas/price_list.yaml +delete: + operationId: DeletePriceListsPriceListPricesBatch + summary: Batch delete prices that belong to a Price List + description: Batch delete prices that belong to a Price List + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: >- + The ID of the Price List that the Money Amounts (Prices) that will be + deleted belongs to. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + price_ids: + description: The price id's of the Money Amounts to delete. + type: array + items: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + ids: + type: array + items: + type: string + description: The IDs of the deleted Money Amounts (Prices). + object: + type: string + description: The type of the object that was deleted. + default: money-amount + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true diff --git a/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml b/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml new file mode 100644 index 0000000000..f75ca0179d --- /dev/null +++ b/docs/api/admin/paths/price-lists_{id}_products_{product_id}_prices.yaml @@ -0,0 +1,42 @@ +delete: + operationId: DeletePriceListsPriceListProductsProductPrices + summary: Delete all the prices related to a specific product in a price list + description: Delete all the prices related to a specific product in a price list + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: >- + The ID of the Price List that the Money Amounts that will be deleted + belongs to. + schema: + type: string + - in: path + name: product_id + required: true + description: The ID of the product from which the money amount will be deleted. + schema: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + ids: + type: array + description: The price ids that have been deleted. + items: + type: string + object: + type: string + description: The type of the object that was deleted. + default: money-amount + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true diff --git a/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml b/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml new file mode 100644 index 0000000000..57c7b119cf --- /dev/null +++ b/docs/api/admin/paths/price-lists_{id}_variants_{variant_id}_prices.yaml @@ -0,0 +1,42 @@ +delete: + operationId: DeletePriceListsPriceListVariantsVariantPrices + summary: Delete all the prices related to a specific variant in a price list + description: Delete all the prices related to a specific variant in a price list + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: >- + The ID of the Price List that the Money Amounts that will be deleted + belongs to. + schema: + type: string + - in: path + name: variant_id + required: true + description: The ID of the variant from which the money amount will be deleted. + schema: + type: string + tags: + - Price List + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + ids: + type: array + description: The price ids that have been deleted. + items: + type: string + object: + type: string + description: The type of the object that was deleted. + default: money-amount + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true diff --git a/docs/api/admin/paths/product-tags.yaml b/docs/api/admin/paths/product-tags.yaml new file mode 100644 index 0000000000..5aa1685ac2 --- /dev/null +++ b/docs/api/admin/paths/product-tags.yaml @@ -0,0 +1,110 @@ +get: + operationId: GetProductTags + summary: List Product Tags + description: Retrieve a list of Product Tags. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of tags to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. + schema: + type: string + - in: query + name: value + style: form + explode: false + description: The tag values to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for + schema: + type: string + - in: query + name: id + style: form + explode: false + description: The tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: created_at + description: Date comparison for when resulting product tags were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting product tags were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Product Tag + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product_tags: + $ref: ../components/schemas/product_tag.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/product-types.yaml b/docs/api/admin/paths/product-types.yaml new file mode 100644 index 0000000000..6c412a776d --- /dev/null +++ b/docs/api/admin/paths/product-types.yaml @@ -0,0 +1,110 @@ +get: + operationId: GetProductTypes + summary: List Product Types + description: Retrieve a list of Product Types. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of types to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The number of items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: order + description: The field to sort items by. + schema: + type: string + - in: query + name: value + style: form + explode: false + description: The type values to search for + schema: + type: array + items: + type: string + - in: query + name: id + style: form + explode: false + description: The type IDs to search for + schema: + type: array + items: + type: string + - in: query + name: q + description: A query string to search values for + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting product types were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting product types were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Product Type + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product_types: + $ref: ../components/schemas/product_type.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/products.yaml b/docs/api/admin/paths/products.yaml new file mode 100644 index 0000000000..42a4488412 --- /dev/null +++ b/docs/api/admin/paths/products.yaml @@ -0,0 +1,469 @@ +post: + operationId: PostProducts + summary: Create a Product + x-authenticated: true + description: Creates a Product + requestBody: + content: + application/json: + schema: + required: + - title + properties: + title: + description: The title of the Product + type: string + subtitle: + description: The subtitle of the Product + type: string + description: + description: A description of the Product. + type: string + is_giftcard: + description: >- + A flag to indicate if the Product represents a Gift Card. + Purchasing Products with this flag set to `true` will result in + a Gift Card being created. + type: boolean + default: false + discountable: + description: >- + A flag to indicate if discounts can be applied to the LineItems + generated from this Product + type: boolean + default: true + images: + description: Images of the Product. + type: array + items: + type: string + thumbnail: + description: The thumbnail to use for the Product. + type: string + handle: + description: A unique handle to identify the Product by. + type: string + status: + description: The status of the product. + type: string + enum: + - draft + - proposed + - published + - rejected + default: draft + type: + description: The Product Type to associate the Product with. + type: object + required: + - value + properties: + id: + description: The ID of the Product Type. + type: string + value: + description: The value of the Product Type. + type: string + collection_id: + description: The ID of the Collection the Product should belong to. + type: string + tags: + description: Tags to associate the Product with. + type: array + items: + required: + - value + properties: + id: + description: The ID of an existing Tag. + type: string + value: + description: The value of the Tag, these will be upserted. + type: string + sales_channels: + description: '[EXPERIMENTAL] Sales channels to associate the Product with.' + type: array + items: + required: + - id + properties: + id: + description: The ID of an existing Sales channel. + type: string + options: + description: >- + The Options that the Product should have. These define on which + properties the Product's Product Variants will differ. + type: array + items: + required: + - title + properties: + title: + description: The title to identify the Product Option by. + type: string + variants: + description: A list of Product Variants to create with the Product. + type: array + items: + required: + - title + properties: + title: + description: The title to identify the Product Variant by. + type: string + sku: + description: The unique SKU for the Product Variant. + type: string + ean: + description: The EAN number of the item. + type: string + upc: + description: The UPC number of the item. + type: string + barcode: + description: A generic GTIN field for the Product Variant. + type: string + hs_code: + description: The Harmonized System code for the Product Variant. + type: string + inventory_quantity: + description: The amount of stock kept for the Product Variant. + type: integer + default: 0 + allow_backorder: + description: >- + Whether the Product Variant can be purchased when out of + stock. + type: boolean + manage_inventory: + description: >- + Whether Medusa should keep track of the inventory for this + Product Variant. + type: boolean + weight: + description: The wieght of the Product Variant. + type: number + length: + description: The length of the Product Variant. + type: number + height: + description: The height of the Product Variant. + type: number + width: + description: The width of the Product Variant. + type: number + origin_country: + description: The country of origin of the Product Variant. + type: string + mid_code: + description: >- + The Manufacturer Identification code for the Product + Variant. + type: string + material: + description: The material composition of the Product Variant. + type: string + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object + prices: + type: array + items: + required: + - amount + properties: + region_id: + description: >- + The ID of the Region for which the price is used. + Only required if currency_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the + price will be used. Only required if region_id is + not provided. + type: string + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + amount: + description: The amount to charge for the Product Variant. + type: integer + min_quantity: + description: >- + The minimum quantity for which the price will be + used. + type: integer + max_quantity: + description: >- + The maximum quantity for which the price will be + used. + type: integer + options: + type: array + items: + required: + - value + properties: + value: + description: >- + The value to give for the Product Option at the same + index in the Product's `options` field. + type: string + weight: + description: The wieght of the Product. + type: number + length: + description: The length of the Product. + type: number + height: + description: The height of the Product. + type: number + width: + description: The width of the Product. + type: number + hs_code: + description: The Harmonized System code for the Product Variant. + type: string + origin_country: + description: The country of origin of the Product. + type: string + mid_code: + description: The Manufacturer Identification code for the Product. + type: string + material: + description: The material composition of the Product. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml +get: + operationId: GetProducts + summary: List Product + description: Retrieves a list of Product + x-authenticated: true + parameters: + - in: query + name: q + description: >- + Query used for searching product title and description, variant title + and sku, and collection title. + schema: + type: string + - in: query + name: id + style: form + explode: false + description: Filter by product IDs. + schema: + oneOf: + - type: string + description: ID of the product to search for. + - type: array + items: + type: string + description: ID of a product. + - in: query + name: status + style: form + explode: false + description: Status to search for + schema: + type: array + items: + type: string + enum: + - draft + - proposed + - published + - rejected + - in: query + name: collection_id + style: form + explode: false + description: Collection ids to search for. + schema: + type: array + items: + type: string + - in: query + name: tags + style: form + explode: false + description: Tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: price_list_id + style: form + explode: false + description: Price List IDs to search for + schema: + type: array + items: + type: string + - in: query + name: sales_channel_id + style: form + explode: false + description: Sales Channel IDs to filter products by + schema: + type: array + items: + type: string + - in: query + name: title + description: title to search for. + schema: + type: string + - in: query + name: description + description: description to search for. + schema: + type: string + - in: query + name: handle + description: handle to search for. + schema: + type: string + - in: query + name: is_giftcard + description: Search for giftcards using is_giftcard=true. + schema: + type: boolean + - in: query + name: type + description: type ID to search for. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting products were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting products were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting products were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + default: 50 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each product of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each product of the + result. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + products: + type: array + items: + $ref: ../components/schemas/product.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/products_tag-usage.yaml b/docs/api/admin/paths/products_tag-usage.yaml new file mode 100644 index 0000000000..20910f398a --- /dev/null +++ b/docs/api/admin/paths/products_tag-usage.yaml @@ -0,0 +1,27 @@ +get: + operationId: GetProductsTagUsage + summary: List Product Tags Usage Number + description: Retrieves a list of Product Tags with how many times each is used. + x-authenticated: true + tags: + - Product Tag + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tags: + type: array + items: + properties: + id: + description: The ID of the tag. + type: string + usage_count: + description: The number of products that use this tag. + type: string + value: + description: The value of the tag. + type: string diff --git a/docs/api/admin/paths/products_types.yaml b/docs/api/admin/paths/products_types.yaml new file mode 100644 index 0000000000..c8bf32459c --- /dev/null +++ b/docs/api/admin/paths/products_types.yaml @@ -0,0 +1,18 @@ +get: + operationId: GetProductsTypes + summary: List Product Types + description: Retrieves a list of Product Types. + x-authenticated: true + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + types: + type: array + items: + $ref: ../components/schemas/product_type.yaml diff --git a/docs/api/admin/paths/products_{id}.yaml b/docs/api/admin/paths/products_{id}.yaml new file mode 100644 index 0000000000..540f1ddcc6 --- /dev/null +++ b/docs/api/admin/paths/products_{id}.yaml @@ -0,0 +1,297 @@ +delete: + operationId: DeleteProductsProduct + summary: Delete a Product + description: Deletes a Product and it's associated Product Variants. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Product. + object: + type: string + description: The type of the object that was deleted. + default: product + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetProductsProduct + summary: Retrieve a Product + description: Retrieves a Product. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml +post: + operationId: PostProductsProduct + summary: Update a Product + description: Updates a Product + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + title: + description: The title of the Product + type: string + subtitle: + description: The subtitle of the Product + type: string + description: + description: A description of the Product. + type: string + discountable: + description: >- + A flag to indicate if discounts can be applied to the LineItems + generated from this Product + type: boolean + images: + description: Images of the Product. + type: array + items: + type: string + thumbnail: + description: The thumbnail to use for the Product. + type: string + handle: + description: A unique handle to identify the Product by. + type: string + status: + description: The status of the product. + type: string + enum: + - draft + - proposed + - published + - rejected + type: + description: The Product Type to associate the Product with. + type: object + required: + - value + properties: + id: + description: The ID of the Product Type. + type: string + value: + description: The value of the Product Type. + type: string + collection_id: + description: The ID of the Collection the Product should belong to. + type: string + tags: + description: Tags to associate the Product with. + type: array + items: + required: + - value + properties: + id: + description: The ID of an existing Tag. + type: string + value: + description: The value of the Tag, these will be upserted. + type: string + sales_channels: + description: '[EXPERIMENTAL] Sales channels to associate the Product with.' + type: array + items: + required: + - id + properties: + id: + description: The ID of an existing Sales channel. + type: string + variants: + description: A list of Product Variants to create with the Product. + type: array + items: + properties: + id: + description: The ID of the Product Variant. + type: string + title: + description: The title to identify the Product Variant by. + type: string + sku: + description: The unique SKU for the Product Variant. + type: string + ean: + description: The EAN number of the item. + type: string + upc: + description: The UPC number of the item. + type: string + barcode: + description: A generic GTIN field for the Product Variant. + type: string + hs_code: + description: The Harmonized System code for the Product Variant. + type: string + inventory_quantity: + description: The amount of stock kept for the Product Variant. + type: integer + allow_backorder: + description: >- + Whether the Product Variant can be purchased when out of + stock. + type: boolean + manage_inventory: + description: >- + Whether Medusa should keep track of the inventory for this + Product Variant. + type: boolean + weight: + description: The wieght of the Product Variant. + type: number + length: + description: The length of the Product Variant. + type: number + height: + description: The height of the Product Variant. + type: number + width: + description: The width of the Product Variant. + type: number + origin_country: + description: The country of origin of the Product Variant. + type: string + mid_code: + description: >- + The Manufacturer Identification code for the Product + Variant. + type: string + material: + description: The material composition of the Product Variant. + type: string + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object + prices: + type: array + items: + required: + - amount + properties: + id: + description: The ID of the Price. + type: string + region_id: + description: >- + The ID of the Region for which the price is used. + Only required if currency_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the + price will be used. Only required if region_id is + not provided. + type: string + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + amount: + description: The amount to charge for the Product Variant. + type: integer + min_quantity: + description: >- + The minimum quantity for which the price will be + used. + type: integer + max_quantity: + description: >- + The maximum quantity for which the price will be + used. + type: integer + options: + type: array + items: + required: + - option_id + - value + properties: + option_id: + description: The ID of the Option. + type: string + value: + description: >- + The value to give for the Product Option at the same + index in the Product's `options` field. + type: string + weight: + description: The wieght of the Product. + type: number + length: + description: The length of the Product. + type: number + height: + description: The height of the Product. + type: number + width: + description: The width of the Product. + type: number + origin_country: + description: The country of origin of the Product. + type: string + mid_code: + description: The Manufacturer Identification code for the Product. + type: string + material: + description: The material composition of the Product. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml diff --git a/docs/api/admin/paths/products_{id}_metadata.yaml b/docs/api/admin/paths/products_{id}_metadata.yaml new file mode 100644 index 0000000000..1af710764c --- /dev/null +++ b/docs/api/admin/paths/products_{id}_metadata.yaml @@ -0,0 +1,37 @@ +post: + operationId: PostProductsProductMetadata + summary: Set Product metadata + description: Set metadata key/value pair for Product + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - key + - value + properties: + key: + description: The metadata key + type: string + value: + description: The metadata value + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml diff --git a/docs/api/admin/paths/products_{id}_options.yaml b/docs/api/admin/paths/products_{id}_options.yaml new file mode 100644 index 0000000000..5624796830 --- /dev/null +++ b/docs/api/admin/paths/products_{id}_options.yaml @@ -0,0 +1,33 @@ +post: + operationId: PostProductsProductOptions + summary: Add an Option + x-authenticated: true + description: Adds a Product Option to a Product + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - title + properties: + title: + description: The title the Product Option will be identified by i.e. "Size" + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml diff --git a/docs/api/admin/paths/products_{id}_options_{option_id}.yaml b/docs/api/admin/paths/products_{id}_options_{option_id}.yaml new file mode 100644 index 0000000000..c63c57913a --- /dev/null +++ b/docs/api/admin/paths/products_{id}_options_{option_id}.yaml @@ -0,0 +1,82 @@ +delete: + operationId: DeleteProductsProductOptionsOption + summary: Delete a Product Option + description: >- + Deletes a Product Option. Before a Product Option can be deleted all Option + Values for the Product Option must be the same. You may, for example, have + to delete some of your variants prior to deleting the Product Option + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + - in: path + name: option_id + required: true + description: The ID of the Product Option. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + option_id: + type: string + description: The ID of the deleted Product Option + object: + type: string + description: The type of the object that was deleted. + default: option + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + product: + $ref: ../components/schemas/product.yaml +post: + operationId: PostProductsProductOptionsOption + summary: Update a Product Option. + description: Updates a Product Option + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + - in: path + name: option_id + required: true + description: The ID of the Product Option. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - title + properties: + title: + description: The title of the Product Option + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml diff --git a/docs/api/admin/paths/products_{id}_variants.yaml b/docs/api/admin/paths/products_{id}_variants.yaml new file mode 100644 index 0000000000..a4319c6c8d --- /dev/null +++ b/docs/api/admin/paths/products_{id}_variants.yaml @@ -0,0 +1,188 @@ +post: + operationId: PostProductsProductVariants + summary: Create a Product Variant + description: >- + Creates a Product Variant. Each Product Variant must have a unique + combination of Product Option Values. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - title + - prices + - options + properties: + title: + description: The title to identify the Product Variant by. + type: string + sku: + description: The unique SKU for the Product Variant. + type: string + ean: + description: The EAN number of the item. + type: string + upc: + description: The UPC number of the item. + type: string + barcode: + description: A generic GTIN field for the Product Variant. + type: string + hs_code: + description: The Harmonized System code for the Product Variant. + type: string + inventory_quantity: + description: The amount of stock kept for the Product Variant. + type: integer + default: 0 + allow_backorder: + description: Whether the Product Variant can be purchased when out of stock. + type: boolean + manage_inventory: + description: >- + Whether Medusa should keep track of the inventory for this + Product Variant. + type: boolean + weight: + description: The wieght of the Product Variant. + type: number + length: + description: The length of the Product Variant. + type: number + height: + description: The height of the Product Variant. + type: number + width: + description: The width of the Product Variant. + type: number + origin_country: + description: The country of origin of the Product Variant. + type: string + mid_code: + description: The Manufacturer Identification code for the Product Variant. + type: string + material: + description: The material composition of the Product Variant. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + prices: + type: array + items: + required: + - amount + properties: + id: + description: The ID of the price. + type: string + region_id: + description: >- + The ID of the Region for which the price is used. Only + required if currency_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the price will + be used. Only required if region_id is not provided. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + amount: + description: The amount to charge for the Product Variant. + type: integer + min_quantity: + description: The minimum quantity for which the price will be used. + type: integer + max_quantity: + description: The maximum quantity for which the price will be used. + type: integer + options: + type: array + items: + required: + - option_id + - value + properties: + option_id: + description: The ID of the Product Option to set the value for. + type: string + value: + description: The value to give for the Product Option. + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml +get: + operationId: GetProductsProductVariants + summary: List a Product's Product Variants + description: Retrieves a list of the Product Variants associated with a Product. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: ID of the product to search for the variants. + schema: + type: string + - in: query + name: fields + description: Comma separated string of the column to select. + schema: + type: string + - in: query + name: expand + description: Comma separated string of the relations to include. + schema: + type: string + - in: query + name: offset + description: How many items to skip before the results. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of items returned. + schema: + type: integer + default: 100 + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variants: + type: array + items: + $ref: ../components/schemas/product_variant.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml b/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml new file mode 100644 index 0000000000..8dde101221 --- /dev/null +++ b/docs/api/admin/paths/products_{id}_variants_{variant_id}.yaml @@ -0,0 +1,171 @@ +delete: + operationId: DeleteProductsProductVariantsVariant + summary: Delete a Product Variant + description: Deletes a Product Variant. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + - in: path + name: variant_id + required: true + description: The ID of the Product Variant. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variant_id: + type: string + description: The ID of the deleted Product Variant. + object: + type: string + description: The type of the object that was deleted. + default: variant + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true + product: + $ref: ../components/schemas/product.yaml +post: + operationId: PostProductsProductVariantsVariant + summary: Update a Product Variant + description: Update a Product Variant. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Product. + schema: + type: string + - in: path + name: variant_id + required: true + description: The ID of the Product Variant. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + title: + description: The title to identify the Product Variant by. + type: string + sku: + description: The unique SKU for the Product Variant. + type: string + ean: + description: The EAN number of the item. + type: string + upc: + description: The UPC number of the item. + type: string + barcode: + description: A generic GTIN field for the Product Variant. + type: string + hs_code: + description: The Harmonized System code for the Product Variant. + type: string + inventory_quantity: + description: The amount of stock kept for the Product Variant. + type: integer + allow_backorder: + description: Whether the Product Variant can be purchased when out of stock. + type: boolean + manage_inventory: + description: >- + Whether Medusa should keep track of the inventory for this + Product Variant. + type: boolean + weight: + description: The wieght of the Product Variant. + type: number + length: + description: The length of the Product Variant. + type: number + height: + description: The height of the Product Variant. + type: number + width: + description: The width of the Product Variant. + type: number + origin_country: + description: The country of origin of the Product Variant. + type: string + mid_code: + description: The Manufacturer Identification code for the Product Variant. + type: string + material: + description: The material composition of the Product Variant. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + prices: + type: array + items: + required: + - amount + properties: + id: + description: The ID of the price. + type: string + region_id: + description: >- + The ID of the Region for which the price is used. Only + required if currency_code is not provided. + type: string + currency_code: + description: >- + The 3 character ISO currency code for which the price will + be used. Only required if region_id is not provided. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + amount: + description: The amount to charge for the Product Variant. + type: integer + min_quantity: + description: The minimum quantity for which the price will be used. + type: integer + max_quantity: + description: The maximum quantity for which the price will be used. + type: integer + options: + type: array + items: + required: + - option_id + - value + properties: + option_id: + description: The ID of the Product Option to set the value for. + type: string + value: + description: The value to give for the Product Option. + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml diff --git a/docs/api/admin/paths/regions.yaml b/docs/api/admin/paths/regions.yaml new file mode 100644 index 0000000000..6ca2f8a3da --- /dev/null +++ b/docs/api/admin/paths/regions.yaml @@ -0,0 +1,132 @@ +post: + operationId: PostRegions + summary: Create a Region + description: Creates a Region + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - name + - currency_code + - tax_rate + - payment_providers + - fulfillment_providers + - countries + properties: + name: + description: The name of the Region + type: string + currency_code: + description: The 3 character ISO currency code to use for the Region. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + tax_code: + description: An optional tax code the Region. + type: string + tax_rate: + description: The tax rate to use on Orders in the Region. + type: number + payment_providers: + description: >- + A list of Payment Provider IDs that should be enabled for the + Region + type: array + items: + type: string + fulfillment_providers: + description: >- + A list of Fulfillment Provider IDs that should be enabled for + the Region + type: array + items: + type: string + countries: + description: >- + A list of countries' 2 ISO Characters that should be included in + the Region. + example: + - US + type: array + items: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml +get: + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. + x-authenticated: true + parameters: + - in: query + name: limit + schema: + type: integer + default: 50 + required: false + description: limit the number of regions in response + - in: query + name: offset + schema: + type: integer + default: 0 + required: false + description: Offset of regions in response (used for pagination) + - in: query + name: created_at + schema: + type: object + required: false + description: >- + Date comparison for when resulting region was created, i.e. less than, + greater than etc. + - in: query + name: updated_at + schema: + type: object + required: false + description: >- + Date comparison for when resulting region was updated, i.e. less than, + greater than etc. + - in: query + name: deleted_at + schema: + type: object + required: false + description: >- + Date comparison for when resulting region was deleted, i.e. less than, + greater than etc. + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + regions: + type: array + items: + $ref: ../components/schemas/region.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/regions_{id}.yaml b/docs/api/admin/paths/regions_{id}.yaml new file mode 100644 index 0000000000..5dbf6ca17a --- /dev/null +++ b/docs/api/admin/paths/regions_{id}.yaml @@ -0,0 +1,135 @@ +delete: + operationId: DeleteRegionsRegion + summary: Delete a Region + description: Deletes a Region. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Region. + object: + type: string + description: The type of the object that was deleted. + default: region + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetRegionsRegion + summary: Retrieve a Region + description: Retrieves a Region. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml +post: + operationId: PostRegionsRegion + summary: Update a Region + description: Updates a Region + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Region + type: string + currency_code: + description: The 3 character ISO currency code to use for the Region. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + automatic_taxes: + description: >- + If true Medusa will automatically calculate taxes for carts in + this region. If false you have to manually call POST + /carts/:id/taxes. + type: boolean + gift_cards_taxable: + description: >- + Whether gift cards in this region should be applied sales tax + when purchasing a gift card + type: boolean + tax_provider_id: + description: >- + The ID of the tax provider to use; if null the system tax + provider is used + type: string + tax_code: + description: An optional tax code the Region. + type: string + tax_rate: + description: The tax rate to use on Orders in the Region. + type: number + payment_providers: + description: >- + A list of Payment Provider IDs that should be enabled for the + Region + type: array + items: + type: string + fulfillment_providers: + description: >- + A list of Fulfillment Provider IDs that should be enabled for + the Region + type: array + items: + type: string + countries: + description: >- + A list of countries' 2 ISO Characters that should be included in + the Region. + type: array + items: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/regions_{id}_countries.yaml b/docs/api/admin/paths/regions_{id}_countries.yaml new file mode 100644 index 0000000000..4bab7c3d58 --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_countries.yaml @@ -0,0 +1,37 @@ +post: + operationId: PostRegionsRegionCountries + summary: Add Country + description: Adds a Country to the list of Countries in a Region + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - country_code + properties: + country_code: + description: The 2 character ISO code for the Country. + type: string + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml b/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml new file mode 100644 index 0000000000..b0f5b2c8d1 --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_countries_{country_code}.yaml @@ -0,0 +1,32 @@ +delete: + operationId: PostRegionsRegionCountriesCountry + summary: Remove Country + x-authenticated: true + description: Removes a Country from the list of Countries in a Region + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + - in: path + name: country_code + description: The 2 character ISO code for the Country. + required: true + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml b/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml new file mode 100644 index 0000000000..16a5b4a85a --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_fulfillment-options.yaml @@ -0,0 +1,35 @@ +get: + operationId: GetRegionsRegionFulfillmentOptions + summary: List Fulfillment Options available in the Region + description: Gathers all the fulfillment options available to in the Region. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + fulfillment_options: + type: array + items: + properties: + provider_id: + type: string + description: ID of the fulfillment provider + options: + type: array + description: fulfillment provider options + example: + - id: manual-fulfillment + - id: manual-fulfillment-return + is_return: true diff --git a/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml b/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml new file mode 100644 index 0000000000..f01f857fe3 --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_fulfillment-providers.yaml @@ -0,0 +1,33 @@ +post: + operationId: PostRegionsRegionFulfillmentProviders + summary: Add Fulfillment Provider + description: Adds a Fulfillment Provider to a Region + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - provider_id + properties: + provider_id: + description: The ID of the Fulfillment Provider to add. + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml b/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml new file mode 100644 index 0000000000..9e73c6f45b --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_fulfillment-providers_{provider_id}.yaml @@ -0,0 +1,29 @@ +delete: + operationId: PostRegionsRegionFulfillmentProvidersProvider + summary: Remove Fulfillment Provider + description: Removes a Fulfillment Provider. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + - in: path + name: provider_id + required: true + description: The ID of the Fulfillment Provider. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/regions_{id}_payment-providers.yaml b/docs/api/admin/paths/regions_{id}_payment-providers.yaml new file mode 100644 index 0000000000..80ba28f73a --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_payment-providers.yaml @@ -0,0 +1,33 @@ +post: + operationId: PostRegionsRegionPaymentProviders + summary: Add Payment Provider + description: Adds a Payment Provider to a Region + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - provider_id + properties: + provider_id: + description: The ID of the Payment Provider to add. + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml b/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml new file mode 100644 index 0000000000..27e03641fe --- /dev/null +++ b/docs/api/admin/paths/regions_{id}_payment-providers_{provider_id}.yaml @@ -0,0 +1,29 @@ +delete: + operationId: PostRegionsRegionPaymentProvidersProvider + summary: Remove Payment Provider + description: Removes a Payment Provider. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Region. + schema: + type: string + - in: path + name: provider_id + required: true + description: The ID of the Payment Provider. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/admin/paths/return-reasons.yaml b/docs/api/admin/paths/return-reasons.yaml new file mode 100644 index 0000000000..8219cd0a96 --- /dev/null +++ b/docs/api/admin/paths/return-reasons.yaml @@ -0,0 +1,59 @@ +post: + operationId: PostReturnReasons + summary: Create a Return Reason + description: Creates a Return Reason + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - label + - value + properties: + label: + description: The label to display to the Customer. + type: string + value: + description: >- + The value that the Return Reason will be identified by. Must be + unique. + type: string + parent_return_reason_id: + description: The ID of the parent return reason. + type: string + description: + description: An optional description to for the Reason. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reason: + $ref: ../components/schemas/return_reason.yaml +get: + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. + x-authenticated: true + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reasons: + type: array + items: + $ref: ../components/schemas/return_reason.yaml diff --git a/docs/api/admin/paths/return-reasons_{id}.yaml b/docs/api/admin/paths/return-reasons_{id}.yaml new file mode 100644 index 0000000000..c8b01a4aa5 --- /dev/null +++ b/docs/api/admin/paths/return-reasons_{id}.yaml @@ -0,0 +1,97 @@ +delete: + operationId: DeleteReturnReason + summary: Delete a return reason + description: Deletes a return reason. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the return reason + schema: + type: string + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted return reason + object: + type: string + description: The type of the object that was deleted. + default: return_reason + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetReturnReasonsReason + summary: Retrieve a Return Reason + description: Retrieves a Return Reason. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Return Reason. + schema: + type: string + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reason: + $ref: ../components/schemas/return_reason.yaml +post: + operationId: PostReturnReasonsReason + summary: Update a Return Reason + description: Updates a Return Reason + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Return Reason. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + label: + description: The label to display to the Customer. + type: string + value: + description: >- + The value that the Return Reason will be identified by. Must be + unique. + type: string + description: + description: An optional description to for the Reason. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reason: + $ref: ../components/schemas/return_reason.yaml diff --git a/docs/api/admin/paths/returns.yaml b/docs/api/admin/paths/returns.yaml new file mode 100644 index 0000000000..4af7b6557e --- /dev/null +++ b/docs/api/admin/paths/returns.yaml @@ -0,0 +1,39 @@ +get: + operationId: GetReturns + summary: List Returns + description: Retrieves a list of Returns + parameters: + - in: query + name: limit + description: The upper limit for the amount of responses returned. + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset of the list returned. + schema: + type: number + default: '0' + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + returns: + type: array + items: + $ref: ../components/schemas/return.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/returns_{id}_cancel.yaml b/docs/api/admin/paths/returns_{id}_cancel.yaml new file mode 100644 index 0000000000..6862b58e55 --- /dev/null +++ b/docs/api/admin/paths/returns_{id}_cancel.yaml @@ -0,0 +1,22 @@ +post: + operationId: PostReturnsReturnCancel + summary: Cancel a Return + description: Registers a Return as canceled. + parameters: + - in: path + name: id + required: true + description: The ID of the Return. + schema: + type: string + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/admin/paths/returns_{id}_receive.yaml b/docs/api/admin/paths/returns_{id}_receive.yaml new file mode 100644 index 0000000000..038679f62e --- /dev/null +++ b/docs/api/admin/paths/returns_{id}_receive.yaml @@ -0,0 +1,48 @@ +post: + operationId: PostReturnsReturnReceive + summary: Receive a Return + description: >- + Registers a Return as received. Updates statuses on Orders and Swaps + accordingly. + parameters: + - in: path + name: id + required: true + description: The ID of the Return. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - items + properties: + items: + description: The Line Items that have been received. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item. + type: string + quantity: + description: The quantity of the Line Item. + type: integer + refund: + description: The amount to refund. + type: number + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return: + $ref: ../components/schemas/return.yaml diff --git a/docs/api/admin/paths/sales-channels.yaml b/docs/api/admin/paths/sales-channels.yaml new file mode 100644 index 0000000000..61dbcac072 --- /dev/null +++ b/docs/api/admin/paths/sales-channels.yaml @@ -0,0 +1,177 @@ +post: + operationId: PostSalesChannels + summary: Create a Sales Channel + description: Creates a Sales Channel. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - name + properties: + name: + description: The name of the Sales Channel + type: string + description: + description: The description of the Sales Channel + type: string + is_disabled: + description: Whether the Sales Channel is disabled or not. + type: boolean + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: ../components/schemas/sales_channel.yaml +get: + operationId: GetSalesChannels + summary: List sales channels + description: Retrieves a list of sales channels + x-authenticated: true + parameters: + - in: query + name: id + description: ID of the sales channel + schema: + type: string + - in: query + name: name + description: Name of the sales channel + schema: + type: string + - in: query + name: description + description: Description of the sales channel + schema: + type: string + - in: query + name: q + description: Query used for searching sales channels' names and descriptions. + schema: + type: string + - in: query + name: order + description: The field to order the results by. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: deleted_at + description: Date comparison for when resulting collections were deleted. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: offset + description: How many sales channels to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of sales channels returned. + schema: + type: integer + default: 20 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each sales channel + of the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each sales channel + of the result. + schema: + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channels: + type: array + items: + $ref: ../components/schemas/sales_channel.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/sales-channels_{id}.yaml b/docs/api/admin/paths/sales-channels_{id}.yaml new file mode 100644 index 0000000000..222272b5a3 --- /dev/null +++ b/docs/api/admin/paths/sales-channels_{id}.yaml @@ -0,0 +1,92 @@ +delete: + operationId: DeleteSalesChannelsSalesChannel + summary: Delete a sales channel + description: Deletes the sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales channel. + schema: + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted sales channel + object: + type: string + description: The type of the object that was deleted. + default: sales-channel + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetSalesChannelsSalesChannel + summary: Retrieve a sales channel + description: Retrieves the sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales channel. + schema: + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: ../components/schemas/sales_channel.yaml +post: + operationId: PostSalesChannelsSalesChannel + summary: Update a Sales Channel + description: Updates a Sales Channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales Channel. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + type: string + description: Name of the sales channel. + description: + type: string + description: Sales Channel description. + is_disabled: + type: boolean + description: Indication of if the sales channel is active. + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: ../components/schemas/sales_channel.yaml diff --git a/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml b/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml new file mode 100644 index 0000000000..e1631b42f9 --- /dev/null +++ b/docs/api/admin/paths/sales-channels_{id}_products_batch.yaml @@ -0,0 +1,82 @@ +post: + operationId: PostSalesChannelsChannelProductsBatch + summary: Assign a batch of product to a sales channel + description: Assign a batch of product to a sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales channel. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to add to the Sales Channel + type: array + items: + type: object + required: + - id + properties: + id: + type: string + description: The ID of the product + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: ../components/schemas/sales_channel.yaml +delete: + operationId: DeleteSalesChannelsChannelProductsBatch + summary: Remove a list of products from a sales channel + description: Remove a list of products from a sales channel. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Sales Channel + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - product_ids + properties: + product_ids: + description: The IDs of the products to delete from the Sales Channel. + type: array + items: + type: object + required: + - id + properties: + id: + description: The ID of a product + type: string + tags: + - Sales Channel + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + sales_channel: + $ref: ../components/schemas/sales_channel.yaml diff --git a/docs/api/admin/paths/shipping-options.yaml b/docs/api/admin/paths/shipping-options.yaml new file mode 100644 index 0000000000..63efe277fd --- /dev/null +++ b/docs/api/admin/paths/shipping-options.yaml @@ -0,0 +1,124 @@ +post: + operationId: PostShippingOptions + summary: Create Shipping Option + description: Creates a Shipping Option + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - name + - region_id + - provider_id + - data + - price_type + properties: + name: + description: The name of the Shipping Option + type: string + region_id: + description: >- + The ID of the Region in which the Shipping Option will be + available. + type: string + provider_id: + description: >- + The ID of the Fulfillment Provider that handles the Shipping + Option. + type: string + profile_id: + description: The ID of the Shipping Profile to add the Shipping Option to. + type: number + data: + description: >- + The data needed for the Fulfillment Provider to handle shipping + with this Shipping Option. + type: object + price_type: + description: The type of the Shipping Option price. + type: string + enum: + - flat_rate + - calculated + amount: + description: The amount to charge for the Shipping Option. + type: integer + requirements: + description: >- + The requirements that must be satisfied for the Shipping Option + to be available. + type: array + items: + required: + - type + - amount + properties: + type: + description: The type of the requirement + type: string + enum: + - max_subtotal + - min_subtotal + amount: + description: The amount to compare with. + type: integer + is_return: + description: Whether the Shipping Option defines a return shipment. + type: boolean + default: false + admin_only: + description: If true, the option can be used for draft orders + type: boolean + default: false + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_option: + $ref: ../components/schemas/shipping_option.yaml +get: + operationId: GetShippingOptions + summary: List Shipping Options + description: Retrieves a list of Shipping Options. + x-authenticated: true + parameters: + - in: query + name: region_id + schema: + type: string + description: Region ID to fetch options from + - in: query + name: is_return + schema: + type: boolean + description: Flag for fetching return options only + - in: query + name: admin_only + schema: + type: boolean + description: Flag for fetching admin specific options + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_options: + type: array + items: + $ref: ../components/schemas/shipping_option.yaml + count: + type: integer + description: The total number of items available diff --git a/docs/api/admin/paths/shipping-options_{id}.yaml b/docs/api/admin/paths/shipping-options_{id}.yaml new file mode 100644 index 0000000000..021185a0a9 --- /dev/null +++ b/docs/api/admin/paths/shipping-options_{id}.yaml @@ -0,0 +1,119 @@ +delete: + operationId: DeleteShippingOptionsOption + summary: Delete a Shipping Option + description: Deletes a Shipping Option. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + schema: + type: string + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Shipping Option. + object: + type: string + description: The type of the object that was deleted. + default: shipping-option + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetShippingOptionsOption + summary: Retrieve a Shipping Option + description: Retrieves a Shipping Option. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + schema: + type: string + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_option: + $ref: ../components/schemas/shipping_option.yaml +post: + operationId: PostShippingOptionsOption + summary: Update Shipping Option + description: Updates a Shipping Option + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + schema: + type: string + requestBody: + content: + application/json: + schema: + required: + - requirements + properties: + name: + description: The name of the Shipping Option + type: string + amount: + description: The amount to charge for the Shipping Option. + type: integer + admin_only: + description: If true, the option can be used for draft orders + type: boolean + metadata: + description: An optional set of key-value pairs with additional information. + type: object + requirements: + description: >- + The requirements that must be satisfied for the Shipping Option + to be available. + type: array + items: + required: + - type + - amount + properties: + id: + description: The ID of the requirement + type: string + type: + description: The type of the requirement + type: string + enum: + - max_subtotal + - min_subtotal + amount: + description: The amount to compare with. + type: integer + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_option: + $ref: ../components/schemas/shipping_option.yaml diff --git a/docs/api/admin/paths/shipping-profiles.yaml b/docs/api/admin/paths/shipping-profiles.yaml new file mode 100644 index 0000000000..199c2a7999 --- /dev/null +++ b/docs/api/admin/paths/shipping-profiles.yaml @@ -0,0 +1,44 @@ +post: + operationId: PostShippingProfiles + summary: Create a Shipping Profile + description: Creates a Shipping Profile + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - name + properties: + name: + description: The name of the Shipping Profile + type: string + tags: + - Shipping Profile + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_profile: + $ref: ../components/schemas/shipping_profile.yaml +get: + operationId: GetShippingProfiles + summary: List Shipping Profiles + description: Retrieves a list of Shipping Profile. + x-authenticated: true + tags: + - Shipping Profile + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_profiles: + type: array + items: + $ref: ../components/schemas/shipping_profile.yaml diff --git a/docs/api/admin/paths/shipping-profiles_{id}.yaml b/docs/api/admin/paths/shipping-profiles_{id}.yaml new file mode 100644 index 0000000000..69bb1b5f75 --- /dev/null +++ b/docs/api/admin/paths/shipping-profiles_{id}.yaml @@ -0,0 +1,85 @@ +delete: + operationId: DeleteShippingProfilesProfile + summary: Delete a Shipping Profile + description: Deletes a Shipping Profile. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Profile. + schema: + type: string + tags: + - Shipping Profile + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Shipping Profile. + object: + type: string + description: The type of the object that was deleted. + default: shipping_profile + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetShippingProfilesProfile + summary: Retrieve a Shipping Profile + description: Retrieves a Shipping Profile. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Profile. + schema: + type: string + tags: + - Shipping Profile + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_profile: + $ref: ../components/schemas/shipping_profile.yaml +post: + operationId: PostShippingProfilesProfile + summary: Update a Shipping Profiles + description: Updates a Shipping Profile + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Profile. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Shipping Profile + type: string + tags: + - Shipping Profile + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_profile: + $ref: ../components/schemas/shipping_profile.yaml diff --git a/docs/api/admin/paths/store.yaml b/docs/api/admin/paths/store.yaml new file mode 100644 index 0000000000..b7b5bd1a6e --- /dev/null +++ b/docs/api/admin/paths/store.yaml @@ -0,0 +1,69 @@ +get: + operationId: GetStore + summary: Retrieve Store details. + description: Retrieves the Store details + x-authenticated: true + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + store: + $ref: ../components/schemas/store.yaml +post: + operationId: PostStore + summary: Update Store details. + description: Updates the Store details + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + name: + description: The name of the Store + type: string + swap_link_template: + description: >- + A template for Swap links - use `{{cart_id}}` to insert the Swap + Cart id + type: string + payment_link_template: + description: >- + A template for payment links links - use `{{cart_id}}` to insert + the Cart id + type: string + invite_link_template: + description: >- + A template for invite links - use `{{invite_token}}` to insert + the invite token + type: string + default_currency_code: + description: The default currency code for the Store. + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currencies: + description: Array of currencies in 2 character ISO code format. + type: array + items: + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + store: + $ref: ../components/schemas/store.yaml diff --git a/docs/api/admin/paths/store_currencies_{code}.yaml b/docs/api/admin/paths/store_currencies_{code}.yaml new file mode 100644 index 0000000000..1b7000d7e0 --- /dev/null +++ b/docs/api/admin/paths/store_currencies_{code}.yaml @@ -0,0 +1,52 @@ +post: + operationId: PostStoreCurrenciesCode + summary: Add a Currency Code + description: Adds a Currency Code to the available currencies. + x-authenticated: true + parameters: + - in: path + name: code + required: true + description: The 3 character ISO currency code. + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + store: + $ref: ../components/schemas/store.yaml +delete: + operationId: DeleteStoreCurrenciesCode + summary: Remove a Currency Code + description: Removes a Currency Code from the available currencies. + x-authenticated: true + parameters: + - in: path + name: code + required: true + description: The 3 character ISO currency code. + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + store: + $ref: ../components/schemas/store.yaml diff --git a/docs/api/admin/paths/store_payment-providers.yaml b/docs/api/admin/paths/store_payment-providers.yaml new file mode 100644 index 0000000000..1e5aa37c71 --- /dev/null +++ b/docs/api/admin/paths/store_payment-providers.yaml @@ -0,0 +1,18 @@ +get: + operationId: GetStorePaymentProviders + summary: Retrieve configured Payment Providers + description: Retrieves the configured Payment Providers + x-authenticated: true + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + payment_providers: + type: array + items: + $ref: ../components/schemas/payment_provider.yaml diff --git a/docs/api/admin/paths/store_tax-providers.yaml b/docs/api/admin/paths/store_tax-providers.yaml new file mode 100644 index 0000000000..540f80edfa --- /dev/null +++ b/docs/api/admin/paths/store_tax-providers.yaml @@ -0,0 +1,18 @@ +get: + operationId: GetStoreTaxProviders + summary: Retrieve configured Tax Providers + description: Retrieves the configured Tax Providers + x-authenticated: true + tags: + - Store + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_providers: + type: array + items: + $ref: ../components/schemas/tax_provider.yaml diff --git a/docs/api/admin/paths/swaps.yaml b/docs/api/admin/paths/swaps.yaml new file mode 100644 index 0000000000..9b5d24c9e2 --- /dev/null +++ b/docs/api/admin/paths/swaps.yaml @@ -0,0 +1,40 @@ +get: + operationId: GetSwaps + summary: List Swaps + description: Retrieves a list of Swaps. + parameters: + - in: query + name: limit + description: The upper limit for the amount of responses returned. + schema: + type: number + default: '50' + - in: query + name: offset + description: The offset of the list returned. + schema: + type: number + default: '0' + x-authenticated: true + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swaps: + type: array + items: + $ref: ../components/schemas/swap.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/swaps_{id}.yaml b/docs/api/admin/paths/swaps_{id}.yaml new file mode 100644 index 0000000000..885878ad3c --- /dev/null +++ b/docs/api/admin/paths/swaps_{id}.yaml @@ -0,0 +1,23 @@ +get: + operationId: GetSwapsSwap + summary: Retrieve a Swap + description: Retrieves a Swap. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Swap. + schema: + type: string + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swap: + $ref: ../components/schemas/swap.yaml diff --git a/docs/api/admin/paths/tax-rates.yaml b/docs/api/admin/paths/tax-rates.yaml new file mode 100644 index 0000000000..5032d3164b --- /dev/null +++ b/docs/api/admin/paths/tax-rates.yaml @@ -0,0 +1,172 @@ +post: + operationId: PostTaxRates + summary: Create a Tax Rate + description: Creates a Tax Rate + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - code + - name + - region_id + properties: + code: + type: string + description: A code to identify the tax type by + name: + type: string + description: A human friendly name for the tax + region_id: + type: string + description: The ID of the Region that the rate belongs to + rate: + type: number + description: The numeric rate to charge + products: + type: array + description: The IDs of the products associated with this tax rate + items: + type: string + shipping_options: + type: array + description: The IDs of the shipping options associated with this tax rate + items: + type: string + product_types: + type: array + description: The IDs of the types of products associated with this tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml +get: + operationId: GetTaxRates + summary: List Tax Rates + description: Retrieves a list of TaxRates + x-authenticated: true + parameters: + - in: query + name: name + description: Name of tax rate to retrieve + schema: + type: string + - in: query + name: region_id + style: form + explode: false + description: Filter by Region ID + schema: + oneOf: + - type: string + - type: array + items: + type: string + - in: query + name: code + description: code to search for. + schema: + type: string + - in: query + name: rate + style: form + explode: false + description: Filter by Rate + schema: + oneOf: + - type: number + - type: object + properties: + lt: + type: number + description: filter by rates less than this number + gt: + type: number + description: filter by rates greater than this number + lte: + type: number + description: filter by rates less than or equal to this number + gte: + type: number + description: filter by rates greater than or equal to this number + - in: query + name: offset + description: How many tax rates to skip before retrieving the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of tax rates returned. + schema: + type: integer + default: 50 + - in: query + name: fields + description: Which fields should be included in each item. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved for each item. + style: form + explode: false + schema: + type: array + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rates: + type: array + items: + $ref: ../components/schemas/tax_rate.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/admin/paths/tax-rates_:id.yaml b/docs/api/admin/paths/tax-rates_:id.yaml new file mode 100644 index 0000000000..84f1f79b65 --- /dev/null +++ b/docs/api/admin/paths/tax-rates_:id.yaml @@ -0,0 +1,102 @@ +get: + operationId: GetTaxRatesTaxRate + summary: Get Tax Rate + description: Retrieves a TaxRate + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml +post: + operationId: PostTaxRatesTaxRate + summary: Update a Tax Rate + description: Updates a Tax Rate + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + code: + type: string + description: A code to identify the tax type by + name: + type: string + description: A human friendly name for the tax + region_id: + type: string + description: The ID of the Region that the rate belongs to + rate: + type: number + description: The numeric rate to charge + products: + type: array + description: The IDs of the products associated with this tax rate + items: + type: string + shipping_options: + type: array + description: The IDs of the shipping options associated with this tax rate + items: + type: string + product_types: + type: array + description: The IDs of the types of products associated with this tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml diff --git a/docs/api/admin/paths/tax-rates_:id_product-types_batch.yaml b/docs/api/admin/paths/tax-rates_:id_product-types_batch.yaml new file mode 100644 index 0000000000..df938552fb --- /dev/null +++ b/docs/api/admin/paths/tax-rates_:id_product-types_batch.yaml @@ -0,0 +1,96 @@ +post: + operationId: PostTaxRatesTaxRateProductTypes + summary: Add Tax Rate to Product Types + description: Associates a Tax Rate with a list of Product Types + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - product_types + properties: + product_types: + type: array + description: The IDs of the types of products to associate with this tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml +delete: + operationId: DeleteTaxRatesTaxRateProductTypes + summary: Remove Tax Rate from Product Types + description: Removes a Tax Rate from a list of Product Types + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - product_types + properties: + product_types: + type: array + description: >- + The IDs of the types of products to remove association with this + tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml diff --git a/docs/api/admin/paths/tax-rates_:id_products_batch.yaml b/docs/api/admin/paths/tax-rates_:id_products_batch.yaml new file mode 100644 index 0000000000..3162d0c75c --- /dev/null +++ b/docs/api/admin/paths/tax-rates_:id_products_batch.yaml @@ -0,0 +1,94 @@ +post: + operationId: PostTaxRatesTaxRateProducts + summary: Add Tax Rate to Products + description: Associates a Tax Rate with a list of Products + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - products + properties: + products: + type: array + description: The IDs of the products to associate with this tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml +delete: + operationId: DeleteTaxRatesTaxRateProducts + summary: Removes Tax Rate from Products + description: Removes a Tax Rate from a list of Products + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - products + properties: + products: + type: array + description: The IDs of the products to remove association with this tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml diff --git a/docs/api/admin/paths/tax-rates_:id_shipping-options_batch.yaml b/docs/api/admin/paths/tax-rates_:id_shipping-options_batch.yaml new file mode 100644 index 0000000000..27b1da8f5c --- /dev/null +++ b/docs/api/admin/paths/tax-rates_:id_shipping-options_batch.yaml @@ -0,0 +1,96 @@ +post: + operationId: PostTaxRatesTaxRateShippingOptions + summary: Add Tax Rate to Product Types + description: Associates a Tax Rate with a list of Shipping Options + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - shipping_options + properties: + shipping_options: + type: array + description: The IDs of the shipping options to associate with this tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml +delete: + operationId: DeleteTaxRatesTaxRateShippingOptions + summary: Removes a Tax Rate from Product Types + description: Removes a Tax Rate from a list of Product Types + parameters: + - in: query + name: fields + description: Which fields should be included in the result. + style: form + explode: false + schema: + type: array + items: + type: string + - in: query + name: expand + description: Which fields should be expanded and retrieved in the result. + style: form + explode: false + schema: + type: array + items: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - shipping_options + properties: + shipping_options: + type: array + description: >- + The IDs of the shipping options to remove association with this + tax rate + items: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + tax_rate: + $ref: ../components/schemas/tax_rate.yaml diff --git a/docs/api/admin/paths/tax-rates_{id}.yaml b/docs/api/admin/paths/tax-rates_{id}.yaml new file mode 100644 index 0000000000..38904fa17a --- /dev/null +++ b/docs/api/admin/paths/tax-rates_{id}.yaml @@ -0,0 +1,32 @@ +delete: + operationId: DeleteTaxRatesTaxRate + summary: Delete a Tax Rate + description: Deletes a Tax Rate + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the Shipping Option. + schema: + type: string + tags: + - Tax Rate + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted Shipping Option. + object: + type: string + description: The type of the object that was deleted. + default: tax-rate + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true diff --git a/docs/api/admin/paths/uploads.yaml b/docs/api/admin/paths/uploads.yaml new file mode 100644 index 0000000000..9c16a13004 --- /dev/null +++ b/docs/api/admin/paths/uploads.yaml @@ -0,0 +1,32 @@ +post: + operationId: PostUploads + summary: Uploads a file + description: Uploads a file to the specific fileservice that is installed in Medusa. + x-authenticated: true + tags: + - Upload + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + files: + type: string + format: binary + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + uploads: + type: array + items: + type: object + properties: + url: + type: string + description: The URL of the uploaded file. + format: uri diff --git a/docs/api/admin/paths/users.yaml b/docs/api/admin/paths/users.yaml new file mode 100644 index 0000000000..8d3f93b8fa --- /dev/null +++ b/docs/api/admin/paths/users.yaml @@ -0,0 +1,63 @@ +post: + operationId: PostUsers + summary: Create a User + description: Creates a User + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + - password + properties: + email: + description: The Users email. + type: string + format: email + first_name: + description: The name of the User. + type: string + last_name: + description: The name of the User. + type: string + role: + description: Userrole assigned to the user. + type: string + enum: + - admin + - member + - developer + password: + description: The Users password. + type: string + format: password + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml +get: + operationId: GetUsers + summary: Retrieve all users + description: Retrieves all users. + x-authenticated: true + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + users: + type: array + items: + $ref: ../components/schemas/user.yaml diff --git a/docs/api/admin/paths/users_password-token.yaml b/docs/api/admin/paths/users_password-token.yaml new file mode 100644 index 0000000000..454c020560 --- /dev/null +++ b/docs/api/admin/paths/users_password-token.yaml @@ -0,0 +1,21 @@ +post: + operationId: PostUsersUserPasswordToken + summary: Generate a password token for a User. + description: Generates a password token for a User with a given email. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - email + properties: + email: + description: The Users email. + type: string + format: email + tags: + - User + responses: + '204': + description: OK diff --git a/docs/api/admin/paths/users_reset-password.yaml b/docs/api/admin/paths/users_reset-password.yaml new file mode 100644 index 0000000000..c092a38a1b --- /dev/null +++ b/docs/api/admin/paths/users_reset-password.yaml @@ -0,0 +1,35 @@ +post: + operationId: PostUsersUserPassword + summary: Set the password for a User. + description: Sets the password for a User given the correct token. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - token + - password + properties: + email: + description: The Users email. + type: string + format: email + token: + description: The token generated from the 'password-token' endpoint. + type: string + password: + description: The Users new password. + type: string + format: password + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml diff --git a/docs/api/admin/paths/users_{id}.yaml b/docs/api/admin/paths/users_{id}.yaml new file mode 100644 index 0000000000..5fb9c49727 --- /dev/null +++ b/docs/api/admin/paths/users_{id}.yaml @@ -0,0 +1,102 @@ +delete: + operationId: DeleteUsersUser + summary: Delete a User + description: Deletes a User + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the User. + schema: + type: string + tags: + - Users + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The ID of the deleted user. + object: + type: string + description: The type of the object that was deleted. + default: user + deleted: + type: boolean + description: Whether or not the items were deleted. + default: true +get: + operationId: GetUsersUser + summary: Retrieve a User + description: Retrieves a User. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The ID of the User. + schema: + type: string + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml +post: + operationId: PostUsersUser + summary: Update a User + description: Updates a User + parameters: + - in: path + name: id + required: true + description: The ID of the User. + schema: + type: string + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + first_name: + description: The name of the User. + type: string + last_name: + description: The name of the User. + type: string + role: + description: Userrole assigned to the user. + type: string + enum: + - admin + - member + - developer + api_token: + description: The api token of the User. + type: string + metadata: + description: An optional set of key-value pairs with additional information. + type: object + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + user: + $ref: ../components/schemas/user.yaml diff --git a/docs/api/admin/paths/variants.yaml b/docs/api/admin/paths/variants.yaml new file mode 100644 index 0000000000..aa468d5094 --- /dev/null +++ b/docs/api/admin/paths/variants.yaml @@ -0,0 +1,45 @@ +get: + operationId: GetVariants + summary: List Product Variants. + description: Retrieves a list of Product Variants + x-authenticated: true + parameters: + - in: query + name: q + description: Query used for searching variants. + schema: + type: string + - in: query + name: offset + description: How many variants to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of variants returned. + schema: + type: integer + default: 20 + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variants: + type: array + items: + $ref: ../components/schemas/product_variant.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/store-spec3-base.json b/docs/api/store-spec3-base.json index 1e981c55a8..777afcd8fb 100644 --- a/docs/api/store-spec3-base.json +++ b/docs/api/store-spec3-base.json @@ -3,70 +3,76 @@ "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" + "name": "MIT", + "url": "https://github.com/medusajs/medusa/blob/master/LICENSE" } }, "tags": [ { "name": "Auth", - "description": "Auth endpoints allows authorization of admin Users and manages their sessions." + "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": "Discount", - "x-resourceId": "discount" - }, { "name": "Gift Card", + "description": "Gift Card endpoints that allow handling gift cards in Medusa.", "x-resourceId": "gift_card" }, - { - "name": "Notification", - "x-resourceId": "notification" - }, { "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": "Shipping Profile", - "x-resourceId": "shipping_profile" - }, { "name": "Swap", + "description": "Swap endpoints that allow handling swaps in Medusa.", "x-resourceId": "swap" - }, - { - "name": "Product Variant", - "x-resourceId": "product_variant" } ], "servers": [ diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index fc3ac4fc46..2e0a0924af 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -3,70 +3,76 @@ "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" + "name": "MIT", + "url": "https://github.com/medusajs/medusa/blob/master/LICENSE" } }, "tags": [ { "name": "Auth", - "description": "Auth endpoints allows authorization of admin Users and manages their sessions." + "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": "Discount", - "x-resourceId": "discount" - }, { "name": "Gift Card", + "description": "Gift Card endpoints that allow handling gift cards in Medusa.", "x-resourceId": "gift_card" }, - { - "name": "Notification", - "x-resourceId": "notification" - }, { "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": "Shipping Profile", - "x-resourceId": "shipping_profile" - }, { "name": "Swap", + "description": "Swap endpoints that allow handling swaps in Medusa.", "x-resourceId": "swap" - }, - { - "name": "Product Variant", - "x-resourceId": "product_variant" } ], "servers": [ @@ -159,6 +165,9 @@ } } } + }, + "401": { + "description": "Unauthorized" } } } @@ -172,11 +181,12 @@ { "in": "path", "name": "email", - "required": true, - "description": "The Customer's email.", "schema": { - "type": "string" - } + "type": "string", + "format": "email" + }, + "required": true, + "description": "The email to check if exists." } ], "tags": [ @@ -190,7 +200,8 @@ "schema": { "properties": { "exists": { - "type": "boolean" + "type": "boolean", + "description": "Whether email exists or not." } } } @@ -213,7 +224,7 @@ "in": "path", "name": "id", "required": true, - "description": "The cart id.", + "description": "The cart ID.", "schema": { "type": "string" } @@ -221,7 +232,7 @@ ], "responses": { "200": { - "description": "A successful response", + "description": "OK", "content": { "application/json": { "schema": { @@ -246,7 +257,7 @@ "properties": { "option_id": { "type": "string", - "description": "id of the shipping option to create the method from" + "description": "ID of the shipping option to create the method from" }, "data": { "type": "object", @@ -269,7 +280,7 @@ "in": "path", "name": "id", "required": true, - "description": "The Cart id.", + "description": "The Cart ID.", "schema": { "type": "string" } @@ -280,20 +291,15 @@ ], "responses": { "200": { - "description": "A cart object with the tax_total field populated", + "description": "OK", "content": { "application/json": { "schema": { - "oneOf": [ - { - "type": "object", - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } - } + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" } - ] + } } } } @@ -326,32 +332,50 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } + "properties": { + "type": { + "type": "string", + "description": "The type of the data property.", + "enum": [ + "order", + "cart", + "swap" + ] }, - { + "data": { "type": "object", - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" + "description": "The data of the result object. Its type depends on the type field.", + "oneOf": [ + { + "type": "object", + "description": "Cart was successfully authorized and order was placed successfully.", + "properties": { + "order": { + "$ref": "#/components/schemas/order" + } + } + }, + { + "type": "object", + "description": "Cart was successfully authorized but requires further actions.", + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + }, + { + "type": "object", + "description": "When cart is used for a swap and it has been completed successfully.", + "properties": { + "cart": { + "$ref": "#/components/schemas/swap" + } + } } - } - }, - { - "type": "object", - "properties": { - "cart": { - "$ref": "#/components/schemas/swap" - } - } + ] } - ] + } } } } @@ -371,16 +395,28 @@ "properties": { "region_id": { "type": "string", - "description": "The id of the Region to create the Cart in." + "description": "The ID of the Region to create the Cart in." + }, + "sales_channel_id": { + "type": "string", + "description": "[EXPERIMENTAL] The ID of the Sales channel to create the Cart in." }, "country_code": { "type": "string", - "description": "The 2 character ISO country code to create the Cart in." + "description": "The 2 character ISO country code to create the Cart in.", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "items": { "description": "An optional array of `variant_id`, `quantity` pairs to generate Line Items from.", "type": "array", "items": { + "required": [ + "variant_id", + "quantity" + ], "properties": { "variant_id": { "description": "The id of the Product Variant to generate a Line Item from.", @@ -395,7 +431,11 @@ }, "context": { "description": "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`", - "type": "object" + "type": "object", + "example": { + "ip": "::1", + "user_agent": "Chrome" + } } } } @@ -821,6 +861,140 @@ } } } + }, + "post": { + "operationId": "PostCartsCart", + "summary": "Update a Cart", + "description": "Updates a Cart.", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Cart.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "region_id": { + "type": "string", + "description": "The id of the Region to create the Cart in." + }, + "country_code": { + "type": "string", + "description": "The 2 character ISO country code to create the Cart in.", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + } + }, + "email": { + "type": "string", + "description": "An email to be used on the Cart.", + "format": "email" + }, + "sales_channel_id": { + "type": "string", + "description": "The ID of the Sales channel to update the Cart with." + }, + "billing_address": { + "description": "The Address to be used for billing purposes.", + "anyOf": [ + { + "$ref": "#/components/schemas/address", + "description": "A full billing address object." + }, + { + "type": "string", + "description": "The billing address ID" + } + ] + }, + "shipping_address": { + "description": "The Address to be used for shipping.", + "anyOf": [ + { + "$ref": "#/components/schemas/address", + "description": "A full shipping address object." + }, + { + "type": "string", + "description": "The shipping address ID" + } + ] + }, + "gift_cards": { + "description": "An array of Gift Card codes to add to the Cart.", + "type": "array", + "items": { + "required": [ + "code" + ], + "properties": { + "code": { + "description": "The code that a Gift Card is identified by.", + "type": "string" + } + } + } + }, + "discounts": { + "description": "An array of Discount codes to add to the Cart.", + "type": "array", + "items": { + "required": [ + "code" + ], + "properties": { + "code": { + "description": "The code that a Discount is identifed by.", + "type": "string" + } + } + } + }, + "customer_id": { + "description": "The ID of the Customer to associate the Cart with.", + "type": "string" + }, + "context": { + "description": "An optional object to provide context to the Cart.", + "type": "object", + "example": { + "ip": "::1", + "user_agent": "Chrome" + } + } + } + } + } + } + }, + "tags": [ + "Cart" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "cart": { + "$ref": "#/components/schemas/cart" + } + } + } + } + } + } + } } }, "/carts/{id}/payment-sessions/{provider_id}/refresh": { @@ -879,7 +1053,7 @@ "in": "path", "name": "id", "required": true, - "description": "The id of the Cart.", + "description": "The ID of the Cart.", "schema": { "type": "string" } @@ -915,120 +1089,7 @@ "properties": { "provider_id": { "type": "string", - "description": "The id of the Payment Provider." - } - } - } - } - } - } - } - }, - "/store/carts/{id}": { - "post": { - "operationId": "PostCartsCart", - "summary": "Update a Cart\"", - "description": "Updates a Cart.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Cart.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "region_id": { - "type": "string", - "description": "The id of the Region to create the Cart in." - }, - "country_code": { - "type": "string", - "description": "The 2 character ISO country code to create the Cart in." - }, - "email": { - "type": "string", - "description": "An email to be used on the Cart." - }, - "billing_address": { - "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address": { - "description": "The Address to be used for shipping.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "gift_cards": { - "description": "An array of Gift Card codes to add to the Cart.", - "type": "array", - "items": { - "required": [ - "code" - ], - "properties": { - "code": { - "description": "The code that a Gift Card is identified by.", - "type": "string" - } - } - } - }, - "discounts": { - "description": "An array of Discount codes to add to the Cart.", - "type": "array", - "items": { - "required": [ - "code" - ], - "properties": { - "code": { - "description": "The code that a Discount is identifed by.", - "type": "string" - } - } - } - }, - "customer_id": { - "description": "The id of the Customer to associate the Cart with.", - "type": "string" - }, - "context": { - "description": "An optional object to provide context to the Cart.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Cart" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "cart": { - "$ref": "#/components/schemas/cart" - } + "description": "The ID of the Payment Provider." } } } @@ -1097,6 +1158,66 @@ "type": "integer", "default": 10 } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting collections were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting collections were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } } ], "tags": [ @@ -1109,57 +1230,23 @@ "application/json": { "schema": { "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - } - }, - "/gift-cards/{code}": { - "get": { - "operationId": "GetGiftCardsCode", - "summary": "Retrieve Gift Card by Code", - "description": "Retrieves a Gift Card by its associated unqiue code.", - "parameters": [ - { - "in": "path", - "name": "code", - "required": true, - "description": "The unique Gift Card code.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Gift Card" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "id": { - "description": "The id of the Gift Card" + "collections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/product_collection" + } }, - "code": { - "description": "The code of the Gift Card" + "count": { + "type": "integer", + "description": "The total number of items available" }, - "value": { - "description": "The original value of the Gift Card." + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" }, - "balance": { - "description": "The current balanace of the Gift Card" - }, - "region": { - "$ref": "#/components/schemas/region" + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -1222,7 +1309,44 @@ "operationId": "PostCustomers", "summary": "Create a Customer", "description": "Creates a Customer account.", - "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "first_name", + "last_name", + "email", + "password" + ], + "properties": { + "first_name": { + "description": "The Customer's first name.", + "type": "string" + }, + "last_name": { + "description": "The Customer's last name.", + "type": "string" + }, + "email": { + "description": "The email of the customer.", + "type": "string", + "format": "email" + }, + "password": { + "description": "The Customer's password.", + "type": "string", + "format": "password" + }, + "phone": { + "description": "The Customer's phone number.", + "type": "string" + } + } + } + } + } + }, "tags": [ "Customer" ], @@ -1240,40 +1364,31 @@ } } } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "first_name", - "last_name", - "password" - ], - "properties": { - "email": { - "type": "string", - "description": "The Customer's email address." - }, - "first_name": { - "type": "string", - "description": "The Customer's first name." - }, - "last_name": { - "type": "string", - "description": "The Customer's last name." - }, - "password": { - "type": "string", - "description": "The Customer's password for login." - }, - "phone": { - "type": "string", - "description": "The Customer's phone number." + }, + "422": { + "description": "A customer with the same email exists", + "content": { + "application/json": { + "schema": { + "properties": { + "code": { + "type": "string", + "description": "The error code" + }, + "type": { + "type": "string", + "description": "The type of error" + }, + "message": { + "type": "string", + "description": "Human-readable message with details about the error" + } } + }, + "example": { + "code": "invalid_request_error", + "type": "duplicate_error", + "message": "A customer with the given email already has an account. Log in instead" } } } @@ -1285,7 +1400,7 @@ "delete": { "operationId": "DeleteCustomersCustomerAddressesAddress", "summary": "Delete an Address", - "description": "Removes an Address from the Customer's saved addresse.", + "description": "Removes an Address from the Customer's saved addresses.", "x-authenticated": true, "parameters": [ { @@ -1338,16 +1453,11 @@ "content": { "application/json": { "schema": { - "properties": { - "address": { - "description": "The updated Address.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "anyOf": [ + { + "$ref": "#/components/schemas/address" } - } + ] } } } @@ -1421,7 +1531,12 @@ "description": "The Address to be used for billing purposes.", "anyOf": [ { - "$ref": "#/components/schemas/address" + "$ref": "#/components/schemas/address", + "description": "The full billing address object" + }, + { + "type": "string", + "description": "The ID of an existing billing address" } ] }, @@ -1516,23 +1631,25 @@ { "in": "query", "name": "limit", - "description": "How many addresses to return.", + "description": "How many orders to return.", "schema": { - "type": "integer" + "type": "integer", + "default": 10 } }, { "in": "query", "name": "offset", - "description": "The offset in the resulting addresses.", + "description": "The offset in the resulting orders.", "schema": { - "type": "integer" + "type": "integer", + "default": 0 } }, { "in": "query", "name": "fields", - "description": "(Comma separated string) Which fields should be included in the resulting addresses.", + "description": "(Comma separated string) Which fields should be included in the resulting orders.", "schema": { "type": "string" } @@ -1540,7 +1657,7 @@ { "in": "query", "name": "expand", - "description": "(Comma separated string) Which relations should be expanded in the resulting addresses.", + "description": "(Comma separated string) Which relations should be expanded in the resulting orders.", "schema": { "type": "string" } @@ -1556,23 +1673,23 @@ "application/json": { "schema": { "properties": { - "count": { - "description": "The total number of Orders.", - "type": "integer" - }, - "offset": { - "description": "The offset for pagination.", - "type": "integer" - }, - "limit": { - "description": "The maxmimum number of Orders to return,", - "type": "integer" - }, "orders": { "type": "array", "items": { "$ref": "#/components/schemas/order" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" } } } @@ -1587,7 +1704,24 @@ "operationId": "PostCustomersCustomerPasswordToken", "summary": "Creates a reset password token", "description": "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.", - "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "email" + ], + "properties": { + "email": { + "description": "The email of the customer.", + "type": "string", + "format": "email" + } + } + } + } + } + }, "tags": [ "Customer" ], @@ -1595,33 +1729,43 @@ "204": { "description": "OK" } - }, + } + } + }, + "/customers/password-reset": { + "post": { + "operationId": "PostCustomersResetPassword", + "summary": "Resets Customer password", + "description": "Resets a Customer's password using a password token created by a previous /password-token request.", "requestBody": { "content": { "application/json": { "schema": { - "type": "object", "required": [ - "email" + "email", + "password", + "token" ], "properties": { "email": { + "description": "The email of the customer.", "type": "string", - "description": "Email of the user whose password should be reset." + "format": "email" + }, + "password": { + "description": "The Customer's password.", + "type": "string", + "format": "password" + }, + "token": { + "description": "The reset password token", + "type": "string" } } } } } - } - } - }, - "/customers/reset-password": { - "post": { - "operationId": "PostCustomersResetPassword", - "summary": "Resets Customer password", - "description": "Resets a Customer's password using a password token created by a previous /password-token request.", - "parameters": [], + }, "tags": [ "Customer" ], @@ -1640,29 +1784,38 @@ } } } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "email", - "token", - "password" - ], - "properties": { - "email": { - "type": "string", - "description": "The Customer's email." - }, - "token": { - "type": "string", - "description": "The password token created by a /password-token request." - }, - "password": { - "type": "string", - "description": "The new password to set for the Customer." + } + } + }, + "/gift-cards/{code}": { + "get": { + "operationId": "GetGiftCardsCode", + "summary": "Retrieve Gift Card by Code", + "description": "Retrieves a Gift Card by its associated unqiue code.", + "parameters": [ + { + "in": "path", + "name": "code", + "required": true, + "description": "The unique Gift Card code.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Gift Card" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "gift_card": { + "$ref": "#/components/schemas/gift_card" + } } } } @@ -1681,7 +1834,7 @@ "in": "path", "name": "cart_id", "required": true, - "description": "The id of Cart.", + "description": "The ID of Cart.", "schema": { "type": "string" } @@ -1734,8 +1887,8 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "order": { + "$ref": "#/components/schemas/order" } } } @@ -1749,7 +1902,7 @@ "get": { "operationId": "GetOrders", "summary": "Look Up an Order", - "description": "Looks for an Order with a given `display_id`, `email` pair. The `display_id`, `email` pair must match in order for the Order to be returned.", + "description": "Look up an order using filters.", "parameters": [ { "in": "query", @@ -1763,10 +1916,29 @@ { "in": "query", "name": "email", + "style": "form", + "explode": false, + "description": "The email associated with this order.", "required": true, - "description": "The email of the Order with the given display_id.", "schema": { - "type": "string" + "type": "string", + "format": "email" + } + }, + { + "in": "query", + "name": "shipping_address", + "style": "form", + "explode": false, + "description": "The shipping address associated with this order.", + "schema": { + "type": "object", + "properties": { + "postal_code": { + "type": "string", + "description": "The postal code of the shipping address" + } + } } } ], @@ -1837,7 +2009,7 @@ { "in": "query", "name": "q", - "description": "Query used for searching products.", + "description": "Query used for searching products by title, description, variant's title, variant's sku, and collection's title", "schema": { "type": "string" } @@ -1845,9 +2017,21 @@ { "in": "query", "name": "id", - "description": "Id of the product to search for.", + "style": "form", + "explode": false, + "description": "product IDs to search for.", "schema": { - "type": "string" + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] } }, { @@ -1855,7 +2039,7 @@ "name": "collection_id", "style": "form", "explode": false, - "description": "Collection ids to search for", + "description": "Collection IDs to search for", "schema": { "type": "array", "items": { @@ -1868,7 +2052,7 @@ "name": "tags", "style": "form", "explode": false, - "description": "Tags to search for", + "description": "Tag IDs to search for", "schema": { "type": "array", "items": { @@ -1879,7 +2063,7 @@ { "in": "query", "name": "title", - "description": "to search for.", + "description": "title to search for.", "schema": { "type": "string" } @@ -1887,7 +2071,7 @@ { "in": "query", "name": "description", - "description": "to search for.", + "description": "description to search for.", "schema": { "type": "string" } @@ -1895,7 +2079,7 @@ { "in": "query", "name": "handle", - "description": "to search for.", + "description": "handle to search for.", "schema": { "type": "string" } @@ -1905,13 +2089,13 @@ "name": "is_giftcard", "description": "Search for giftcards using is_giftcard=true.", "schema": { - "type": "string" + "type": "boolean" } }, { "in": "query", "name": "type", - "description": "to search for.", + "description": "type to search for.", "schema": { "type": "string" } @@ -1919,25 +2103,61 @@ { "in": "query", "name": "created_at", - "description": "Date comparison for when resulting products was created, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting products were created.", "schema": { - "type": "object" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { "in": "query", "name": "updated_at", - "description": "Date comparison for when resulting products was updated, i.e. less than, greater than etc.", + "description": "Date comparison for when resulting products were updated.", "schema": { - "type": "object" - } - }, - { - "in": "query", - "name": "deleted_at", - "description": "Date comparison for when resulting products was deleted, i.e. less than, greater than etc.", - "schema": { - "type": "object" + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } } }, { @@ -1945,13 +2165,31 @@ "name": "offset", "description": "How many products to skip in the result.", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { "in": "query", "name": "limit", "description": "Limit the number of products returned.", + "schema": { + "type": "integer", + "default": 100 + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated) Which fields should be expanded in each order of the result.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated) Which fields should be included in each order of the result.", "schema": { "type": "string" } @@ -1967,23 +2205,77 @@ "application/json": { "schema": { "properties": { - "count": { - "description": "The total number of Products.", - "type": "integer" - }, - "offset": { - "description": "The offset for pagination.", - "type": "integer" - }, - "limit": { - "description": "The maxmimum number of Products to return,", - "type": "integer" - }, "products": { "type": "array", "items": { "$ref": "#/components/schemas/product" } + }, + "count": { + "type": "integer", + "description": "The total number of items available" + }, + "offset": { + "type": "integer", + "description": "The number of items skipped before these items" + }, + "limit": { + "type": "integer", + "description": "The number of items per page" + } + } + } + } + } + } + } + } + }, + "/products/search": { + "get": { + "operationId": "GetProductsSearch", + "summary": "Search Products", + "description": "Run a search query on products using the search engine installed on Medusa", + "parameters": [ + { + "in": "query", + "name": "q", + "required": true, + "description": "The query to run the search with.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "offset", + "description": "How many products to skip in the result.", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of products returned.", + "schema": { + "type": "integer" + } + } + ], + "tags": [ + "Product" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "hits": { + "type": "array", + "description": "Array of results. The format of the items depends on the search engine installed on the server." } } } @@ -2035,6 +2327,86 @@ "operationId": "GetRegions", "summary": "List Regions", "description": "Retrieves a list of Regions.", + "parameters": [ + { + "in": "query", + "name": "offset", + "description": "How many regions to skip in the result.", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of regions returned.", + "schema": { + "type": "integer", + "default": 100 + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting regions were created.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting regions were updated.", + "schema": { + "type": "object", + "properties": { + "lt": { + "type": "string", + "description": "filter by dates less than this date", + "format": "date" + }, + "gt": { + "type": "string", + "description": "filter by dates greater than this date", + "format": "date" + }, + "lte": { + "type": "string", + "description": "filter by dates less than or equal to this date", + "format": "date" + }, + "gte": { + "type": "string", + "description": "filter by dates greater than or equal to this date", + "format": "date" + } + } + } + } + ], "tags": [ "Region" ], @@ -2045,18 +2417,6 @@ "application/json": { "schema": { "properties": { - "count": { - "description": "The total number of regions.", - "type": "integer" - }, - "offset": { - "description": "The offset for pagination.", - "type": "integer" - }, - "limit": { - "description": "The maxmimum number of regions to return,", - "type": "integer" - }, "regions": { "type": "array", "items": { @@ -2146,49 +2506,57 @@ "content": { "application/json": { "schema": { + "required": [ + "order_id", + "items" + ], "properties": { "order_id": { "type": "string", - "description": "The id of the Order to create the Return from." + "description": "The ID of the Order to create the Return from." }, "items": { "description": "The items to include in the Return.", "type": "array", "items": { + "required": [ + "item_id", + "quantity" + ], "properties": { "item_id": { - "description": "The id of the Line Item from the Order.", + "description": "The ID of the Line Item from the Order.", "type": "string" }, "quantity": { "description": "The quantity to return.", "type": "integer" + }, + "reason_id": { + "description": "The ID of the return reason.", + "type": "string" + }, + "note": { + "description": "A note to add to the item returned.", + "type": "string" } - }, - "required": [ - "item_id", - "quantity" - ] + } } }, "return_shipping": { "description": "If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.", "type": "object", + "required": [ + "option_id" + ], "properties": { "option_id": { "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." + "description": "The ID of the Shipping Option to create the Shipping Method from." } - }, - "required": [ - "option_id" - ] + } } - }, - "required": [ - "order_id", - "items" - ] + } } } } @@ -2326,7 +2694,7 @@ "properties": { "order_id": { "type": "string", - "description": "The id of the Order to create the Swap for." + "description": "The ID of the Order to create the Swap for." }, "return_items": { "description": "The items to include in the Return.", @@ -2338,19 +2706,19 @@ ], "properties": { "item_id": { - "description": "The id of the Line Item from the Order.", + "description": "The ID of the Line Item from the Order.", "type": "string" }, "quantity": { - "description": "The quantity to return.", + "description": "The quantity to swap.", "type": "integer" }, "reason_id": { - "description": "The id of the reason of this return", + "description": "The ID of the reason of this return.", "type": "string" }, - "note_id": { - "description": "The id of the note", + "note": { + "description": "The note to add to the item being swapped.", "type": "string" } } @@ -2358,7 +2726,7 @@ }, "return_shipping_option": { "type": "string", - "description": "The id of the Shipping Option to create the Shipping Method from." + "description": "The ID of the Shipping Option to create the Shipping Method from." }, "additional_items": { "description": "The items to exchange the returned items to.", @@ -2370,7 +2738,7 @@ ], "properties": { "variant_id": { - "description": "The id of the Product Variant to send.", + "description": "The ID of the Product Variant to send.", "type": "string" }, "quantity": { @@ -2457,6 +2825,36 @@ "schema": { "type": "string" } + }, + { + "in": "query", + "name": "cart_id", + "description": "The id of the Cart to set prices based on.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "region_id", + "description": "The id of the Region to set prices based on.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "currency_code", + "style": "form", + "explode": false, + "description": "The 3 character ISO currency code to set prices based on.", + "schema": { + "type": "string", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + } } ], "tags": [ @@ -2505,8 +2903,10 @@ { "in": "query", "name": "offset", + "description": "How many product variants to skip in the result.", "schema": { - "type": "number" + "type": "number", + "default": "0" } }, { @@ -2514,7 +2914,65 @@ "name": "limit", "description": "Maximum number of Product Variants to return.", "schema": { - "type": "number" + "type": "number", + "default": "100" + } + }, + { + "in": "query", + "name": "title", + "style": "form", + "explode": false, + "description": "product variant title to search for.", + "schema": { + "oneOf": [ + { + "type": "string", + "description": "a single title to search by" + }, + { + "type": "array", + "description": "multiple titles to search by", + "items": { + "type": "string" + } + } + ] + } + }, + { + "in": "query", + "name": "inventory_quantity", + "description": "Filter by available inventory quantity", + "schema": { + "oneOf": [ + { + "type": "number", + "description": "a specific number to search by." + }, + { + "type": "object", + "description": "search using less and greater than comparisons.", + "properties": { + "lt": { + "type": "number", + "description": "filter by inventory quantity less than this number" + }, + "gt": { + "type": "number", + "description": "filter by inventory quantity greater than this number" + }, + "lte": { + "type": "number", + "description": "filter by inventory quantity less than or equal to this number" + }, + "gte": { + "type": "number", + "description": "filter by inventory quantity greater than or equal to this number" + } + } + } + ] } } ], @@ -2551,34 +3009,102 @@ "x-resourceId": "address", "properties": { "id": { - "type": "string" + "type": "string", + "description": "ID of the address", + "example": "addr_01G8ZC9VS1XVE149MGH2J7QSSH" }, "customer_id": { - "type": "string" + "type": "string", + "description": "ID of the customer this address belongs to", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" + }, + "customer": { + "description": "Available if the relation `customer` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A customer object." + } }, "company": { - "type": "string" + "type": "string", + "description": "Company name", + "example": "Acme" }, "first_name": { - "type": "string" + "type": "string", + "description": "First name", + "example": "Arno" }, "last_name": { - "type": "string" + "type": "string", + "description": "Last name", + "example": "Willms" }, "address_1": { - "type": "string" + "type": "string", + "description": "Address line 1", + "example": "14433 Kemmer Court" }, "address_2": { - "type": "string" + "type": "string", + "description": "Address line 2", + "example": "Suite 369" }, "city": { - "type": "string" + "type": "string", + "description": "City", + "example": "South Geoffreyview" }, "country_code": { - "type": "string" + "type": "string", + "description": "The 2 character ISO code of the country in lower case", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + }, + "example": "st" }, "country": { - "$ref": "#/components/schemas/country" + "description": "A country object. Available if the relation `country` is expanded.", + "type": "object" + }, + "province": { + "type": "string", + "description": "Province", + "example": "Kentucky" + }, + "postal_code": { + "type": "string", + "description": "Postal Code", + "example": 72093 + }, + "phone": { + "type": "string", + "description": "Phone Number", + "example": 16128234334802 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -2586,81 +3112,194 @@ "title": "Batch Job", "description": "A Batch Job.", "x-resourceId": "batch_job", + "required": [ + "type" + ], "properties": { "id": { + "type": "string", "description": "The unique identifier for the batch job.", - "type": "string" + "example": "batch_01G8T782965PYFG0751G0Z38B4" }, "type": { - "description": "The type of batch job.", "type": "string", + "description": "The type of batch job.", "enum": [ - "product_import", - "product_export" + "product-import", + "product-export" ] }, "status": { - "description": "The status of the batch job.", "type": "string", + "description": "The status of the batch job.", "enum": [ "created", "pre_processed", + "confirmed", "processing", "completed", "canceled", "failed" - ] + ], + "default": "created" }, "created_by": { + "type": "string", "description": "The unique identifier of the user that created the batch job.", - "type": "string" + "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" }, - "context": { - "description": "The context of the batch job, the type of the batch job determines what the context should contain.", + "created_by_user": { + "description": "A user object. Available if the relation `created_by_user` is expanded.", "type": "object" }, + "context": { + "type": "object", + "description": "The context of the batch job, the type of the batch job determines what the context should contain.", + "example": { + "shape": { + "prices": [ + { + "region": null, + "currency_code": "eur" + } + ], + "dynamicImageColumnCount": 4, + "dynamicOptionColumnCount": 2 + }, + "list_config": { + "skip": 0, + "take": 50, + "order": { + "created_at": "DESC" + }, + "relations": [ + "variants", + "variant.prices", + "images" + ] + } + } + }, "dry_run": { - "description": "Specify if the job must apply the modifications or not.", "type": "boolean", + "description": "Specify if the job must apply the modifications or not.", "default": false }, "result": { + "type": "object", "description": "The result of the batch job.", - "type": "object" + "properties": { + "count": { + "type": "number" + }, + "advancement_count": { + "type": "number" + }, + "progress": { + "type": "number" + }, + "errors": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "err": { + "type": "array" + } + } + }, + "stat_descriptors": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "file_key": { + "type": "string" + }, + "file_size": { + "type": "number" + } + }, + "example": { + "errors": [ + { + "err": [], + "code": "unknown", + "message": "Method not implemented." + } + ], + "stat_descriptors": [ + { + "key": "product-export-count", + "name": "Product count to export", + "message": "There will be 8 products exported by this action" + } + ] + } }, "pre_processed_at": { - "description": "The date from which the job has been pre processed.", "type": "string", + "description": "The date from which the job has been pre processed.", + "format": "date-time" + }, + "processing_at": { + "type": "string", + "description": "The date the job is processing at.", "format": "date-time" }, "confirmed_at": { - "description": "The date when the confirmation has been done.", "type": "string", + "description": "The date when the confirmation has been done.", "format": "date-time" }, "completed_at": { - "description": "The date of the completion.", "type": "string", + "description": "The date of the completion.", "format": "date-time" }, "canceled_at": { - "description": "The date of the concellation.", "type": "string", + "description": "The date of the concellation.", + "format": "date-time" + }, + "failed_at": { + "type": "string", + "description": "The date when the job failed.", "format": "date-time" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was last updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" } } @@ -2671,115 +3310,214 @@ "x-resourceId": "cart", "properties": { "id": { - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" }, "email": { - "type": "string" + "type": "string", + "description": "The email associated with the cart", + "format": "email" }, "billing_address_id": { - "type": "string" + "type": "string", + "description": "The billing address's ID", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "billing_address": { + "description": "Available if the relation `billing_address` is expanded.", "$ref": "#/components/schemas/address" }, "shipping_address_id": { - "type": "string" + "type": "string", + "description": "The shipping address's ID", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "shipping_address": { + "description": "Available if the relation `shipping_address` is expanded.", "$ref": "#/components/schemas/address" }, "items": { + "description": "Available if the relation `items` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/line_item" } }, "region_id": { - "type": "string" + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "$ref": "#/components/schemas/region" + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "discounts": { "type": "array", + "description": "Available if the relation `discounts` is expanded.", "items": { - "$ref": "#/components/schemas/region" + "type": "object", + "description": "A discount object." } }, "gift_cards": { "type": "array", + "description": "Available if the relation `gift_cards` is expanded.", "items": { - "$ref": "#/components/schemas/gift_card" + "type": "object", + "description": "A gift card object." } }, "customer_id": { - "type": "string" + "type": "string", + "description": "The customer's ID", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" }, "customer": { - "$ref": "#/components/schemas/customer" + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" }, "payment_session": { + "description": "The selected payment session in the cart.", "$ref": "#/components/schemas/payment_session" }, "payment_sessions": { "type": "array", + "description": "The payment sessions created on the cart.", "items": { "$ref": "#/components/schemas/payment_session" } }, + "payment_id": { + "type": "string", + "description": "The payment's ID if available", + "example": "pay_01G8ZCC5W42ZNY842124G7P5R9" + }, "payment": { + "description": "Available if the relation `payment` is expanded.", "$ref": "#/components/schemas/payment" }, "shipping_methods": { "type": "array", + "description": "The shipping methods added to the cart.", "items": { "$ref": "#/components/schemas/shipping_method" } }, "type": { "type": "string", + "description": "The cart's type.", "enum": [ "default", "swap", - "payment_link" - ] + "draft_order", + "payment_link", + "claim" + ], + "default": "default" }, "completed_at": { "type": "string", + "description": "The date with timezone at which the cart was completed.", "format": "date-time" }, + "payment_authorized_at": { + "type": "string", + "description": "The date with timezone at which the payment was authorized.", + "format": "date-time" + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of a cart in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "context": { + "type": "object", + "description": "The context of the cart which can include info like IP or user agent.", + "example": { + "ip": "::1", + "user_agent": "PostmanRuntime/7.29.2" + } + }, + "sales_channel_id": { + "type": "string", + "description": "The sales channel ID the cart is associated with.", + "example": null + }, + "sales_channel": { + "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", + "type": "object" + }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } }, "shipping_total": { - "type": "integer" + "type": "integer", + "description": "The total of shipping", + "example": 1000 }, "discount_total": { - "type": "integer" + "type": "integer", + "description": "The total of discount", + "example": 800 }, "tax_total": { - "type": "integer" + "type": "integer", + "description": "The total of tax", + "example": 0 + }, + "refunded_total": { + "type": "integer", + "description": "The total amount refunded if the order associated with this cart is returned.", + "example": 0 + }, + "total": { + "type": "integer", + "description": "The total amount of the cart", + "example": 8200 }, "subtotal": { - "type": "integer" + "type": "integer", + "description": "The subtotal of the cart", + "example": 8000 }, "refundable_amount": { - "type": "integer" + "type": "integer", + "description": "The amount that can be refunded", + "example": 8200 }, "gift_card_total": { - "type": "integer" + "type": "integer", + "description": "The total of gift cards", + "example": 0 + }, + "gift_card_tax_total": { + "type": "integer", + "description": "The total of gift cards with taxes", + "example": 0 } } }, @@ -2787,30 +3525,50 @@ "title": "Claim Image", "description": "Represents photo documentation of a claim.", "x-resourceId": "claim_image", + "required": [ + "claim_item_id", + "url" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The claim image's ID", + "example": "cimg_01G8ZH853Y6TFXWPG5EYE81X63" }, "claim_item_id": { - "type": "string" + "type": "string", + "description": "The ID of the claim item associated with the image" + }, + "claim_item": { + "description": "A claim item object. Available if the relation `claim_item` is expanded.", + "type": "object" }, "url": { - "type": "string" + "type": "string", + "description": "The URL of the image", + "format": "uri" }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -2818,32 +3576,51 @@ "title": "Claim Item", "description": "Represents a claimed item along with information about the reasons for the claim.", "x-resourceId": "claim_item", + "required": [ + "claim_order_id", + "item_id", + "variant_id", + "reason", + "quantity" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The claim item's ID", + "example": "citm_01G8ZH853Y6TFXWPG5EYE81X63" }, "images": { "type": "array", + "description": "Available if the relation `images` is expanded.", "items": { "$ref": "#/components/schemas/claim_image" } }, "claim_order_id": { + "description": "The ID of the claim this item is associated with.", "type": "string" }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" + }, "item_id": { - "type": "string" + "description": "The ID of the line item that the claim item refers to.", + "type": "string", + "example": "item_01G8ZM25TN49YV9EQBE2NC27KC" }, "item": { - "description": "The Line Item that the claim refers to", + "description": "Available if the relation `item` is expanded.", "$ref": "#/components/schemas/line_item" }, "variant_id": { - "type": "string" + "description": "The ID of the product variant that is claimed.", + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" }, "variant": { - "description": "The Product Variant that is claimed.", - "$ref": "#/components/schemas/product_variant" + "description": "A variant object. Available if the relation `variant` is expanded.", + "type": "object" }, "reason": { "description": "The reason for the claim", @@ -2857,14 +3634,16 @@ }, "note": { "description": "An optional note about the claim, for additional information", - "type": "string" + "type": "string", + "example": "I don't like it." }, "quantity": { "description": "The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order.", - "type": "integer" + "type": "integer", + "example": 1 }, "tags": { - "description": "User defined tags for easy filtering and grouping.", + "description": "User defined tags for easy filtering and grouping. Available if the relation 'tags' is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/claim_tag" @@ -2872,18 +3651,25 @@ }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -2891,9 +3677,15 @@ "title": "Claim Order", "description": "Claim Orders represent a group of faulty or missing items. Each claim order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns.", "x-resourceId": "claim_order", + "required": [ + "type", + "order_id" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The claim's ID", + "example": "claim_01G8ZH853Y6TFXWPG5EYE81X63" }, "type": { "type": "string", @@ -2904,11 +3696,13 @@ }, "payment_status": { "type": "string", + "description": "The status of the claim's payment", "enum": [ "na", "not_refunded", "refunded" - ] + ], + "default": "na" }, "fulfillment_status": { "type": "string", @@ -2922,7 +3716,8 @@ "returned", "canceled", "requires_action" - ] + ], + "default": "not_fulfilled" }, "claim_items": { "description": "The items that have been claimed", @@ -2939,19 +3734,25 @@ } }, "order_id": { - "description": "The id of the order that the claim comes from.", - "type": "string" + "description": "The ID of the order that the claim comes from.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "return_order": { - "description": "Holds information about the return if the claim is to be returned", - "$ref": "#/components/schemas/return" + "description": "A return object. Holds information about the return if the claim is to be returned. Available if the relation 'return_order' is expanded", + "type": "object" }, "shipping_address_id": { - "description": "The id of the address that the new items should be shipped to", - "type": "string" + "description": "The ID of the address that the new items should be shipped to", + "type": "string", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "shipping_address": { - "description": "The address that the new items should be shipped to", + "description": "Available if the relation `shipping_address` is expanded.", "$ref": "#/components/schemas/address" }, "shipping_methods": { @@ -2970,31 +3771,48 @@ }, "refund_amount": { "description": "The amount that will be refunded in conjunction with the claim", - "type": "integer" + "type": "integer", + "example": 1000 }, "canceled_at": { - "description": "The date with timezone at which the Swap was canceled.", + "description": "The date with timezone at which the claim was canceled.", "type": "string", "format": "date-time" }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + }, "no_notification": { "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean" + "type": "boolean", + "example": false }, - "metadata": { - "type": "object" + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } } } }, @@ -3002,33 +3820,41 @@ "title": "Claim Tag", "description": "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping.", "x-resourceId": "claim_tag", + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of the claim tag. Will be prefixed by `ctag_`.", - "type": "string" + "type": "string", + "description": "The claim tag's ID", + "example": "ctag_01G8ZCC5Y63B95V6B5SHBZ91S4" }, "value": { "description": "The value that the claim tag holds", - "type": "string" + "type": "string", + "example": "Damaged" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3036,30 +3862,64 @@ "title": "Country", "description": "Country details", "x-resourceId": "country", + "required": [ + "iso_2", + "iso_3", + "num_code", + "name", + "display_name" + ], "properties": { "id": { - "description": "The database id of the country", - "type": "integer" + "type": "string", + "description": "The country's ID", + "example": 109 }, "iso_2": { - "description": "The 2 character ISO code for the country.", - "type": "string" + "type": "string", + "description": "The 2 character ISO code of the country in lower case", + "example": "it", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "iso_3": { - "description": "The 3 character ISO code for the country.", - "type": "string" + "type": "string", + "description": "The 2 character ISO code of the country in lower case", + "example": "ita", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "num_code": { "description": "The numerical ISO code for the country.", - "type": "string" + "type": "string", + "example": 380, + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements", + "description": "See a list of codes." + } }, "name": { - "description": "The normalized country name; in upper case.", - "type": "string" + "description": "The normalized country name in upper case.", + "type": "string", + "example": "ITALY" }, "display_name": { "description": "The country name appropriate for display.", - "type": "string" + "type": "string", + "example": "Italy" + }, + "region_id": { + "type": "string", + "description": "The region ID this country is associated with.", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" + }, + "region": { + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" } } }, @@ -3067,22 +3927,36 @@ "title": "Currency", "description": "Currency", "x-resourceId": "currency", + "required": [ + "code", + "symbol", + "symbol_native", + "name" + ], "properties": { "code": { "description": "The 3 character ISO code for the currency.", - "type": "string" + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } }, "symbol": { "description": "The symbol used to indicate the currency.", - "type": "string" + "type": "string", + "example": "$" }, "symbol_native": { "description": "The native symbol used to indicate the currency.", - "type": "string" + "type": "string", + "example": "$" }, "name": { "description": "The written name of the currency", - "type": "string" + "type": "string", + "example": "US Dollar" } } }, @@ -3090,49 +3964,60 @@ "title": "Custom Shipping Option", "description": "Custom Shipping Options are 'overriden' Shipping Options. Store managers can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option", "x-resourceId": "custom_shipping_option", + "required": [ + "price", + "shipping_option_id" + ], "properties": { "id": { - "description": "The id of the Custom Shipping Option. This value will be prefixed with `cso_`.", - "type": "string" + "type": "string", + "description": "The custom shipping option's ID", + "example": "cso_01G8X99XNB77DMFBJFWX6DN9V9" }, "price": { "description": "The custom price set that will override the shipping option's original price", - "type": "integer" + "type": "integer", + "example": 1000 }, "shipping_option_id": { - "description": "The id of the Shipping Option that the custom shipping option overrides", - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_option" - } - ] + "description": "The ID of the Shipping Option that the custom shipping option overrides", + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" + }, + "shipping_option": { + "description": "A shipping option object. Available if the relation `shipping_option` is expanded.", + "type": "object" }, "cart_id": { - "description": "The id of the Cart that the custom shipping option is attached to", - "anyOf": [ - { - "$ref": "#/components/schemas/cart" - } - ] + "description": "The ID of the Cart that the custom shipping option is attached to", + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3140,33 +4025,56 @@ "title": "Customer Group", "description": "Represents a customer group", "x-resourceId": "customer_group", + "required": [ + "name" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The customer group's ID", + "example": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63" }, "name": { - "type": "string" + "type": "string", + "description": "The name of the customer group", + "example": "VIP" }, "customers": { "type": "array", + "description": "The customers that belong to the customer group. Available if the relation `customers` is expanded.", "items": { - "$ref": "#/components/schemas/customer" + "type": "object", + "description": "A customer object." + } + }, + "price_lists": { + "type": "array", + "description": "The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded.", + "items": { + "$ref": "#/components/schemas/price_list" } }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3174,56 +4082,92 @@ "title": "Customer", "description": "Represents a customer", "x-resourceId": "customer", + "required": [ + "email" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The customer's ID", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" }, "email": { - "type": "string" + "type": "string", + "description": "The customer's email", + "format": "email" + }, + "first_name": { + "type": "string", + "description": "The customer's first name", + "example": "Arno" + }, + "last_name": { + "type": "string", + "description": "The customer's first name", + "example": "Willms" }, "billing_address_id": { - "type": "string" + "type": "string", + "description": "The customer's billing address ID", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "billing_address": { - "description": "The Customer's billing address.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "description": "Available if the relation `billing_address` is expanded.", + "$ref": "#/components/schemas/address" }, "shipping_addresses": { + "description": "Available if the relation `shipping_addresses` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/address" } }, - "first_name": { - "type": "string" - }, - "last_name": { - "type": "string" - }, "phone": { - "type": "string" + "type": "string", + "description": "The customer's phone number", + "example": 16128234334802 }, "has_account": { - "type": "boolean" + "type": "boolean", + "description": "Whether the customer has an account or not", + "default": false + }, + "orders": { + "description": "Available if the relation `orders` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "An order object." + } + }, + "groups": { + "description": "The customer groups the customer belongs to. Available if the relation `groups` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/customer_group" + } }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3231,33 +4175,45 @@ "title": "Product Tag Discount Condition", "description": "Associates a discount condition with a customer group", "x-resourceId": "discount_condition_customer_group", + "required": [ + "customer_group_id", + "condition_id" + ], "properties": { "customer_group_id": { - "description": "The id of the Product Tag", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "customer_group": { + "description": "Available if the relation `customer_group` is expanded.", + "$ref": "#/components/schemas/customer_group" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3265,33 +4221,45 @@ "title": "Product Collection Discount Condition", "description": "Associates a discount condition with a product collection", "x-resourceId": "discount_condition_product_collection", + "required": [ + "product_collection_id", + "condition_id" + ], "properties": { "product_collection_id": { - "description": "The id of the Product Collection", - "type": "string" + "description": "The ID of the Product Collection", + "type": "string", + "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_collection": { + "description": "Available if the relation `product_collection` is expanded.", + "$ref": "#/components/schemas/product_collection" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3299,33 +4267,45 @@ "title": "Product Tag Discount Condition", "description": "Associates a discount condition with a product tag", "x-resourceId": "discount_condition_product_tag", + "required": [ + "product_tag_id", + "condition_id" + ], "properties": { "product_tag_id": { - "description": "The id of the Product Tag", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "ptag_01F0YESHPZYY3H4SJ3A5918SBN" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_tag": { + "description": "Available if the relation `product_tag` is expanded.", + "$ref": "#/components/schemas/product_tag" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3333,33 +4313,45 @@ "title": "Product Type Discount Condition", "description": "Associates a discount condition with a product type", "x-resourceId": "discount_condition_product", + "required": [ + "product_type_id", + "condition_id" + ], "properties": { "product_type_id": { - "description": "The id of the Product Type", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_type": { + "description": "Available if the relation `product_type` is expanded.", + "$ref": "#/components/schemas/product_type" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3367,33 +4359,45 @@ "title": "Product Discount Condition", "description": "Associates a discount condition with a product", "x-resourceId": "discount_condition_product", + "required": [ + "product_id", + "condition_id" + ], "properties": { "product_id": { - "description": "The id of the Product", - "type": "string" + "description": "The ID of the Product Tag", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" }, "condition_id": { - "description": "The id of the Discount Condition", - "type": "string" + "description": "The ID of the Discount Condition", + "type": "string", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product": { + "description": "Available if the relation `product` is expanded.", + "$ref": "#/components/schemas/product" + }, + "discount_condition": { + "description": "Available if the relation `discount_condition` is expanded.", + "$ref": "#/components/schemas/discount_condition" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3401,10 +4405,16 @@ "title": "Discount Condition", "description": "Holds rule conditions for when a discount is applicable", "x-resourceId": "discount_condition", + "required": [ + "type", + "operator", + "discount_rule_id" + ], "properties": { "id": { - "description": "The id of the Discount Condition. Will be prefixed by `discon_`.", - "type": "string" + "type": "string", + "description": "The discount condition's ID", + "example": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "type": { "description": "The type of the Condition", @@ -3417,24 +4427,84 @@ "customer_groups" ] }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "operator": { + "description": "The operator of the Condition", "type": "string", + "enum": [ + "in", + "not_in" + ] + }, + "discount_rule_id": { + "type": "string", + "description": "The ID of the discount rule associated with the condition", + "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" + }, + "discount_rule": { + "description": "Available if the relation `discount_rule` is expanded.", + "$ref": "#/components/schemas/discount_rule" + }, + "products": { + "description": "products associated with this condition if type = products. Available if the relation `products` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product object." + } + }, + "product_types": { + "description": "product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product type object." + } + }, + "product_tags": { + "description": "product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product tag object." + } + }, + "product_collections": { + "description": "product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A product collection object." + } + }, + "customer_groups": { + "description": "customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A customer group object." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3442,10 +4512,15 @@ "title": "Discount Rule", "description": "Holds the rules that governs how a Discount is calculated when applied to a Cart.", "x-resourceId": "discount_rule", + "required": [ + "type", + "value" + ], "properties": { "id": { - "description": "The id of the Discount Rule. Will be prefixed by `dru_`.", - "type": "string" + "type": "string", + "description": "The discount rule's ID", + "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" }, "type": { "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers.", @@ -3454,15 +4529,18 @@ "fixed", "percentage", "free_shipping" - ] + ], + "example": "percentage" }, "description": { "description": "A short description of the discount", - "type": "string" + "type": "string", + "example": "10 Percent" }, "value": { "description": "The value that the discount represents; this will depend on the type of the discount", - "type": "integer" + "type": "integer", + "example": 10 }, "allocation": { "description": "The scope that the discount should apply to.", @@ -3470,33 +4548,38 @@ "enum": [ "total", "item" - ] + ], + "example": "total" }, "conditions": { - "description": "A set of conditions that can be used to limit when the discount can be used", + "description": "A set of conditions that can be used to limit when the discount can be used. Available if the relation `conditions` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/discount_condition" + "type": "object", + "description": "A discount condition object." } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3504,34 +4587,48 @@ "title": "Discount", "description": "Represents a discount that can be applied to a cart for promotional purposes.", "x-resourceId": "discount", + "required": [ + "code", + "is_dynamic" + ], "properties": { "id": { - "description": "The id of the Discount. Will be prefixed by `disc_`.", - "type": "string" + "type": "string", + "description": "The discount's ID", + "example": "disc_01F0YESMW10MGHWJKZSDDMN0VN" }, "code": { "description": "A unique code for the discount - this will be used by the customer to apply the discount", - "type": "string" + "type": "string", + "example": "10DISC" }, "is_dynamic": { "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts", - "type": "boolean" + "type": "boolean", + "example": false + }, + "rule_id": { + "type": "string", + "description": "The Discount Rule that governs the behaviour of the Discount", + "example": "dru_01F0YESMVK96HVX7N419E3CJ7C" }, "rule": { - "description": "The Discount Rule that governs the behaviour of the Discount", - "anyOf": [ - { - "$ref": "#/components/schemas/discount_rule" - } - ] + "description": "Available if the relation `rule` is expanded.", + "$ref": "#/components/schemas/discount_rule" }, "is_disabled": { "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts", - "type": "boolean" + "type": "boolean", + "example": false }, "parent_discount_id": { + "type": "string", "description": "The Discount that the discount was created from. This will always be a dynamic discount", - "type": "string" + "example": "disc_01G8ZH853YPY9B94857DY91YGW" + }, + "parent_discount": { + "description": "Available if the relation `parent_discount` is expanded.", + "$ref": "#/components/schemas/discount" }, "starts_at": { "description": "The time at which the discount can be used.", @@ -3543,39 +4640,51 @@ "type": "string", "format": "date-time" }, + "valid_duration": { + "type": "string", + "description": "Duration the discount runs between", + "example": "P3Y6M4DT12H30M5S" + }, "regions": { - "description": "The Regions in which the Discount can be used", + "description": "The Regions in which the Discount can be used. Available if the relation `regions` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/region" + "type": "object", + "description": "A region object." } }, "usage_limit": { "description": "The maximum number of times that a discount can be used.", - "type": "integer" + "type": "integer", + "example": 100 }, "usage_count": { "description": "The number of times a discount has been used.", - "type": "integer" + "type": "integer", + "example": 50, + "default": 0 }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3585,66 +4694,86 @@ "x-resourceId": "draft-order", "properties": { "id": { - "type": "string" + "type": "string", + "description": "The draft order's ID", + "example": "dorder_01G8TJFKBG38YYFQ035MSVG03C" }, "status": { "type": "string", + "description": "The status of the draft order", "enum": [ "open", "completed" - ] + ], + "default": "open" }, "display_id": { - "type": "string" + "type": "string", + "description": "The draft order's display ID", + "example": 2 }, "cart_id": { - "type": "string" + "type": "string", + "description": "The ID of the cart associated with the draft order.", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" }, "cart": { - "anyOf": [ - { - "$ref": "#/components/schemas/cart" - } - ] + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "order_id": { - "type": "string" + "type": "string", + "description": "The ID of the order associated with the draft order.", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/order" - } - ] + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "canceled_at": { "type": "string", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "update_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "type": "string", + "description": "The date the draft order was canceled at.", "format": "date-time" }, "completed_at": { "type": "string", + "description": "The date the draft order was completed at.", "format": "date-time" }, "no_notification_order": { - "type": "boolean" - }, - "metadata": { - "type": "object" + "type": "boolean", + "description": "Whether to send the customer notifications regarding order updates.", + "example": false }, "idempotency_key": { - "type": "string" + "type": "string", + "description": "Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3652,26 +4781,34 @@ "title": "Fulfillment Item", "description": "Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item.", "x-resourceId": "fulfillment_item", + "required": [ + "fulfillment_id", + "item_id", + "quantity" + ], "properties": { "fulfillment_id": { "description": "The id of the Fulfillment that the Fulfillment Item belongs to.", - "type": "string" + "type": "string", + "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" }, "item_id": { "description": "The id of the Line Item that the Fulfillment Item references.", - "type": "string" + "type": "string", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" + }, + "fulfillment": { + "description": "A fulfillment object. Available if the relation `fulfillment` is expanded.", + "type": "object" }, "item": { - "description": "The Line Item that the Fulfillment Item references.", - "anyOf": [ - { - "$ref": "#/components/schemas/line_item" - } - ] + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" }, "quantity": { "description": "The quantity of the Line Item that is included in the Fulfillment.", - "type": "integer" + "type": "integer", + "example": 1 } } }, @@ -3682,11 +4819,13 @@ "properties": { "id": { "description": "The id of the fulfillment provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "manual" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "example": true } } }, @@ -3694,36 +4833,60 @@ "title": "Fulfillment", "description": "Fulfillments are created once store operators can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a provider, which is typically an external shipping aggregator, shipping partner og 3PL, most plugins will have asynchronous communications with these providers through webhooks in order to automatically update and synchronize the state of Fulfillments.", "x-resourceId": "fulfillment", + "required": [ + "provider_id" + ], "properties": { "id": { - "description": "The id of the Fulfillment. This value will be prefixed by `ful_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" }, "claim_order_id": { "description": "The id of the Claim that the Fulfillment belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" }, "swap_id": { "description": "The id of the Swap that the Fulfillment belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "order_id": { "description": "The id of the Order that the Fulfillment belongs to.", - "type": "string" + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "provider_id": { "description": "The id of the Fulfillment Provider responsible for handling the fulfillment", - "type": "string" + "type": "string", + "example": "manual" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/fulfillment_provider" }, "items": { - "description": "The Fulfillment Items in the Fulfillment - these hold information about how many of each Line Item has been fulfilled.", + "description": "The Fulfillment Items in the Fulfillment - these hold information about how many of each Line Item has been fulfilled. Available if the relation `items` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/fulfillment_item" } }, "tracking_links": { - "description": "The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment Provider.", + "description": "The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment Provider. Available if the relation `tracking_links` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/tracking_link" @@ -3737,6 +4900,11 @@ "type": "string" } }, + "data": { + "description": "This contains all the data necessary for the Fulfillment provider to handle the fulfillment.", + "type": "object", + "example": {} + }, "shipped_at": { "description": "The date with timezone at which the Fulfillment was shipped.", "type": "string", @@ -3744,26 +4912,43 @@ }, "no_notification": { "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean" + "type": "boolean", + "example": false }, "canceled_at": { "description": "The date with timezone at which the Fulfillment was canceled.", "type": "string", "format": "date-time" }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "idempotency_key": { "type": "string", + "description": "Randomly generated key used to continue the completion of the fulfillment in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3771,35 +4956,53 @@ "title": "Gift Card Transaction", "description": "Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order", "x-resourceId": "gift_card_transaction", + "required": [ + "gift_card_id", + "amount" + ], "properties": { "id": { - "description": "The id of the Gift Card Transaction. This value will be prefixed by `gct_`.", - "type": "string" + "type": "string", + "description": "The gift card transaction's ID", + "example": "gct_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "gift_card_id": { - "description": "The id of the Gift Card that was used in the transaction.", - "type": "string" + "description": "The ID of the Gift Card that was used in the transaction.", + "type": "string", + "example": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ" }, "gift_card": { - "description": "The Gift Card that was used in the transaction.", - "anyOf": [ - { - "$ref": "#/components/schemas/gift_card" - } - ] + "description": "A gift card object. Available if the relation `gift_card` is expanded.", + "type": "object" }, "order_id": { - "description": "The id of the Order that the Gift Card was used to pay for.", - "type": "string" + "description": "The ID of the Order that the Gift Card was used to pay for.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "amount": { "description": "The amount that was used from the Gift Card.", - "type": "integer" + "type": "integer", + "example": 10 }, "created_at": { "description": "The date with timezone at which the resource was created.", "type": "string", "format": "date-time" + }, + "is_taxable": { + "description": "Whether the transaction is taxable or not.", + "type": "boolean", + "example": false + }, + "tax_rate": { + "description": "The tax rate of the transaction", + "type": "number", + "example": 0 } } }, @@ -3807,42 +5010,55 @@ "title": "Gift Card", "description": "Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.", "x-resourceId": "gift_card", + "required": [ + "code", + "value", + "balance", + "region_id" + ], "properties": { "id": { - "description": "The id of the Gift Card. This value will be prefixed by `gift_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ" }, "code": { "description": "The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card.", - "type": "string" + "type": "string", + "example": "3RFT-MH2C-Y4YZ-XMN4" }, "value": { "description": "The value that the Gift Card represents.", - "type": "integer" + "type": "integer", + "example": 10 }, "balance": { "description": "The remaining value on the Gift Card.", - "type": "integer" + "type": "integer", + "example": 10 }, "region_id": { + "type": "string", "description": "The id of the Region in which the Gift Card is available.", - "type": "string" + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "description": "The Region in which the Gift Card is available.", - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "order_id": { + "type": "string", "description": "The id of the Order that the Gift Card was purchased in.", - "type": "string" + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "is_disabled": { "description": "Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts.", - "type": "boolean" + "type": "boolean", + "example": false }, "ends_at": { "description": "The time at which the Gift Card can no longer be used.", @@ -3850,23 +5066,93 @@ "format": "date-time" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "idempotency_key": { + "title": "Idempotency Key", + "description": "Idempotency Key is used to continue a process in case of any failure that might occur.", + "x-resourceId": "idempotency_key", + "required": [ + "idempotency_key" + ], + "properties": { + "id": { + "type": "string", + "description": "The idempotency key's ID", + "example": "ikey_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "idempotency_key": { + "description": "The unique randomly generated key used to determine the state of a process.", + "type": "string", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "description": "Date which the idempotency key was locked.", + "type": "string", + "format": "date-time" + }, + "locked_at": { + "description": "Date which the idempotency key was locked.", + "type": "string", + "format": "date-time" + }, + "request_method": { + "description": "The method of the request", + "type": "string", + "example": "POST" + }, + "request_params": { + "type": "object", + "description": "The parameters passed to the request", + "example": { + "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + } + }, + "request_path": { + "description": "The request's path", + "type": "string", + "example": "/store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete" + }, + "response_code": { + "type": "string", + "description": "The response's code.", + "example": 200 + }, + "response_body": { + "type": "object", + "description": "The response's body", + "example": { + "id": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + } + }, + "recovery_point": { + "type": "string", + "description": "Where to continue from.", + "default": "started" } } }, @@ -3874,33 +5160,41 @@ "title": "Image", "description": "Images holds a reference to a URL at which the image file can be found.", "x-resourceId": "image", + "required": [ + "url" + ], "properties": { "id": { - "description": "The id of the Image. This value will be prefixed by `img_`.", - "type": "string" + "type": "string", + "description": "The image's ID", + "example": "img_01G749BFYR6T8JTVW6SGW3K3E6" }, "url": { "description": "The URL at which the image file can be found.", - "type": "string" + "type": "string", + "format": "uri" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, - "update_at": { - "description": "The date with timezone at which the resource was last updated.", + "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3908,45 +5202,175 @@ "title": "Invite", "description": "Represents an invite", "x-resourceId": "invite", + "required": [ + "user_email" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The invite's ID", + "example": "invite_01G8TKE4XYCTHSCK2GDEP47RE1" }, "user_email": { - "type": "string" + "type": "string", + "description": "The email of the user being invited.", + "format": "email" }, "role": { "type": "string", + "description": "The user's role.", "enum": [ "admin", "member", "developer" - ] + ], + "default": "member" }, "accepted": { - "type": "boolean" + "type": "boolean", + "description": "Whether the invite was accepted or not.", + "example": false }, "token": { - "type": "string" + "type": "string", + "description": "The token used to accept the invite." }, "expores_at": { "type": "string", + "description": "The date the invite expires at.", "format": "date-time" }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "line_item_adjustment": { + "title": "Line Item Adjustment", + "description": "Represents an Line Item Adjustment", + "x-resourceId": "line_item_adjustment", + "required": [ + "item_id", + "description", + "amount" + ], + "properties": { + "id": { + "type": "string", + "description": "The invite's ID", + "example": "lia_01G8TKE4XYCTHSCK2GDEP47RE1" + }, + "item_id": { + "type": "string", + "description": "The ID of the line item", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" + }, + "item": { + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" + }, + "description": { + "type": "string", + "description": "The line item's adjustment description", + "example": "Adjusted item's price." + }, + "discount_id": { + "type": "string", + "description": "The ID of the discount associated with the adjustment", + "example": "disc_01F0YESMW10MGHWJKZSDDMN0VN" + }, + "discount": { + "description": "Available if the relation `discount` is expanded.", + "$ref": "#/components/schemas/discount" + }, + "amount": { + "type": "number", + "description": "The adjustment amount", + "example": 1000 + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "line_item_tax_line": { + "title": "Line Item Tax Line", + "description": "Represents an Line Item Tax Line", + "x-resourceId": "line_item_tax_line", + "required": [ + "item_id", + "rate", + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "The line item tax line's ID", + "example": "litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" + }, + "item_id": { + "type": "string", + "description": "The ID of the line item", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" + }, + "item": { + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" + }, + "code": { + "description": "A code to identify the tax type by", + "type": "string", + "example": "tax01" + }, + "name": { + "description": "A human friendly name for the tax", + "type": "string", + "example": "Tax Example" + }, + "rate": { + "description": "The numeric rate to charge tax by", + "type": "number", + "example": 10 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -3954,100 +5378,198 @@ "title": "Line Item", "description": "Line Items represent purchasable units that can be added to a Cart for checkout. When Line Items are purchased they will get copied to the resulting order and can eventually be referenced in Fulfillments and Returns. Line Items may also be created when processing Swaps and Claims.", "x-resourceId": "line_item", + "required": [ + "title", + "unit_price", + "quantity" + ], "properties": { "id": { - "description": "The id of the Line Item. This value will be prefixed by `item_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" }, "cart_id": { - "description": "The id of the Cart that the Line Item belongs to.", - "type": "string" + "description": "The ID of the Cart that the Line Item belongs to.", + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "order_id": { - "description": "The id of the Order that the Line Item belongs to.", - "type": "string" + "description": "The ID of the Order that the Line Item belongs to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "swap_id": { "description": "The id of the Swap that the Line Item belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "claim_order_id": { "description": "The id of the Claim that the Line Item belongs to.", - "type": "string" + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" + }, + "tax_lines": { + "description": "Available if the relation `tax_lines` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/line_item_tax_line" + } + }, + "adjustments": { + "description": "Available if the relation `adjustments` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/line_item_adjustment" + } }, "title": { "description": "The title of the Line Item, this should be easily identifiable by the Customer.", - "type": "string" + "type": "string", + "example": "Medusa Coffee Mug" }, "description": { "description": "A more detailed description of the contents of the Line Item.", - "type": "string" + "type": "string", + "example": "One Size" }, "thumbnail": { "description": "A URL string to a small image of the contents of the Line Item.", - "type": "string" + "type": "string", + "format": "uri", + "example": "https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png" + }, + "is_return": { + "description": "Is the item being returned", + "type": "boolean", + "example": false }, "is_giftcard": { "description": "Flag to indicate if the Line Item is a Gift Card.", - "type": "boolean" + "type": "boolean", + "example": false }, "should_merge": { "description": "Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item.", - "type": "boolean" + "type": "boolean", + "example": false }, "allow_discounts": { "description": "Flag to indicate if the Line Item should be included when doing discount calculations.", - "type": "boolean" + "type": "boolean", + "example": false + }, + "has_shipping": { + "description": "Flag to indicate if the Line Item has fulfillment associated with it.", + "type": "boolean", + "example": false }, "unit_price": { "description": "The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to.", - "type": "boolean" + "type": "boolean", + "example": 8000 }, "variant_id": { "description": "The id of the Product Variant contained in the Line Item.", - "type": "string" + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" }, "variant": { - "description": "The Product Variant contained in the Line Item.", - "anyOf": [ - { - "$ref": "#/components/schemas/product_variant" - } - ] + "description": "A product variant object. The Product Variant contained in the Line Item. Available if the relation `variant` is expanded.", + "type": "object" }, "quantity": { "description": "The quantity of the content in the Line Item.", - "type": "integer" + "type": "integer", + "example": 1 }, "fulfilled_quantity": { "description": "The quantity of the Line Item that has been fulfilled.", - "type": "integer" + "type": "integer", + "example": 0 }, "returned_quantity": { "description": "The quantity of the Line Item that has been returned.", - "type": "integer" + "type": "integer", + "example": 0 }, "shipped_quantity": { "description": "The quantity of the Line Item that has been shipped.", - "type": "integer" - }, - "created_at": { - "description": "The date with timezone at which the resource was created.", - "type": "string", - "format": "date-time" - }, - "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "integer", + "example": 0 }, "refundable": { "description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.", - "type": "integer" + "type": "integer", + "example": 0 + }, + "subtotal": { + "type": "integer", + "description": "The subtotal of the line item", + "example": 8000 + }, + "tax_total": { + "type": "integer", + "description": "The total of tax of the line item", + "example": 0 + }, + "total": { + "type": "integer", + "description": "The total amount of the line item", + "example": 8000 + }, + "original_total": { + "type": "integer", + "description": "The original total amount of the line item", + "example": 8000 + }, + "original_tax_total": { + "type": "integer", + "description": "The original tax total amount of the line item", + "example": 0 + }, + "discount_total": { + "type": "integer", + "description": "The total of discount of the line item", + "example": 0 + }, + "gift_card_total": { + "type": "integer", + "description": "The total of the gift card of the line item", + "example": 0 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4055,57 +5577,92 @@ "title": "Money Amount", "description": "Money Amounts represents an amount that a given Product Variant can be purcased for. Each Money Amount either has a Currency or Region associated with it to indicate the pricing in a given Currency or, for fully region-based pricing, the given price in a specific Region. If region-based pricing is used the amount will be in the currency defined for the Reigon.", "x-resourceId": "money_amount", + "required": [ + "currency_code", + "amount" + ], "properties": { "id": { - "description": "The id of the Money Amount. This value will be prefixed by `ma_`.", - "type": "string" + "type": "string", + "description": "The money amount's ID", + "example": "ma_01F0YESHRFQNH5S8Q0PK84YYZN" }, "currency_code": { "description": "The 3 character currency code that the Money Amount is given in.", - "type": "string" + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "amount": { "description": "The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost.", - "type": "integer" + "type": "integer", + "example": 100 }, "min_quantity": { "description": "The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.", - "type": "integer" + "type": "integer", + "example": 1 }, "max_quantity": { "description": "The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.", - "type": "integer" + "type": "integer", + "example": 1 + }, + "price_list_id": { + "type": "string", + "description": "The ID of the price list associated with the money amount", + "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" + }, + "price_list": { + "description": "Available if the relation `price_list` is expanded.", + "$ref": "#/components/schemas/price_list" }, "variant_id": { - "description": "The id of the Product Variant that the Money Amount belongs to.", - "type": "string" + "description": "The id of the Product Variant contained in the Line Item.", + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" + }, + "variant": { + "description": "The Product Variant contained in the Line Item. Available if the relation `variant` is expanded.", + "type": "object" }, "region_id": { - "description": "The id of the Region that the Money Amount is defined for.", - "type": "string" + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "description": "The Region that the Money Amount is defined for.", - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4113,49 +5670,62 @@ "title": "Note", "description": "Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these.", "x-resourceId": "note", + "required": [ + "value", + "resource_type", + "resource_id" + ], "properties": { "id": { - "description": "The id of the Note. This value will be prefixed by `note_`.", - "type": "string" + "type": "string", + "description": "The note's ID", + "example": "note_01G8TM8ENBMC7R90XRR1G6H26Q" }, "resource_type": { "description": "The type of resource that the Note refers to.", - "type": "string" + "type": "string", + "example": "order" }, "resource_id": { - "description": "The id of the resource that the Note refers to.", - "type": "string" + "description": "The ID of the resource that the Note refers to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "value": { "description": "The contents of the note.", - "type": "string" + "type": "string", + "example": "This order must be fulfilled on Monday" + }, + "author_id": { + "type": "string", + "description": "The ID of the author (user)", + "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" }, "author": { - "description": "The author of the note.", - "anyOf": [ - { - "$ref": "#/components/schemas/user" - } - ] + "description": "Available if the relation `author` is expanded.", + "$ref": "#/components/schemas/user" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4163,14 +5733,19 @@ "title": "Notification Provider", "description": "Represents a notification provider plugin and holds its installation status.", "x-resourceId": "notification_provider", + "required": [ + "id" + ], "properties": { "id": { "description": "The id of the notification provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "sendgrid" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "default": true } } }, @@ -4178,46 +5753,50 @@ "title": "Notification", "description": "Notifications a communications sent via Notification Providers as a reaction to internal events such as `order.placed`. Notifications can be used to show a chronological timeline for communications sent to a Customer regarding an Order, and enables resends.", "x-resourceId": "notification", + "required": [ + "resource_type", + "resource_id", + "to" + ], "properties": { "id": { - "description": "The id of the Notification. This value will be prefixed by `noti_`.", - "type": "string" + "type": "string", + "description": "The notification's ID", + "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" }, "event_name": { "description": "The name of the event that the notification was sent for.", - "type": "string" + "type": "string", + "example": "order.placed" }, "resource_type": { "description": "The type of resource that the Notification refers to.", - "type": "string" + "type": "string", + "example": "order" }, "resource_id": { - "description": "The id of the resource that the Notification refers to.", - "type": "string" + "description": "The ID of the resource that the Notification refers to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "customer_id": { - "description": "The id of the Customer that the Notification was sent to.", - "type": "string" + "description": "The ID of the Customer that the Notification was sent to.", + "type": "string", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" }, "customer": { - "description": "The Customer that the Notification was sent to.", - "anyOf": [ - { - "$ref": "#/components/schemas/customer" - } - ] + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" }, "to": { "description": "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", - "type": "string" + "type": "string", + "example": "user@example.com" }, "data": { "description": "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend.", - "type": "object" - }, - "parent_id": { - "description": "The id of the Notification that was originally sent.", - "type": "string" + "type": "object", + "example": {} }, "resends": { "description": "The resends that have been completed after the original Notification.", @@ -4228,16 +5807,21 @@ }, "provider_id": { "description": "The id of the Notification Provider that handles the Notification.", - "type": "string" + "type": "string", + "example": "sengrid" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/notification_provider" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" } } @@ -4248,45 +5832,70 @@ "x-resourceId": "notification_resend", "properties": { "id": { - "description": "The id of the Notification. This value will be prefixed by `noti_`.", - "type": "string" + "description": "The notification resend's ID", + "type": "string", + "example": "noti_01F0YET45G9NHP08Z66CE4QKBS" }, "event_name": { "description": "The name of the event that the notification was sent for.", - "type": "string" + "type": "string", + "example": "order.placed" }, "resource_type": { "description": "The type of resource that the Notification refers to.", - "type": "string" + "type": "string", + "example": "order" }, "resource_id": { - "description": "The id of the resource that the Notification refers to.", - "type": "string" + "description": "The ID of the resource that the Notification refers to.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "customer_id": { + "description": "The ID of the Customer that the Notification was sent to.", + "type": "string", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" + }, + "customer": { + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" }, "to": { "description": "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", - "type": "string" + "type": "string", + "example": "user@example.com" }, "data": { "description": "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend.", - "type": "object" + "type": "object", + "example": {} }, "parent_id": { - "description": "The id of the Notification that was originally sent.", - "type": "string" + "description": "The ID of the Notification that was originally sent.", + "type": "string", + "example": "noti_01G53V9Y6CKMCGBM1P0X7C28RX" + }, + "parent_notification": { + "description": "Available if the relation `parent_notification` is expanded.", + "$ref": "#/components/schemas/notification" }, "provider_id": { - "description": "The id of the Notification Provider that handles the Notification.", - "type": "string" + "description": "The ID of the Notification Provider that handles the Notification.", + "type": "string", + "example": "sengrid" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/notification_provider" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" } } @@ -4295,24 +5904,41 @@ "title": "OAuth", "description": "Represent an OAuth app", "x-resourceId": "OAuth", + "required": [ + "id", + "display_name", + "application_name" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The app's ID", + "example": "example_app" }, "display_name": { - "type": "string" + "type": "string", + "description": "The app's display name", + "example": "Example app" }, "application_name": { - "type": "string" + "type": "string", + "description": "The app's name", + "example": "example" }, "install_url": { - "type": "string" + "type": "string", + "description": "The URL to install the app", + "format": "uri" }, "uninstall_url": { - "type": "integer" + "type": "string", + "description": "The URL to uninstall the app", + "format": "uri" }, "data": { - "type": "object" + "type": "object", + "description": "Any data necessary to the app.", + "example": {} } } }, @@ -4320,22 +5946,33 @@ "title": "Order", "description": "Represents an order", "x-resourceId": "order", + "required": [ + "customer_id", + "email", + "region_id", + "currency_code" + ], "properties": { "id": { - "type": "string" + "type": "string", + "description": "The order's ID", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "status": { "type": "string", + "description": "The order's status", "enum": [ "pending", "completed", "archived", "canceled", "requires_action" - ] + ], + "default": "pending" }, "fulfillment_status": { "type": "string", + "description": "The order's fulfillment status", "enum": [ "not_fulfilled", "partially_fulfilled", @@ -4346,10 +5983,12 @@ "returned", "canceled", "requires_action" - ] + ], + "default": "not_fulfilled" }, "payment_status": { "type": "string", + "description": "The order's payment status", "enum": [ "not_paid", "awaiting", @@ -4358,185 +5997,255 @@ "refuneded", "canceled", "requires_action" - ] + ], + "default": "not_paid" }, "display_id": { - "type": "integer" + "type": "integer", + "description": "The order's display ID", + "example": 2 }, "cart_id": { - "type": "string" + "type": "string", + "description": "The ID of the cart associated with the order", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" + }, + "customer_id": { + "type": "string", + "description": "The ID of the customer associated with the order", + "example": "cus_01G2SG30J8C85S4A5CHM2S1NS2" + }, + "customer": { + "description": "A customer object. Available if the relation `customer` is expanded.", + "type": "object" + }, + "email": { + "description": "The email associated with the order", + "type": "string", + "format": "email" + }, + "billing_address_id": { + "type": "string", + "description": "The ID of the billing address associated with the order", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" + }, + "billing_address": { + "description": "Available if the relation `billing_address` is expanded.", + "$ref": "#/components/schemas/address" + }, + "shipping_address_id": { + "type": "string", + "description": "The ID of the shipping address associated with the order", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" + }, + "shipping_address": { + "description": "Available if the relation `shipping_address` is expanded.", + "$ref": "#/components/schemas/address" + }, + "region_id": { + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" + }, + "region": { + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "currency_code": { - "type": "string" + "description": "The 3 character currency code that is used in the order", + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "tax_rate": { - "type": "number" + "description": "The order's tax rate", + "type": "number", + "example": 0 }, "discounts": { "type": "array", + "description": "The discounts used in the order. Available if the relation `discounts` is expanded.", "items": { - "$ref": "#/components/schemas/discount" + "type": "object", + "description": "A discount object." } }, - "email": { - "type": "string" - }, - "billing_address_id": { - "type": "string" - }, - "billing_address": { - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address_id": { - "type": "string" - }, - "shipping_address": { - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/line_item" - } - }, - "region_id": { - "type": "string" - }, - "region": { - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] - }, "gift_cards": { "type": "array", + "description": "The gift cards used in the order. Available if the relation `gift_cards` is expanded.", "items": { - "$ref": "#/components/schemas/gift_card" - } - }, - "customer_id": { - "type": "string" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/customer" - } - ] - }, - "payment_session": { - "anyOf": [ - { - "$ref": "#/components/schemas/payment_session" - } - ] - }, - "payment_sessions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/payment_session" - } - }, - "payments": { - "type": "array", - "items": { - "$ref": "#/components/schemas/payment" + "type": "object", + "description": "A gift card object." } }, "shipping_methods": { "type": "array", + "description": "The shipping methods used in the order. Available if the relation `shipping_methods` is expanded.", "items": { "$ref": "#/components/schemas/shipping_method" } }, + "payments": { + "type": "array", + "description": "The payments used in the order. Available if the relation `payments` is expanded.", + "items": { + "$ref": "#/components/schemas/payment" + } + }, "fulfillments": { "type": "array", + "description": "The fulfillments used in the order. Available if the relation `fulfillments` is expanded.", "items": { "$ref": "#/components/schemas/fulfillment" } }, "returns": { "type": "array", + "description": "The returns associated with the order. Available if the relation `returns` is expanded.", "items": { - "$ref": "#/components/schemas/return" + "type": "object", + "description": "A return object." } }, "claims": { "type": "array", + "description": "The claims associated with the order. Available if the relation `claims` is expanded.", "items": { - "$ref": "#/components/schemas/claim_order" + "type": "object", + "description": "A claim order object." } }, "refunds": { "type": "array", + "description": "The refunds associated with the order. Available if the relation `refunds` is expanded.", "items": { - "$ref": "#/components/schemas/refund" + "type": "object", + "description": "A refund object." } }, "swaps": { "type": "array", + "description": "The swaps associated with the order. Available if the relation `swaps` is expanded.", "items": { - "$ref": "#/components/schemas/refund" + "type": "object", + "description": "A swap object." + } + }, + "draft_order_id": { + "type": "string", + "description": "The ID of the draft order this order is associated with.", + "example": null + }, + "draft_order": { + "description": "A draft order object. Available if the relation `draft_order` is expanded.", + "type": "object" + }, + "items": { + "type": "array", + "description": "The line items that belong to the order. Available if the relation `items` is expanded.", + "items": { + "$ref": "#/components/schemas/line_item" } }, "gift_card_transactions": { "type": "array", + "description": "The gift card transactions used in the order. Available if the relation `gift_card_transactions` is expanded.", "items": { "$ref": "#/components/schemas/gift_card_transaction" } }, "canceled_at": { "type": "string", + "description": "The date the order was canceled on.", "format": "date-time" }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "update_at": { - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "type": "string", - "format": "date-time" - }, - "metadata": { - "type": "object" - }, - "shipping_total": { - "type": "integer" - }, - "discount_total": { - "type": "integer" - }, - "tax_total": { - "type": "integer" - }, - "subtotal": { - "type": "integer" - }, - "refundable_amount": { - "type": "integer" - }, - "gift_card_total": { - "type": "integer" - }, - "paid_total": { - "type": "integer" - }, "no_notification": { "description": "Flag for describing whether or not notifications related to this should be send.", - "type": "boolean" + "type": "boolean", + "example": false + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the processing of the order in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "external_id": { + "description": "The ID of an external order.", + "type": "string", + "example": null + }, + "sales_channel_id": { + "type": "string", + "description": "The ID of the sales channel this order is associated with.", + "example": null + }, + "sales_channel": { + "description": "A sales channel object. Available if the relation `sales_channel` is expanded.", + "type": "object" + }, + "shipping_total": { + "type": "integer", + "description": "The total of shipping", + "example": 1000 + }, + "discount_total": { + "type": "integer", + "description": "The total of discount", + "example": 800 + }, + "tax_total": { + "type": "integer", + "description": "The total of tax", + "example": 0 + }, + "refunded_total": { + "type": "integer", + "description": "The total amount refunded if the order is returned.", + "example": 0 + }, + "total": { + "type": "integer", + "description": "The total amount of the order", + "example": 8200 + }, + "subtotal": { + "type": "integer", + "description": "The subtotal of the order", + "example": 8000 + }, + "paid_total": { + "type": "integer", + "description": "The total amount paid", + "example": 8000 + }, + "refundable_amount": { + "type": "integer", + "description": "The amount that can be refunded", + "example": 8200 + }, + "gift_card_total": { + "type": "integer", + "description": "The total of gift cards", + "example": 0 + }, + "gift_card_tax_total": { + "type": "integer", + "description": "The total of gift cards with taxes", + "example": 0 } } }, @@ -4544,14 +6253,19 @@ "title": "Payment Provider", "description": "Represents a Payment Provider plugin and holds its installation status.", "x-resourceId": "payment_provider", + "required": [ + "id" + ], "properties": { "id": { "description": "The id of the payment provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "manual" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "default": true } } }, @@ -4559,22 +6273,35 @@ "title": "Payment Session", "description": "Payment Sessions are created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, who is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc.", "x-resourceId": "payment_session", + "required": [ + "cart_id", + "provider_id", + "status" + ], "properties": { "id": { - "description": "The id of the Payment Session. This value will be prefixed with `ps_`.", - "type": "string" + "type": "string", + "description": "The payment session's ID", + "example": "ps_01G901XNSRM2YS3ASN9H5KG3FZ" }, "cart_id": { "description": "The id of the Cart that the Payment Session is created for.", - "type": "string" + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "provider_id": { "description": "The id of the Payment Provider that is responsible for the Payment Session", - "type": "string" + "type": "string", + "example": "manual" }, "is_selected": { "description": "A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase.", - "type": "boolean" + "type": "boolean", + "example": true }, "status": { "description": "Indicates the status of the Payment Session. Will default to `pending`, and will eventually become `authorized`. Payment Sessions may have the status of `requires_more` to indicate that further actions are to be completed by the Customer.", @@ -4585,20 +6312,30 @@ "requires_more", "error", "canceled" - ] + ], + "example": "pending" }, "data": { "description": "The data required for the Payment Provider to identify, modify and process the Payment Session. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.", - "type": "object" + "type": "object", + "example": {} + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of a cart in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" } } @@ -4607,42 +6344,75 @@ "title": "Payment", "description": "Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded.", "x-resourceId": "payment", + "required": [ + "amount", + "currency_code", + "provider_id" + ], "properties": { "id": { - "description": "The id of the Payment. This value will be prefixed with `pay_`.", - "type": "string" + "type": "string", + "description": "The payment's ID", + "example": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE" }, "swap_id": { - "description": "The id of the Swap that the Payment is used for.", - "type": "string" + "description": "The ID of the Swap that the Payment is used for.", + "type": "string", + "example": null }, - "order_id": { - "description": "The id of the Order that the Payment is used for.", - "type": "string" + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "cart_id": { "description": "The id of the Cart that the Payment Session is created for.", "type": "string" }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" + }, + "order_id": { + "description": "The ID of the Order that the Payment is used for.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" + }, "amount": { "description": "The amount that the Payment has been authorized for.", - "type": "integer" + "type": "integer", + "example": 100 }, "currency_code": { "description": "The 3 character ISO currency code that the Payment is completed in.", - "type": "string" + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "amount_refunded": { "description": "The amount of the original Payment amount that has been refunded back to the Customer.", - "type": "integer" + "type": "integer", + "example": 0 }, "provider_id": { "description": "The id of the Payment Provider that is responsible for the Payment", - "type": "string" + "type": "string", + "example": "manual" }, "data": { "description": "The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state.", - "type": "object" + "type": "object", + "example": {} }, "captured_at": { "description": "The date with timezone at which the Payment was captured.", @@ -4654,19 +6424,30 @@ "type": "string", "format": "date-time" }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "idempotency_key": { "type": "string", + "description": "Randomly generated key used to continue the completion of a payment in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4674,10 +6455,25 @@ "title": "Price List", "description": "Price Lists represents a set of prices that overrides the default price for one or more product variants.", "x-resourceId": "price_list", + "required": [ + "name", + "description" + ], "properties": { "id": { - "description": "The id of the Price List. This value will be prefixed by `pl_`.", - "type": "string" + "type": "string", + "description": "The price list's ID", + "example": "pl_01G8X3CKJXCG5VXVZ87H9KC09W" + }, + "name": { + "type": "string", + "description": "The price list's name", + "example": "VIP Prices" + }, + "description": { + "type": "string", + "description": "The price list's description", + "example": "Prices for VIP customers" }, "type": { "description": "The type of Price List. This can be one of either `sale` or `override`.", @@ -4685,7 +6481,17 @@ "enum": [ "sale", "override" - ] + ], + "default": "sale" + }, + "status": { + "description": "The status of the Price List", + "type": "string", + "enum": [ + "active", + "draft" + ], + "default": "draft" }, "starts_at": { "description": "The date with timezone that the Price List starts being valid.", @@ -4698,25 +6504,33 @@ "format": "date-time" }, "customer_groups": { - "description": "The Customer Groups that the Price List applies to.", + "description": "The Customer Groups that the Price List applies to. Available if the relation `customer_groups` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/customer_group" + "type": "object", + "description": "A customer group object." + } + }, + "prices": { + "description": "The Money Amounts that are associated with the Price List. Available if the relation `prices` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/money_amount" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" } } @@ -4725,44 +6539,54 @@ "title": "Product Collection", "description": "Product Collections represents a group of Products that are related.", "x-resourceId": "product_collection", + "required": [ + "title" + ], "properties": { "id": { - "description": "The id of the Product Collection. This value will be prefixed with `pcol_`.", - "type": "string" + "type": "string", + "description": "The product collection's ID", + "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" }, "title": { "description": "The title that the Product Collection is identified by.", - "type": "string" + "type": "string", + "example": "Summer Collection" }, "handle": { "description": "A unique string that identifies the Product Collection - can for example be used in slug structures.", - "type": "string" + "type": "string", + "example": "summer-collection" }, "products": { - "description": "The Products contained in the Product Collection.", + "description": "The Products contained in the Product Collection. Available if the relation `products` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/product" + "type": "object", + "description": "A product collection object." } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4770,41 +6594,61 @@ "title": "Product Option Value", "description": "A value given to a Product Variant's option set. Product Variant have a Product Option Value for each of the Product Options defined on the Product.", "x-resourceId": "product_option_value", + "required": [ + "value", + "option_id", + "variant_id" + ], "properties": { "id": { - "description": "The id of the Product Option Value. This value will be prefixed with `optval_`.", - "type": "string" + "type": "string", + "description": "The product option value's ID", + "example": "optval_01F0YESHR7S6ECD03RF6W12DSJ" }, "value": { "description": "The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is \"Size\" this value could be \"Small\", \"Medium\" or \"Large\").", - "type": "string" + "type": "string", + "example": "large" }, "option_id": { - "description": "The id of the Product Option that the Product Option Value is defined for.", - "type": "string" + "description": "The ID of the Product Option that the Product Option Value is defined for.", + "type": "string", + "example": "opt_01F0YESHQBZVKCEXJ24BS6PCX3" + }, + "option": { + "description": "Available if the relation `option` is expanded.", + "$ref": "#/components/schemas/product_option" }, "variant_id": { - "description": "The id of the Product Variant that the Product Option Value is defined for.", - "type": "string" + "description": "The ID of the Product Variant that the Product Option Value is defined for.", + "type": "string", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" + }, + "variant": { + "description": "Available if the relation `variant` is expanded.", + "$ref": "#/components/schemas/product_variant" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4812,44 +6656,58 @@ "title": "Product Option", "description": "Product Options define properties that may vary between different variants of a Product. Common Product Options are \"Size\" and \"Color\", but Medusa doesn't limit what Product Options that can be defined.", "x-resourceId": "product_option", + "required": [ + "title", + "product_id" + ], "properties": { "id": { - "description": "The id of the Product Option. This value will be prefixed with `opt_`.", - "type": "string" + "type": "string", + "description": "The product option's ID", + "example": "opt_01F0YESHQBZVKCEXJ24BS6PCX3" }, "title": { "description": "The title that the Product Option is defined by (e.g. \"Size\").", - "type": "string" + "type": "string", + "example": "Size" }, "values": { - "description": "The Product Option Values that are defined for the Product Option.", + "description": "The Product Option Values that are defined for the Product Option. Available if the relation `values` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_option_value" } }, "product_id": { - "description": "The id of the Product that the Product Option is defined for.", - "type": "string" + "description": "The ID of the Product that the Product Option is defined for.", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" + }, + "product": { + "description": "A product object. Available if the relation `product` is expanded.", + "type": "object" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4857,33 +6715,41 @@ "title": "Product Tag", "description": "Product Tags can be added to Products for easy filtering and grouping.", "x-resourceId": "product_tag", + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of the Product Tag. This value will be prefixed with `ptag_`.", - "type": "string" + "type": "string", + "description": "The product tag's ID", + "example": "ptag_01G8K2MTMG9168F2B70S1TAVK3" }, "value": { - "description": "The value that the Product Tag represents (e.g. \"Pants\").", - "type": "string" + "description": "The value that the Product Tag represents", + "type": "string", + "example": "Pants" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4891,33 +6757,45 @@ "title": "Product Tax Rate", "description": "Associates a tax rate with a product to indicate that the product is taxed in a certain way", "x-resourceId": "product_tax_rate", + "required": [ + "product_id", + "rate_id" + ], "properties": { "product_id": { - "description": "The id of the Product", - "type": "string" + "description": "The ID of the Product", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" + }, + "product": { + "description": "Available if the relation `product` is expanded.", + "$ref": "#/components/schemas/product" }, "rate_id": { - "description": "The id of the Tax Rate", - "type": "string" + "description": "The ID of the Tax Rate", + "type": "string", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" + }, + "tax_rate": { + "description": "Available if the relation `tax_rate` is expanded.", + "$ref": "#/components/schemas/tax_rate" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4925,33 +6803,45 @@ "title": "Product Type Tax Rate", "description": "Associates a tax rate with a product type to indicate that the product type is taxed in a certain way", "x-resourceId": "product_type_tax_rate", + "required": [ + "product_type_id", + "rate_id" + ], "properties": { "product_type_id": { - "description": "The id of the Product type", - "type": "string" + "description": "The ID of the Product type", + "type": "string", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "product_type": { + "description": "Available if the relation `product_type` is expanded.", + "$ref": "#/components/schemas/product_type" }, "rate_id": { "description": "The id of the Tax Rate", - "type": "string" + "type": "string", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" + }, + "tax_rate": { + "description": "Available if the relation `tax_rate` is expanded.", + "$ref": "#/components/schemas/tax_rate" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4959,33 +6849,41 @@ "title": "Product Type", "description": "Product Type can be added to Products for filtering and reporting purposes.", "x-resourceId": "product_type", + "required": [ + "value" + ], "properties": { "id": { - "description": "The id of the Product Type. This value will be prefixed with `ptyp_`.", - "type": "string" + "type": "string", + "description": "The product type's ID", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" }, "value": { - "description": "The value that the Product Type represents (e.g. \"Clothing\").", - "type": "string" + "description": "The value that the Product Type represents.", + "type": "string", + "example": "Clothing" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -4993,21 +6891,33 @@ "title": "Product Variant", "description": "Product Variants represent a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations.", "x-resourceId": "product_variant", + "required": [ + "title", + "product_id", + "inventory_quantity" + ], "properties": { "id": { - "description": "The id of the Product Variant. This value will be prefixed with `variant_`.", - "type": "string" + "type": "string", + "description": "The product variant's ID", + "example": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6" }, "title": { "description": "A title that can be displayed for easy identification of the Product Variant.", - "type": "string" + "type": "string", + "example": "Small" }, "product_id": { - "description": "The id of the Product that the Product Variant belongs to.", - "type": "string" + "description": "The ID of the Product that the Product Variant belongs to.", + "type": "string", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" + }, + "product": { + "description": "A product object. Available if the relation `product` is expanded.", + "type": "object" }, "prices": { - "description": "The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region.", + "description": "The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region. Available if the relation `prices` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/money_amount" @@ -5015,89 +6925,112 @@ }, "sku": { "description": "The unique stock keeping unit used to identify the Product Variant. This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems.", - "type": "string" + "type": "string", + "example": "shirt-123" }, "barcode": { "description": "A generic field for a GTIN number that can be used to identify the Product Variant.", - "type": "string" + "type": "string", + "example": null }, "ean": { "description": "An EAN barcode number that can be used to identify the Product Variant.", - "type": "string" + "type": "string", + "example": null }, "upc": { "description": "A UPC barcode number that can be used to identify the Product Variant.", - "type": "string" + "type": "string", + "example": null + }, + "variant_rank": { + "description": "The ranking of this variant", + "type": "number", + "default": 0 }, "inventory_quantity": { "description": "The current quantity of the item that is stocked.", - "type": "integer" + "type": "integer", + "example": 100 }, "allow_backorder": { "description": "Whether the Product Variant should be purchasable when `inventory_quantity` is 0.", - "type": "boolean" + "type": "boolean", + "default": false }, "manage_inventory": { "description": "Whether Medusa should manage inventory for the Product Variant.", - "type": "boolean" + "type": "boolean", + "default": true }, "hs_code": { "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "origin_country": { "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "mid_code": { "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "material": { "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "type": "string", + "example": null }, "weight": { "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "height": { "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "width": { "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "length": { "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "options": { - "description": "The Product Option Values specified for the Product Variant.", + "description": "The Product Option Values specified for the Product Variant. Available if the relation `options` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_option_value" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5105,14 +7038,20 @@ "title": "Product", "description": "Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by.", "x-resourceId": "product", + "required": [ + "title", + "profile_id" + ], "properties": { "id": { - "description": "The id of the Product. This value will be prefixed with `prod_`.", - "type": "string" + "type": "string", + "description": "The product's ID", + "example": "prod_01G1G5V2MBA328390B5AXJ610F" }, "title": { "description": "A title that can be displayed for easy identification of the Product.", - "type": "string" + "type": "string", + "example": "Medusa Coffee Mug" }, "subtitle": { "description": "An optional subtitle that can be used to further specify the Product.", @@ -5120,22 +7059,32 @@ }, "description": { "description": "A short description of the Product.", - "type": "string" + "type": "string", + "example": "Every programmer's best friend." }, "handle": { "description": "A unique identifier for the Product (e.g. for slug structure).", - "type": "string" + "type": "string", + "example": "coffee-mug" }, "is_giftcard": { "description": "Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased.", - "type": "boolean" + "type": "boolean", + "default": false }, - "discountable": { - "description": "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`.", - "type": "boolean" + "status": { + "description": "The status of the product", + "type": "string", + "enum": [ + "draft", + "proposed", + "published", + "rejected" + ], + "default": "draft" }, "images": { - "description": "Images of the Product", + "description": "Images of the Product. Available if the relation `images` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/image" @@ -5143,99 +7092,136 @@ }, "thumbnail": { "description": "A URL to an image file that can be used to identify the Product.", - "type": "string" + "type": "string", + "format": "uri" }, "options": { - "description": "The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product Option Values.", + "description": "The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product Option Values. Available if the relation `options` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_option" } }, "variants": { - "description": "The Product Variants that belong to the Product. Each will have a unique combination of Product Option Values.", + "description": "The Product Variants that belong to the Product. Each will have a unique combination of Product Option Values. Available if the relation `variants` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_variant" } }, "profile_id": { - "description": "The id of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", - "type": "string" + "description": "The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", + "type": "string", + "example": "sp_01G1G5V239ENSZ5MV4JAR737BM" }, - "hs_code": { - "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" - }, - "origin_country": { - "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" - }, - "mid_code": { - "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" - }, - "material": { - "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.", - "type": "string" + "profile": { + "description": "Available if the relation `profile` is expanded.", + "$ref": "#/components/schemas/shipping_profile" }, "weight": { "description": "The weight of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "height": { "description": "The height of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "width": { "description": "The width of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, "length": { "description": "The length of the Product Variant. May be used in shipping rate calculations.", - "type": "string" + "type": "number", + "example": null }, - "type": { - "description": "The Product Type of the Product (e.g. \"Clothing\")", - "anyOf": [ - { - "$ref": "#/components/schemas/product_type" - } - ] + "hs_code": { + "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "origin_country": { + "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "mid_code": { + "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "material": { + "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.", + "type": "string", + "example": null + }, + "collection_id": { + "type": "string", + "description": "The Product Collection that the Product belongs to", + "example": "pcol_01F0YESBFAZ0DV6V831JXWH0BG" }, "collection": { - "description": "The Product Collection that the Product belongs to (e.g. \"SS20\")", - "anyOf": [ - { - "$ref": "#/components/schemas/product_collection" - } - ] + "description": "A product collection object. Available if the relation `collection` is expanded.", + "type": "object" + }, + "type_id": { + "type": "string", + "description": "The Product type that the Product belongs to", + "example": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "type": { + "description": "Available if the relation `type` is expanded.", + "$ref": "#/components/schemas/product_type" }, "tags": { - "description": "The Product Tags assigned to the Product.", + "description": "The Product Tags assigned to the Product. Available if the relation `tags` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/product_tag" } }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "discountable": { + "description": "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`.", + "type": "boolean", + "default": true + }, + "external_id": { + "description": "The external ID of the product", "type": "string", + "example": null + }, + "sales_channels": { + "description": "The sales channels the product is associated with. Available if the relation `sales_channels` is expanded.", + "type": "array", + "items": { + "type": "object", + "description": "A sales channel object." + } + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5243,22 +7229,30 @@ "title": "Refund", "description": "Refund represent an amount of money transfered back to the Customer for a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by a store operator.", "x-resourceId": "refund", + "required": [ + "order_id", + "amount" + ], "properties": { "id": { - "description": "The id of the Refund. This value will be prefixed with `ref_`.", - "type": "string" + "type": "string", + "description": "The refund's ID", + "example": "ref_01G1G5V27GYX4QXNARRQCW1N8T" }, "order_id": { "description": "The id of the Order that the Refund is related to.", - "type": "string" + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" }, "amount": { "description": "The amount that has be refunded to the Customer.", - "type": "integer" + "type": "integer", + "example": 1000 }, "note": { "description": "An optional note explaining why the amount was refunded.", - "type": "string" + "type": "string", + "example": "I didn't like it" }, "reason": { "description": "The reason given for the Refund, will automatically be set when processed as part of a Swap, Claim or Return.", @@ -5269,21 +7263,38 @@ "swap", "claim", "other" - ] + ], + "example": "return" + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the refund in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5291,66 +7302,113 @@ "title": "Region", "description": "Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries.", "x-resourceId": "region", + "required": [ + "name", + "currency_code", + "tax_rate" + ], "properties": { "id": { - "description": "The id of the Region. This value will be prefixed with `reg_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "name": { "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.", - "type": "string" + "type": "string", + "example": "EU" }, "currency_code": { - "description": "The 3 character ISO currency code that Customers will shop in in the Region.", - "type": "string" + "description": "The 3 character currency code that the Region uses.", + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "currency": { + "description": "Available if the relation `currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "tax_rate": { "description": "The tax rate that should be charged on purchases in the Region.", - "type": "number" + "type": "number", + "example": 0 + }, + "tax_rates": { + "description": "The tax rates that are included in the Region. Available if the relation `tax_rates` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } }, "tax_code": { "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.", - "type": "string" + "type": "string", + "example": null + }, + "gift_cards_taxable": { + "description": "Whether the gift cards are taxable or not in this region.", + "type": "boolean", + "default": true + }, + "automatic_taxes": { + "description": "Whether taxes should be automated in this region.", + "type": "boolean", + "default": true }, "countries": { - "description": "The countries that are included in the Region.", + "description": "The countries that are included in the Region. Available if the relation `countries` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/country" } }, + "tax_provider_id": { + "type": "string", + "description": "The ID of the tax provider used in this region", + "example": null + }, + "tax_provider": { + "description": "Available if the relation `tax_provider` is expanded.", + "$ref": "#/components/schemas/tax_provider" + }, "payment_providers": { - "description": "The Payment Providers that can be used to process Payments in the Region.", + "description": "The Payment Providers that can be used to process Payments in the Region. Available if the relation `payment_providers` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/payment_provider" } }, "fulfillment_providers": { - "description": "The Fulfillment Providers that can be used to fulfill orders in the Region.", + "description": "The Fulfillment Providers that can be used to fulfill orders in the Region. Available if the relation `payment_providers` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/fulfillment_provider" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5358,54 +7416,69 @@ "title": "Return Item", "description": "Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned.", "x-resourceId": "return_item", + "required": [ + "return_id", + "item_id" + ], "properties": { "return_id": { "description": "The id of the Return that the Return Item belongs to.", - "type": "string" + "type": "string", + "example": "ret_01F0YET7XPCMF8RZ0Y151NZV2V" + }, + "return_order": { + "description": "Available if the relation `return_order` is expanded.", + "$ref": "#/components/schemas/return" }, "item_id": { "description": "The id of the Line Item that the Return Item references.", - "type": "string" + "type": "string", + "example": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN" }, "item": { - "description": "The Line Item that the Return Item references.", - "anyOf": [ - { - "$ref": "#/components/schemas/line_item" - } - ] + "description": "Available if the relation `item` is expanded.", + "$ref": "#/components/schemas/line_item" }, "quantity": { "description": "The quantity of the Line Item that is included in the Return.", - "type": "integer" + "type": "integer", + "example": 1 }, "is_requested": { "description": "Whether the Return Item was requested initially or received unexpectedly in the warehouse.", - "type": "boolean" + "type": "boolean", + "default": true }, "requested_quantity": { "description": "The quantity that was originally requested to be returned.", - "type": "integer" + "type": "integer", + "example": 1 }, "recieved_quantity": { "description": "The quantity that was received in the warehouse.", - "type": "integer" + "type": "integer", + "example": 1 + }, + "reason_id": { + "description": "The ID of the reason for returning the item.", + "type": "string", + "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" }, "reason": { - "description": "The reason for returning the item.", - "anyOf": [ - { - "$ref": "#/components/schemas/return_reason" - } - ] + "description": "Available if the relation `reason` is expanded.", + "$ref": "#/components/schemas/return_reason" }, "note": { "description": "An optional note with additional details about the Return.", - "type": "string" + "type": "string", + "example": "I didn't like it." }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5413,41 +7486,65 @@ "title": "Return Reason", "description": "A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned.", "x-resourceId": "return_reason", + "required": [ + "value", + "label" + ], "properties": { "id": { - "description": "The id of the Return Reason will start with `rr_`.", - "type": "string" + "type": "string", + "description": "The cart's ID", + "example": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ" }, "description": { "description": "A description of the Reason.", - "type": "string" + "type": "string", + "example": "Items that are damaged" }, "label": { "description": "A text that can be displayed to the Customer as a reason.", - "type": "string" + "type": "string", + "example": "Damaged goods" }, "value": { "description": "The value to identify the reason by.", - "type": "string" + "type": "string", + "example": "damaged" + }, + "parent_return_reason_id": { + "type": "string", + "description": "The ID of the parent reason.", + "example": null + }, + "parent_return_reason": { + "description": "Available if the relation `parent_return_reason` is expanded.", + "$ref": "#/components/schemas/return_reason" + }, + "return_reason_children": { + "description": "Available if the relation `return_reason_children` is expanded.", + "$ref": "#/components/schemas/return_reason" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5455,10 +7552,14 @@ "title": "Return", "description": "Return orders hold information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can be used as part of a Swap.", "x-resourceId": "return", + "required": [ + "refund_amount" + ], "properties": { "id": { - "description": "The id of the Return. This value will be prefixed with `ret_`.", - "type": "string" + "type": "string", + "description": "The return's ID", + "example": "ret_01F0YET7XPCMF8RZ0Y151NZV2V" }, "status": { "description": "Status of the Return.", @@ -5466,39 +7567,74 @@ "enum": [ "requested", "received", - "requires_action" - ] + "requires_action", + "canceled" + ], + "default": "requested" }, "items": { - "description": "The Return Items that will be shipped back to the warehouse. type: array items: $ref: " + "description": "The Return Items that will be shipped back to the warehouse. Available if the relation `items` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/return_item" + } }, "swap_id": { - "description": "The id of the Swap that the Return is a part of.", - "type": "string" + "description": "The ID of the Swap that the Return is a part of.", + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "order_id": { - "description": "The id of the Order that the Return is made from.", - "type": "string" + "description": "The ID of the Order that the Return is made from.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "claim_order_id": { - "description": "The id of the Claim that the Return is a part of.", - "type": "string" + "description": "The ID of the Claim that the Return is a part of.", + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" }, "shipping_method": { - "description": "The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves.", - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_method" - } - ] + "description": "The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves. Available if the relation `shipping_method` is expanded.", + "type": "array", + "items": { + "$ref": "#/components/schemas/shipping_method" + } }, "shipping_data": { "description": "Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment.", - "type": "object" + "type": "object", + "example": {} }, "refund_amount": { "description": "The amount that should be refunded as a result of the return.", - "type": "integer" + "type": "integer", + "example": 1000 + }, + "no_notification": { + "description": "When set to true, no notification will be sent related to this return.", + "type": "boolean", + "example": false + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the return in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "received_at": { "description": "The date with timezone at which the return was received.", @@ -5506,22 +7642,124 @@ "format": "date-time" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, - "no_notification": { - "description": "When set to true, no notification will be sent related to this return.", - "type": "boolean" + "metadata": { + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "sales_channel": { + "title": "Sales Channel", + "description": "A Sales Channel", + "x-resourceId": "sales_channel", + "required": [ + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "The sales channel's ID", + "example": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A" + }, + "name": { + "description": "The name of the sales channel.", + "type": "string", + "example": "Market" + }, + "description": { + "description": "The description of the sales channel.", + "type": "string", + "example": "Multi-vendor market" + }, + "is_disabled": { + "description": "Specify if the sales channel is enabled or disabled.", + "type": "boolean", + "default": false + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" + } + } + }, + "sales_channel_tax_line": { + "title": "Sales Channel", + "description": "A Sales Channel", + "x-resourceId": "sales_channel_tax_line", + "required": [ + "shipping_method_id", + "rate", + "name" + ], + "properties": { + "id": { + "type": "string", + "description": "The line item tax line's ID", + "example": "smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" + }, + "shipping_method_id": { + "type": "string", + "description": "The ID of the line item", + "example": "sm_01F0YET7DR2E7CYVSDHM593QG2" + }, + "shipping_method": { + "description": "Available if the relation `shipping_method` is expanded.", + "$ref": "#/components/schemas/shipping_method" + }, + "code": { + "description": "A code to identify the tax type by", + "type": "string", + "example": "tax01" + }, + "name": { + "description": "A human friendly name for the tax", + "type": "string", + "example": "Tax Example" + }, + "rate": { + "description": "The numeric rate to charge tax by", + "type": "number", + "example": 10 + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5529,50 +7767,86 @@ "title": "Shipping Method", "description": "Shipping Methods represent a way in which an Order or Return can be shipped. Shipping Methods are built from a Shipping Option, but may contain additional details, that can be necessary for the Fulfillment Provider to handle the shipment.", "x-resourceId": "shipping_method", + "required": [ + "shipping_option_id", + "price" + ], "properties": { "id": { - "description": "The id of the Shipping Method. This value will be prefixed with `sm_`.", - "type": "string" + "type": "string", + "description": "The shipping method's ID", + "example": "sm_01F0YET7DR2E7CYVSDHM593QG2" }, "shipping_option_id": { "description": "The id of the Shipping Option that the Shipping Method is built from.", - "type": "string" + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" }, "shipping_option": { - "description": "The Shipping Option that the Shipping Method is built from.", - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_option" - } - ] + "description": "Available if the relation `shipping_option` is expanded.", + "$ref": "#/components/schemas/shipping_option" }, "order_id": { "description": "The id of the Order that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "return_id": { "description": "The id of the Return that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": null + }, + "return_order": { + "description": "A return object. Available if the relation `return_order` is expanded.", + "type": "object" }, "swap_id": { "description": "The id of the Swap that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": null + }, + "swap": { + "description": "A swap object. Available if the relation `swap` is expanded.", + "type": "object" }, "cart_id": { "description": "The id of the Cart that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "claim_order_id": { "description": "The id of the Claim that the Shipping Method is used on.", - "type": "string" + "type": "string", + "example": null + }, + "claim_order": { + "description": "A claim order object. Available if the relation `claim_order` is expanded.", + "type": "object" + }, + "tax_lines": { + "type": "array", + "description": "Available if the relation `tax_lines` is expanded.", + "items": { + "$ref": "#/components/schemas/tax_line" + } }, "price": { "description": "The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of.", - "type": "integer" + "type": "integer", + "example": 200 }, "data": { "description": "Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id.", - "type": "object" + "type": "object", + "example": {} } } }, @@ -5580,14 +7854,25 @@ "title": "Shipping Option Requirement", "description": "A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart.", "x-resourceId": "shipping_option_requirement", + "required": [ + "shipping_option_id", + "type", + "amount" + ], "properties": { "id": { - "description": "The id of the Shipping Option Requirement. This value will be prefixed with `sor_`.", - "type": "string" + "type": "string", + "description": "The shipping option requirement's ID", + "example": "sor_01G1G5V29AB4CTNDRFSRWSRKWD" }, "shipping_option_id": { - "description": "The id of the Shipping Option that the Shipping Option Requirement belongs to.", - "type": "string" + "description": "The id of the Shipping Option that the hipping option requirement belongs to", + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" + }, + "shipping_option": { + "description": "Available if the relation `shipping_option` is expanded.", + "$ref": "#/components/schemas/shipping_option" }, "type": { "description": "The type of the requirement, this defines how the value will be compared to the Cart's total. `min_subtotal` requirements define the minimum subtotal that is needed for the Shipping Option to be available, while the `max_subtotal` defines the maximum subtotal that the Cart can have for the Shipping Option to be available.", @@ -5595,11 +7880,18 @@ "enum": [ "min_subtotal", "max_subtotal" - ] + ], + "example": "min_subtotal" }, "amount": { "description": "The amount to compare the Cart subtotal to.", - "type": "integer" + "type": "integer", + "example": 100 + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" } } }, @@ -5607,34 +7899,50 @@ "title": "Shipping Option", "description": "Shipping Options represent a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information.", "x-resourceId": "shipping_option", + "required": [ + "name", + "region_id", + "profile_id", + "provider_id", + "price_type" + ], "properties": { "id": { - "description": "The id of the Shipping Option. This value will be prefixed with `so_`.", - "type": "string" + "type": "string", + "description": "The shipping option's ID", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" }, "name": { "description": "The name given to the Shipping Option - this may be displayed to the Customer.", - "type": "string" + "type": "string", + "example": "PostFake Standard" }, "region_id": { - "description": "The id of the Region that the Shipping Option belongs to.", - "type": "string" + "type": "string", + "description": "The region's ID", + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" }, "region": { - "description": "The id of the Region that the Shipping Option belongs to.", - "anyOf": [ - { - "$ref": "#/components/schemas/region" - } - ] + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" }, "profile_id": { - "description": "The id of the Shipping Profile that the Shipping Option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", - "type": "string" + "description": "The ID of the Shipping Profile that the shipping option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products.", + "type": "string", + "example": "sp_01G1G5V239ENSZ5MV4JAR737BM" + }, + "profile": { + "description": "Available if the relation `profile` is expanded.", + "$ref": "#/components/schemas/shipping_profile" }, "provider_id": { "description": "The id of the Fulfillment Provider, that will be used to process Fulfillments from the Shipping Option.", - "type": "string" + "type": "string", + "example": "manual" + }, + "provider": { + "description": "Available if the relation `provider` is expanded.", + "$ref": "#/components/schemas/fulfillment_provider" }, "price_type": { "description": "The type of pricing calculation that is used when creatin Shipping Methods from the Shipping Option. Can be `flat_rate` for fixed prices or `calculated` if the Fulfillment Provider can provide price calulations.", @@ -5642,18 +7950,21 @@ "enum": [ "flat_rate", "calculated" - ] + ], + "example": "flat_rate" }, "amount": { "description": "The amount to charge for shipping when the Shipping Option price type is `flat_rate`.", - "type": "integer" + "type": "integer", + "example": 200 }, "is_return": { "description": "Flag to indicate if the Shipping Option can be used for Return shipments.", - "type": "boolean" + "type": "boolean", + "default": false }, "requirements": { - "description": "The requirements that must be satisfied for the Shipping Option to be available for a Cart.", + "description": "The requirements that must be satisfied for the Shipping Option to be available for a Cart. Available if the relation `requirements` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/shipping_option_requirement" @@ -5661,26 +7972,30 @@ }, "data": { "description": "The data needed for the Fulfillment Provider to identify the Shipping Option.", - "type": "object" + "type": "object", + "example": {} }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5688,14 +8003,20 @@ "title": "Shipping Profile", "description": "Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products.", "x-resourceId": "shipping_profile", + "required": [ + "name", + "type" + ], "properties": { "id": { - "description": "The id of the Shipping Profile. This value will be prefixed with `sp_`.", - "type": "string" + "type": "string", + "description": "The shipping profile's ID", + "example": "sp_01G1G5V239ENSZ5MV4JAR737BM" }, "name": { "description": "The name given to the Shipping profile - this may be displayed to the Customer.", - "type": "string" + "type": "string", + "example": "Default Shipping Profile" }, "type": { "description": "The type of the Shipping Profile, may be `default`, `gift_card` or `custom`.", @@ -5704,44 +8025,45 @@ "default", "gift_card", "custom" - ] + ], + "example": "default" }, "products": { - "description": "The Products that the Shipping Profile defines Shipping Options for.", + "description": "The Products that the Shipping Profile defines Shipping Options for. Available if the relation `products` is expanded.", "type": "array", "items": { - "$ref": "#/components/schemas/product" + "type": "object", + "description": "A product object." } }, "shipping_options": { - "description": "The Shipping Options that can be used to fulfill the Products in the Shipping Profile.", + "description": "The Shipping Options that can be used to fulfill the Products in the Shipping Profile. Available if the relation `shipping_options` is expanded.", "type": "array", "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/shipping_option" - } - ] + "$ref": "#/components/schemas/shipping_option" } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5749,33 +8071,70 @@ "title": "Shipping Tax Rate", "description": "Associates a tax rate with a shipping option to indicate that the shipping option is taxed in a certain way", "x-resourceId": "shipping_tax_rate", + "required": [ + "shipping_option_id", + "rate_id" + ], "properties": { "shipping_option_id": { - "description": "The id of the Shipping Option", - "type": "string" + "description": "The ID of the Shipping Option", + "type": "string", + "example": "so_01G1G5V27GYX4QXNARRQCW1N8T" + }, + "shipping_option": { + "description": "Available if the relation `shipping_option` is expanded.", + "$ref": "#/components/schemas/shipping_option" }, "rate_id": { - "description": "The id of the Tax Rate", - "type": "string" + "description": "The ID of the Tax Rate", + "type": "string", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" + }, + "tax_rate": { + "description": "Available if the relation `tax_rate` is expanded.", + "$ref": "#/components/schemas/tax_rate" }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, - "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } + } + } + }, + "staged_job": { + "title": "Staged Job", + "description": "A staged job resource", + "x-resourceId": "staged_job", + "required": [ + "event_name" + ], + "properties": { + "id": { + "type": "string", + "description": "The staged job's ID", + "example": "job_01F0YET7BZTARY9MKN1SJ7AAXF" + }, + "event_name": { + "description": "The name of the event", + "type": "string", + "example": "order.placed" + }, + "data": { + "description": "Data necessary for the job", + "type": "object", + "example": {} } } }, @@ -5785,41 +8144,65 @@ "x-resourceId": "store", "properties": { "id": { - "description": "The id of the Store. This value will be prefixed with `store_`.", - "type": "string" + "type": "string", + "description": "The store's ID", + "example": "store_01G1G5V21KADXNGH29BJMAJ4B4" }, "name": { "description": "The name of the Store - this may be displayed to the Customer.", - "type": "string" + "type": "string", + "example": "Medusa Store" }, "default_currency_code": { - "description": "The default currency code used when no other currency code is specified.", - "type": "string" + "description": "The 3 character currency code that is the default of the store.", + "type": "string", + "example": "usd", + "externalDocs": { + "url": "https://en.wikipedia.org/wiki/ISO_4217#Active_codes", + "description": "See a list of codes." + } + }, + "default_currency": { + "description": "Available if the relation `default_currency` is expanded.", + "$ref": "#/components/schemas/currency" }, "currencies": { - "description": "The currencies that are enabled for the Store.", + "description": "The currencies that are enabled for the Store. Available if the relation `currencies` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/currency" } }, "swap_link_template": { - "description": "A template to generate Swap links from use {{cart_id}} to include the Swap's `cart_id` in the link.", - "type": "string" - }, - "created_at": { - "description": "The date with timezone at which the resource was created.", + "description": "A template to generate Swap links from. Use {{cart_id}} to include the Swap's `cart_id` in the link.", "type": "string", - "format": "date-time" + "example": null }, - "updated_at": { - "description": "The date with timezone at which the resource was last updated.", + "payment_link_template": { + "description": "A template to generate Payment links from. Use {{cart_id}} to include the payment's `cart_id` in the link.", "type": "string", - "format": "date-time" + "example": null + }, + "invite_link_template": { + "description": "A template to generate Invite links from", + "type": "string", + "example": null + }, + "default_sales_channel_id": { + "type": "string", + "description": "The sales channel ID the cart is associated with.", + "example": null + }, + "default_sales_channel": { + "description": "A sales channel object. Available if the relation `default_sales_channel` is expanded.", + "type": "object" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5827,25 +8210,28 @@ "title": "Swap", "description": "Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference.", "x-resourceId": "swap", + "required": [ + "fulfillment_status", + "payment_status", + "order_id" + ], "properties": { "id": { - "description": "The id of the Swap. This value will be prefixed with `swap_`.", - "type": "string" + "type": "string", + "description": "The swap's ID", + "example": "swap_01F0YET86Y9G92D3YDR9Y6V676" }, "fulfillment_status": { "description": "The status of the Fulfillment of the Swap.", "type": "string", "enum": [ "not_fulfilled", - "partially_fulfilled", "fulfilled", - "partially_shipped", "shipped", - "partially_returned", - "returned", "canceled", "requires_action" - ] + ], + "example": "not_fulfilled" }, "payment_status": { "description": "The status of the Payment of the Swap. The payment may either refer to the refund of an amount or the authorization of a new amount.", @@ -5854,59 +8240,62 @@ "not_paid", "awaiting", "captured", + "confirmed", "canceled", "difference_refunded", + "partially_refunded", + "refunded", "requires_action" - ] + ], + "example": "not_paid" }, "order_id": { - "description": "The id of the Order where the Line Items to be returned where purchased.", - "type": "string" + "description": "The ID of the Order where the Line Items to be returned where purchased.", + "type": "string", + "example": "order_01G8TJSYT9M6AVS5N4EMNFS1EK" + }, + "order": { + "description": "An order object. Available if the relation `order` is expanded.", + "type": "object" }, "additional_items": { - "description": "The new Line Items to ship to the Customer.", + "description": "The new Line Items to ship to the Customer. Available if the relation `additional_items` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/line_item" } }, "return_order": { - "description": "The Return that is issued for the return part of the Swap.", - "anyOf": [ - { - "$ref": "#/components/schemas/return" - } - ] + "description": "A return order object. The Return that is issued for the return part of the Swap. Available if the relation `return_order` is expanded.", + "type": "object" }, "fulfillments": { - "description": "The Fulfillments used to send the new Line Items.", + "description": "The Fulfillments used to send the new Line Items. Available if the relation `fulfillments` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/fulfillment" } }, "payment": { - "description": "The Payment authorized when the Swap requires an additional amount to be charged from the Customer.", - "anyOf": [ - { - "$ref": "#/components/schemas/payment" - } - ] + "description": "The Payment authorized when the Swap requires an additional amount to be charged from the Customer. Available if the relation `payment` is expanded.", + "$ref": "#/components/schemas/payment" }, "difference_due": { "description": "The difference that is paid or refunded as a result of the Swap. May be negative when the amount paid for the returned items exceed the total of the new Products.", - "type": "integer" + "type": "integer", + "example": 0 + }, + "shipping_address_id": { + "description": "The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order.", + "type": "string", + "example": "addr_01G8ZH853YPY9B94857DY91YGW" }, "shipping_address": { - "description": "The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "description": "Available if the relation `shipping_address` is expanded.", + "$ref": "#/components/schemas/address" }, "shipping_methods": { - "description": "The Shipping Methods used to fulfill the addtional items purchased.", + "description": "The Shipping Methods used to fulfill the addtional items purchased. Available if the relation `shipping_methods` is expanded.", "type": "array", "items": { "$ref": "#/components/schemas/shipping_method" @@ -5914,27 +8303,31 @@ }, "cart_id": { "description": "The id of the Cart that the Customer will use to confirm the Swap.", - "type": "string" + "type": "string", + "example": "cart_01G8ZH853Y6TFXWPG5EYE81X63" + }, + "cart": { + "description": "A cart object. Available if the relation `cart` is expanded.", + "type": "object" }, "allow_backorder": { "description": "If true, swaps can be completed with items out of stock", - "type": "boolean" + "type": "boolean", + "default": false + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of the swap in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "confirmed_at": { "description": "The date with timezone at which the Swap was confirmed by the Customer.", "type": "string", "format": "date-time" }, - "created_at": { - "description": "The date with timezone at which the resource was created.", - "type": "string", - "format": "date-time" - }, - "updated_at": { - "description": "The date with timezone at which the resource was last updated.", - "type": "string", - "format": "date-time" - }, "canceled_at": { "description": "The date with timezone at which the Swap was canceled.", "type": "string", @@ -5942,11 +8335,30 @@ }, "no_notification": { "description": "If set to true, no notification will be sent related to this swap", - "type": "boolean" + "type": "boolean", + "example": false + }, + "created_at": { + "type": "string", + "description": "The date with timezone at which the resource was created.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "The date with timezone at which the resource was updated.", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "description": "The date with timezone at which the resource was deleted.", + "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5954,36 +8366,47 @@ "title": "Tax Line", "description": "Line item that specifies an amount of tax to add to a line item.", "x-resourceId": "tax_line", + "required": [ + "rate", + "name" + ], "properties": { "id": { - "description": "The id of the Tax Line. This value will be prefixed by `tl_`.", - "type": "string" + "type": "string", + "description": "The tax line's ID", + "example": "tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8" }, "code": { "description": "A code to identify the tax type by", - "type": "string" + "type": "string", + "example": "tax01" }, "name": { "description": "A human friendly name for the tax", - "type": "string" + "type": "string", + "example": "Tax Example" }, "rate": { "description": "The numeric rate to charge tax by", - "type": "number" + "type": "number", + "example": 10 }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -5994,11 +8417,13 @@ "properties": { "id": { "description": "The id of the tax provider as given by the plugin.", - "type": "string" + "type": "string", + "example": "manual" }, "is_installed": { "description": "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`.", - "type": "boolean" + "type": "boolean", + "default": true } } }, @@ -6006,44 +8431,95 @@ "title": "Tax Rate", "description": "A Tax Rate can be used to associate a certain rate to charge on products within a given Region", "x-resourceId": "line_item", + "required": [ + "name", + "region_id" + ], "properties": { "id": { - "description": "The id of the Tax Rate. This value will be prefixed by `txr_`.", - "type": "string" + "type": "string", + "description": "The tax rate's ID", + "example": "txr_01G8XDBAWKBHHJRKH0AV02KXBR" }, "rate": { "description": "The numeric rate to charge", - "type": "number" + "type": "number", + "example": 10 }, "code": { "description": "A code to identify the tax type by", - "type": "string" + "type": "string", + "example": "tax01" }, "name": { "description": "A human friendly name for the tax", - "type": "string" + "type": "string", + "example": "Tax Example" }, "region_id": { + "type": "string", "description": "The id of the Region that the rate belongs to", - "type": "string" + "example": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G" + }, + "region": { + "description": "A region object. Available if the relation `region` is expanded.", + "type": "object" + }, + "products": { + "type": "array", + "description": "The products that belong to this tax rate. Available if the relation `products` is expanded.", + "items": { + "type": "object", + "description": "A product object." + } + }, + "product_types": { + "type": "array", + "description": "The product types that belong to this tax rate. Available if the relation `product_types` is expanded.", + "items": { + "type": "object", + "description": "A product type object." + } + }, + "shipping_options": { + "type": "array", + "description": "The shipping options that belong to this tax rate. Available if the relation `shipping_options` is expanded.", + "items": { + "type": "object", + "description": "A shipping option object." + } + }, + "product_count": { + "description": "The count of products", + "type": "integer", + "example": null + }, + "product_type_count": { + "description": "The count of product types", + "type": "integer", + "example": null + }, + "shipping_option_count": { + "description": "The count of shipping options", + "type": "integer", + "example": null }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" - }, - "refundable": { - "description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.", - "type": "integer" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -6051,41 +8527,64 @@ "title": "Tracking Link", "description": "Tracking Link holds information about tracking numbers for a Fulfillment. Tracking Links can optionally contain a URL that can be visited to see the status of the shipment.", "x-resourceId": "tracking_link", + "required": [ + "tracking_number", + "fulfillment_id" + ], "properties": { "id": { - "description": "The id of the Tracking Link. This value will be prefixed with `tlink_`.", - "type": "string" + "type": "string", + "description": "The tracking link's ID", + "example": "tlink_01G8ZH853Y6TFXWPG5EYE81X63" }, "url": { "description": "The URL at which the status of the shipment can be tracked.", - "type": "string" + "type": "string", + "format": "uri" }, "tracking_number": { "description": "The tracking number given by the shipping carrier.", - "type": "string" + "type": "string", + "format": "RH370168054CN" }, "fulfillment_id": { + "type": "string", "description": "The id of the Fulfillment that the Tracking Link references.", - "type": "string" + "example": "ful_01G8ZRTMQCA76TXNAT81KPJZRF" + }, + "fulfillment": { + "description": "Available if the relation `fulfillment` is expanded.", + "$ref": "#/components/schemas/fulfillment" + }, + "idempotency_key": { + "type": "string", + "description": "Randomly generated key used to continue the completion of a process in case of failure.", + "externalDocs": { + "url": "https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key", + "description": "Learn more how to use the idempotency key." + } }, "created_at": { - "description": "The date with timezone at which the resource was created.", "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { - "description": "The date with timezone at which the resource was last updated.", "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { - "description": "The date with timezone at which the resource was deleted.", "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "description": "An optional key-value map with additional information.", - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } }, @@ -6093,40 +8592,56 @@ "title": "User", "description": "Represents a User who can manage store settings.", "x-resourceId": "user", + "required": [ + "email" + ], "properties": { "id": { - "description": "The unique id of the User. This will be prefixed with `usr_`", - "type": "string" + "type": "string", + "description": "The user's ID", + "example": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V" }, "email": { "description": "The email of the User", - "type": "string" + "type": "string", + "format": "email" }, "first_name": { - "type": "string" + "description": "The first name of the User", + "type": "string", + "example": "Levi" }, "last_name": { - "description": "The Customer's billing address.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] + "description": "The last name of the User", + "type": "string", + "example": "Bogan" + }, + "api_token": { + "description": "An API token associated with the user.", + "type": "string", + "example": null }, "created_at": { "type": "string", + "description": "The date with timezone at which the resource was created.", "format": "date-time" }, "updated_at": { "type": "string", + "description": "The date with timezone at which the resource was updated.", "format": "date-time" }, "deleted_at": { "type": "string", + "description": "The date with timezone at which the resource was deleted.", "format": "date-time" }, "metadata": { - "type": "object" + "type": "object", + "description": "An optional key-value map with additional details", + "example": { + "car": "white" + } } } } diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index 81da5403dc..ae016ea75f 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -2,41 +2,53 @@ 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 allows authorization of admin Users and manages their + 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: Discount - x-resourceId: discount - name: Gift Card + description: Gift Card endpoints that allow handling gift cards in Medusa. x-resourceId: gift_card - - name: Notification - x-resourceId: notification - 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: Shipping Profile - x-resourceId: shipping_profile - name: Swap + description: Swap endpoints that allow handling swaps in Medusa. x-resourceId: swap - - name: Product Variant - x-resourceId: product_variant servers: - url: 'https://api.medusa-commerce.com/store' paths: @@ -99,6 +111,8 @@ paths: properties: customer: $ref: '#/components/schemas/customer' + '401': + description: Unauthorized '/auth/{email}': get: operationId: GetAuthEmail @@ -107,10 +121,11 @@ paths: parameters: - in: path name: email - required: true - description: The Customer's email. schema: type: string + format: email + required: true + description: The email to check if exists. tags: - Auth responses: @@ -122,6 +137,7 @@ paths: properties: exists: type: boolean + description: Whether email exists or not. '/collections/{id}': get: operationId: GetCollectionsCollection @@ -165,6 +181,50 @@ paths: schema: type: integer default: 10 + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date tags: - Collection responses: @@ -174,8 +234,19 @@ paths: application/json: schema: properties: - collection: - $ref: '#/components/schemas/product_collection' + collections: + type: array + items: + $ref: '#/components/schemas/product_collection' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page '/gift-cards/{code}': get: operationId: GetGiftCardsCode @@ -197,618 +268,8 @@ paths: application/json: schema: properties: - id: - description: The id of the Gift Card - code: - description: The code of the Gift Card - value: - description: The original value of the Gift Card. - balance: - description: The current balanace of the Gift Card - region: - $ref: '#/components/schemas/region' - /customers/me/addresses: - post: - operationId: PostCustomersCustomerAddresses - summary: Add a Shipping Address - description: Adds a Shipping Address to a Customer's saved addresses. - x-authenticated: true - requestBody: - content: - application/json: - schema: - required: - - address - properties: - address: - description: The Address to add to the Customer. - anyOf: - - $ref: '#/components/schemas/address' - tags: - - Customer - responses: - '200': - description: A successful response - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - /customers: - post: - operationId: PostCustomers - summary: Create a Customer - description: Creates a Customer account. - parameters: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - first_name - - last_name - - password - properties: - email: - type: string - description: The Customer's email address. - first_name: - type: string - description: The Customer's first name. - last_name: - type: string - description: The Customer's last name. - password: - type: string - description: The Customer's password for login. - phone: - type: string - description: The Customer's phone number. - '/customers/me/addresses/{address_id}': - delete: - operationId: DeleteCustomersCustomerAddressesAddress - summary: Delete an Address - description: Removes an Address from the Customer's saved addresse. - x-authenticated: true - parameters: - - in: path - name: address_id - required: true - description: The id of the Address to remove. - schema: - type: string - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - post: - operationId: PostCustomersCustomerAddressesAddress - summary: Update a Shipping Address - description: Updates a Customer's saved Shipping Address. - x-authenticated: true - parameters: - - in: path - name: address_id - required: true - description: The id of the Address to update. - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - address: - description: The updated Address. - anyOf: - - $ref: '#/components/schemas/address' - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - /customers/me: - get: - operationId: GetCustomersCustomer - summary: Retrieves a Customer - description: >- - Retrieves a Customer - the Customer must be logged in to retrieve their - details. - x-authenticated: true - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - post: - operationId: PostCustomersCustomer - summary: Update Customer details - description: Updates a Customer's saved details. - x-authenticated: true - requestBody: - content: - application/json: - schema: - properties: - first_name: - description: The Customer's first name. - type: string - last_name: - description: The Customer's last name. - type: string - billing_address: - description: The Address to be used for billing purposes. - anyOf: - - $ref: '#/components/schemas/address' - password: - description: The Customer's password. - type: string - phone: - description: The Customer's phone number. - type: string - email: - description: The email of the customer. - type: string - metadata: - description: Metadata about the customer. - type: object - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - /customers/me/payment-methods: - get: - operationId: GetCustomersCustomerPaymentMethods - summary: Retrieve saved payment methods - description: >- - Retrieves a list of a Customer's saved payment methods. Payment methods - are saved with Payment Providers and it is their responsibility to fetch - saved methods. - x-authenticated: true - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - payment_methods: - type: array - items: - properties: - provider_id: - type: string - description: >- - The id of the Payment Provider where the payment - method is saved. - data: - type: object - description: >- - The data needed for the Payment Provider to use the - saved payment method. - /customers/me/orders: - get: - operationId: GetCustomersCustomerOrders - summary: Retrieve Customer Orders - description: Retrieves a list of a Customer's Orders. - x-authenticated: true - parameters: - - in: query - name: limit - description: How many addresses to return. - schema: - type: integer - - in: query - name: offset - description: The offset in the resulting addresses. - schema: - type: integer - - in: query - name: fields - description: >- - (Comma separated string) Which fields should be included in the - resulting addresses. - schema: - type: string - - in: query - name: expand - description: >- - (Comma separated string) Which relations should be expanded in the - resulting addresses. - schema: - type: string - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - count: - description: The total number of Orders. - type: integer - offset: - description: The offset for pagination. - type: integer - limit: - description: 'The maxmimum number of Orders to return,' - type: integer - orders: - type: array - items: - $ref: '#/components/schemas/order' - /customers/password-token: - post: - operationId: PostCustomersCustomerPasswordToken - summary: Creates a reset password token - description: >- - Creates a reset password token to be used in a subsequent - /reset-password request. The password token should be sent out of band - e.g. via email and will not be returned. - parameters: [] - tags: - - Customer - responses: - '204': - description: OK - requestBody: - content: - application/json: - schema: - type: object - required: - - email - properties: - email: - type: string - description: Email of the user whose password should be reset. - /customers/reset-password: - post: - operationId: PostCustomersResetPassword - summary: Resets Customer password - description: >- - Resets a Customer's password using a password token created by a - previous /password-token request. - parameters: [] - tags: - - Customer - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - token - - password - properties: - email: - type: string - description: The Customer's email. - token: - type: string - description: The password token created by a /password-token request. - password: - type: string - description: The new password to set for the Customer. - '/orders/cart/{cart_id}': - get: - operationId: GetOrdersOrderCartId - summary: Retrieves Order by Cart id - description: >- - Retrieves an Order by the id of the Cart that was used to create the - Order. - parameters: - - in: path - name: cart_id - required: true - description: The id of Cart. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/orders/{id}': - get: - operationId: GetOrdersOrder - summary: Retrieves an Order - description: Retrieves an Order - parameters: - - in: path - name: id - required: true - description: The id of the Order. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: '#/components/schemas/customer' - /orders: - get: - operationId: GetOrders - summary: Look Up an Order - description: >- - Looks for an Order with a given `display_id`, `email` pair. The - `display_id`, `email` pair must match in order for the Order to be - returned. - parameters: - - in: query - name: display_id - required: true - description: The display id given to the Order. - schema: - type: number - - in: query - name: email - required: true - description: The email of the Order with the given display_id. - schema: - type: string - tags: - - Order - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - order: - $ref: '#/components/schemas/order' - '/products/{id}': - get: - operationId: GetProductsProduct - summary: Retrieves a Product - description: Retrieves a Product. - parameters: - - in: path - name: id - required: true - description: The id of the Product. - schema: - type: string - tags: - - Product - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - product: - $ref: '#/components/schemas/product' - /products: - get: - operationId: GetProducts - summary: List Products - description: Retrieves a list of Products. - parameters: - - in: query - name: q - description: Query used for searching products. - schema: - type: string - - in: query - name: id - description: Id of the product to search for. - schema: - type: string - - in: query - name: collection_id - style: form - explode: false - description: Collection ids to search for - schema: - type: array - items: - type: string - - in: query - name: tags - style: form - explode: false - description: Tags to search for - schema: - type: array - items: - type: string - - in: query - name: title - description: to search for. - schema: - type: string - - in: query - name: description - description: to search for. - schema: - type: string - - in: query - name: handle - description: to search for. - schema: - type: string - - in: query - name: is_giftcard - description: Search for giftcards using is_giftcard=true. - schema: - type: string - - in: query - name: type - description: to search for. - schema: - type: string - - in: query - name: created_at - description: >- - Date comparison for when resulting products was created, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: updated_at - description: >- - Date comparison for when resulting products was updated, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: deleted_at - description: >- - Date comparison for when resulting products was deleted, i.e. less - than, greater than etc. - schema: - type: object - - in: query - name: offset - description: How many products to skip in the result. - schema: - type: string - - in: query - name: limit - description: Limit the number of products returned. - schema: - type: string - tags: - - Product - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - count: - description: The total number of Products. - type: integer - offset: - description: The offset for pagination. - type: integer - limit: - description: 'The maxmimum number of Products to return,' - type: integer - products: - type: array - items: - $ref: '#/components/schemas/product' - '/regions/{id}': - get: - operationId: GetRegionsRegion - summary: Retrieves a Region - description: Retrieves a Region. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - region: - $ref: '#/components/schemas/region' - /regions: - get: - operationId: GetRegions - summary: List Regions - description: Retrieves a list of Regions. - tags: - - Region - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - count: - description: The total number of regions. - type: integer - offset: - description: The offset for pagination. - type: integer - limit: - description: 'The maxmimum number of regions to return,' - type: integer - regions: - type: array - items: - $ref: '#/components/schemas/region' + gift_card: + $ref: '#/components/schemas/gift_card' '/carts/{id}/shipping-methods': post: operationId: PostCartsCartShippingMethod @@ -820,12 +281,12 @@ paths: - in: path name: id required: true - description: The cart id. + description: The cart ID. schema: type: string responses: '200': - description: A successful response + description: OK content: application/json: schema: @@ -842,7 +303,7 @@ paths: properties: option_id: type: string - description: id of the shipping option to create the method from + description: ID of the shipping option to create the method from data: type: object description: >- @@ -861,22 +322,20 @@ paths: - in: path name: id required: true - description: The Cart id. + description: The Cart ID. schema: type: string tags: - Cart responses: '200': - description: A cart object with the tax_total field populated + description: OK content: application/json: schema: - oneOf: - - type: object - properties: - cart: - $ref: '#/components/schemas/cart' + properties: + cart: + $ref: '#/components/schemas/cart' '/carts/{id}/complete': post: summary: Complete a Cart @@ -907,19 +366,41 @@ paths: content: application/json: schema: - oneOf: - - type: object - properties: - order: - $ref: '#/components/schemas/order' - - type: object - properties: - cart: - $ref: '#/components/schemas/cart' - - type: object - properties: - cart: - $ref: '#/components/schemas/swap' + properties: + type: + type: string + description: The type of the data property. + enum: + - order + - cart + - swap + data: + type: object + description: >- + The data of the result object. Its type depends on the + type field. + oneOf: + - type: object + description: >- + Cart was successfully authorized and order was placed + successfully. + properties: + order: + $ref: '#/components/schemas/order' + - type: object + description: >- + Cart was successfully authorized but requires further + actions. + properties: + cart: + $ref: '#/components/schemas/cart' + - type: object + description: >- + When cart is used for a swap and it has been completed + successfully. + properties: + cart: + $ref: '#/components/schemas/swap' /carts: post: summary: Create a Cart @@ -937,16 +418,28 @@ paths: properties: region_id: type: string - description: The id of the Region to create the Cart in. + description: The ID of the Region to create the Cart in. + sales_channel_id: + type: string + description: >- + [EXPERIMENTAL] The ID of the Sales channel to create the + Cart in. country_code: type: string description: The 2 character ISO country code to create the Cart in. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. items: description: >- An optional array of `variant_id`, `quantity` pairs to generate Line Items from. type: array items: + required: + - variant_id + - quantity properties: variant_id: description: >- @@ -962,6 +455,9 @@ paths: `context` field is automatically populated with `ip` and `user_agent` type: object + example: + ip: '::1' + user_agent: Chrome tags: - Cart responses: @@ -1237,6 +733,93 @@ paths: properties: cart: $ref: '#/components/schemas/cart' + post: + operationId: PostCartsCart + summary: Update a Cart + description: Updates a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The id of the Region to create the Cart in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + email: + type: string + description: An email to be used on the Cart. + format: email + sales_channel_id: + type: string + description: The ID of the Sales channel to update the Cart with. + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address' + description: A full billing address object. + - type: string + description: The billing address ID + shipping_address: + description: The Address to be used for shipping. + anyOf: + - $ref: '#/components/schemas/address' + description: A full shipping address object. + - type: string + description: The shipping address ID + gift_cards: + description: An array of Gift Card codes to add to the Cart. + type: array + items: + required: + - code + properties: + code: + description: The code that a Gift Card is identified by. + type: string + discounts: + description: An array of Discount codes to add to the Cart. + type: array + items: + required: + - code + properties: + code: + description: The code that a Discount is identifed by. + type: string + customer_id: + description: The ID of the Customer to associate the Cart with. + type: string + context: + description: An optional object to provide context to the Cart. + type: object + example: + ip: '::1' + user_agent: Chrome + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' '/carts/{id}/payment-sessions/{provider_id}/refresh': post: operationId: PostCartsCartPaymentSessionsSession @@ -1281,7 +864,7 @@ paths: - in: path name: id required: true - description: The id of the Cart. + description: The ID of the Cart. schema: type: string tags: @@ -1305,69 +888,69 @@ paths: properties: provider_id: type: string - description: The id of the Payment Provider. - '/store/carts/{id}': + description: The ID of the Payment Provider. + /customers/me/addresses: post: - operationId: PostCartsCart - summary: Update a Cart" - description: Updates a Cart. - parameters: - - in: path - name: id - required: true - description: The id of the Cart. - schema: - type: string + operationId: PostCustomersCustomerAddresses + summary: Add a Shipping Address + description: Adds a Shipping Address to a Customer's saved addresses. + x-authenticated: true requestBody: content: application/json: schema: + required: + - address properties: - region_id: - type: string - description: The id of the Region to create the Cart in. - country_code: - type: string - description: The 2 character ISO country code to create the Cart in. - email: - type: string - description: An email to be used on the Cart. - billing_address: - description: The Address to be used for billing purposes. + address: + description: The Address to add to the Customer. anyOf: - $ref: '#/components/schemas/address' - shipping_address: - description: The Address to be used for shipping. - anyOf: - - $ref: '#/components/schemas/address' - gift_cards: - description: An array of Gift Card codes to add to the Cart. - type: array - items: - required: - - code - properties: - code: - description: The code that a Gift Card is identified by. - type: string - discounts: - description: An array of Discount codes to add to the Cart. - type: array - items: - required: - - code - properties: - code: - description: The code that a Discount is identifed by. - type: string - customer_id: - description: The id of the Customer to associate the Cart with. - type: string - context: - description: An optional object to provide context to the Cart. - type: object tags: - - Cart + - Customer + responses: + '200': + description: A successful response + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer account. + requestBody: + content: + application/json: + schema: + required: + - first_name + - last_name + - email + - password + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + phone: + description: The Customer's phone number. + type: string + tags: + - Customer responses: '200': description: OK @@ -1375,8 +958,705 @@ paths: application/json: schema: properties: - cart: - $ref: '#/components/schemas/cart' + customer: + $ref: '#/components/schemas/customer' + '422': + description: A customer with the same email exists + content: + application/json: + schema: + properties: + code: + type: string + description: The error code + type: + type: string + description: The type of error + message: + type: string + description: Human-readable message with details about the error + example: + code: invalid_request_error + type: duplicate_error + message: >- + A customer with the given email already has an account. Log in + instead + '/customers/me/addresses/{address_id}': + delete: + operationId: DeleteCustomersCustomerAddressesAddress + summary: Delete an Address + description: Removes an Address from the Customer's saved addresses. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to remove. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + post: + operationId: PostCustomersCustomerAddressesAddress + summary: Update a Shipping Address + description: Updates a Customer's saved Shipping Address. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/address' + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /customers/me: + get: + operationId: GetCustomersCustomer + summary: Retrieves a Customer + description: >- + Retrieves a Customer - the Customer must be logged in to retrieve their + details. + x-authenticated: true + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + post: + operationId: PostCustomersCustomer + summary: Update Customer details + description: Updates a Customer's saved details. + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address' + description: The full billing address object + - type: string + description: The ID of an existing billing address + password: + description: The Customer's password. + type: string + phone: + description: The Customer's phone number. + type: string + email: + description: The email of the customer. + type: string + metadata: + description: Metadata about the customer. + type: object + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /customers/me/payment-methods: + get: + operationId: GetCustomersCustomerPaymentMethods + summary: Retrieve saved payment methods + description: >- + Retrieves a list of a Customer's saved payment methods. Payment methods + are saved with Payment Providers and it is their responsibility to fetch + saved methods. + x-authenticated: true + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + payment_methods: + type: array + items: + properties: + provider_id: + type: string + description: >- + The id of the Payment Provider where the payment + method is saved. + data: + type: object + description: >- + The data needed for the Payment Provider to use the + saved payment method. + /customers/me/orders: + get: + operationId: GetCustomersCustomerOrders + summary: Retrieve Customer Orders + description: Retrieves a list of a Customer's Orders. + x-authenticated: true + parameters: + - in: query + name: limit + description: How many orders to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The offset in the resulting orders. + schema: + type: integer + default: 0 + - in: query + name: fields + description: >- + (Comma separated string) Which fields should be included in the + resulting orders. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated string) Which relations should be expanded in the + resulting orders. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + orders: + type: array + items: + $ref: '#/components/schemas/order' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + /customers/password-token: + post: + operationId: PostCustomersCustomerPasswordToken + summary: Creates a reset password token + description: >- + Creates a reset password token to be used in a subsequent + /reset-password request. The password token should be sent out of band + e.g. via email and will not be returned. + requestBody: + content: + application/json: + schema: + required: + - email + properties: + email: + description: The email of the customer. + type: string + format: email + tags: + - Customer + responses: + '204': + description: OK + /customers/password-reset: + post: + operationId: PostCustomersResetPassword + summary: Resets Customer password + description: >- + Resets a Customer's password using a password token created by a + previous /password-token request. + requestBody: + content: + application/json: + schema: + required: + - email + - password + - token + properties: + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + token: + description: The reset password token + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + '/orders/cart/{cart_id}': + get: + operationId: GetOrdersOrderCartId + summary: Retrieves Order by Cart id + description: >- + Retrieves an Order by the id of the Cart that was used to create the + Order. + parameters: + - in: path + name: cart_id + required: true + description: The ID of Cart. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/orders/{id}': + get: + operationId: GetOrdersOrder + summary: Retrieves an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + /orders: + get: + operationId: GetOrders + summary: Look Up an Order + description: Look up an order using filters. + parameters: + - in: query + name: display_id + required: true + description: The display id given to the Order. + schema: + type: number + - in: query + name: email + style: form + explode: false + description: The email associated with this order. + required: true + schema: + type: string + format: email + - in: query + name: shipping_address + style: form + explode: false + description: The shipping address associated with this order. + schema: + type: object + properties: + postal_code: + type: string + description: The postal code of the shipping address + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: '#/components/schemas/order' + '/products/{id}': + get: + operationId: GetProductsProduct + summary: Retrieves a Product + description: Retrieves a Product. + parameters: + - in: path + name: id + required: true + description: The id of the Product. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: '#/components/schemas/product' + /products: + get: + operationId: GetProducts + summary: List Products + description: Retrieves a list of Products. + parameters: + - in: query + name: q + description: >- + Query used for searching products by title, description, variant's + title, variant's sku, and collection's title + schema: + type: string + - in: query + name: id + style: form + explode: false + description: product IDs to search for. + schema: + oneOf: + - type: string + - type: array + items: + type: string + - in: query + name: collection_id + style: form + explode: false + description: Collection IDs to search for + schema: + type: array + items: + type: string + - in: query + name: tags + style: form + explode: false + description: Tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: title + description: title to search for. + schema: + type: string + - in: query + name: description + description: description to search for. + schema: + type: string + - in: query + name: handle + description: handle to search for. + schema: + type: string + - in: query + name: is_giftcard + description: Search for giftcards using is_giftcard=true. + schema: + type: boolean + - in: query + name: type + description: type to search for. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting products were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting products were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + default: 100 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each order of + the result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each order of + the result. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + products: + type: array + items: + $ref: '#/components/schemas/product' + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page + /products/search: + get: + operationId: GetProductsSearch + summary: Search Products + description: >- + Run a search query on products using the search engine installed on + Medusa + parameters: + - in: query + name: q + required: true + description: The query to run the search with. + schema: + type: string + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + hits: + type: array + description: >- + Array of results. The format of the items depends on the + search engine installed on the server. + '/regions/{id}': + get: + operationId: GetRegionsRegion + summary: Retrieves a Region + description: Retrieves a Region. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + /regions: + get: + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. + parameters: + - in: query + name: offset + description: How many regions to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of regions returned. + schema: + type: integer + default: 100 + - in: query + name: created_at + description: Date comparison for when resulting regions were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting regions were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + regions: + type: array + items: + $ref: '#/components/schemas/region' '/return-reasons/{id}': get: operationId: GetReturnReasonsReason @@ -1427,41 +1707,47 @@ paths: content: application/json: schema: + required: + - order_id + - items properties: order_id: type: string - description: The id of the Order to create the Return from. + description: The ID of the Order to create the Return from. items: description: The items to include in the Return. type: array items: + required: + - item_id + - quantity properties: item_id: - description: The id of the Line Item from the Order. + description: The ID of the Line Item from the Order. type: string quantity: description: The quantity to return. type: integer - required: - - item_id - - quantity + reason_id: + description: The ID of the return reason. + type: string + note: + description: A note to add to the item returned. + type: string return_shipping: description: >- If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves. type: object + required: + - option_id properties: option_id: type: string description: >- - The id of the Shipping Option to create the Shipping + The ID of the Shipping Option to create the Shipping Method from. - required: - - option_id - required: - - order_id - - items tags: - Return responses: @@ -1552,7 +1838,7 @@ paths: properties: order_id: type: string - description: The id of the Order to create the Swap for. + description: The ID of the Order to create the Swap for. return_items: description: The items to include in the Return. type: array @@ -1562,21 +1848,21 @@ paths: - quantity properties: item_id: - description: The id of the Line Item from the Order. + description: The ID of the Line Item from the Order. type: string quantity: - description: The quantity to return. + description: The quantity to swap. type: integer reason_id: - description: The id of the reason of this return + description: The ID of the reason of this return. type: string - note_id: - description: The id of the note + note: + description: The note to add to the item being swapped. type: string return_shipping_option: type: string description: >- - The id of the Shipping Option to create the Shipping Method + The ID of the Shipping Option to create the Shipping Method from. additional_items: description: The items to exchange the returned items to. @@ -1587,7 +1873,7 @@ paths: - quantity properties: variant_id: - description: The id of the Product Variant to send. + description: The ID of the Product Variant to send. type: string quantity: description: The quantity to send of the variant. @@ -1638,6 +1924,26 @@ paths: description: The id of the Product Variant. schema: type: string + - in: query + name: cart_id + description: The id of the Cart to set prices based on. + schema: + type: string + - in: query + name: region_id + description: The id of the Region to set prices based on. + schema: + type: string + - in: query + name: currency_code + style: form + explode: false + description: The 3 character ISO currency code to set prices based on. + schema: + type: string + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. tags: - Product Variant responses: @@ -1667,13 +1973,55 @@ paths: type: string - in: query name: offset + description: How many product variants to skip in the result. schema: type: number + default: '0' - in: query name: limit description: Maximum number of Product Variants to return. schema: type: number + default: '100' + - in: query + name: title + style: form + explode: false + description: product variant title to search for. + schema: + oneOf: + - type: string + description: a single title to search by + - type: array + description: multiple titles to search by + items: + type: string + - in: query + name: inventory_quantity + description: Filter by available inventory quantity + schema: + oneOf: + - type: number + description: a specific number to search by. + - type: object + description: search using less and greater than comparisons. + properties: + lt: + type: number + description: filter by inventory quantity less than this number + gt: + type: number + description: filter by inventory quantity greater than this number + lte: + type: number + description: >- + filter by inventory quantity less than or equal to this + number + gte: + type: number + description: >- + filter by inventory quantity greater than or equal to this + number tags: - Product Variant responses: @@ -1696,90 +2044,223 @@ components: properties: id: type: string + description: ID of the address + example: addr_01G8ZC9VS1XVE149MGH2J7QSSH customer_id: type: string + description: ID of the customer this address belongs to + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: Available if the relation `customer` is expanded. + type: array + items: + type: object + description: A customer object. company: type: string + description: Company name + example: Acme first_name: type: string + description: First name + example: Arno last_name: type: string + description: Last name + example: Willms address_1: type: string + description: Address line 1 + example: 14433 Kemmer Court address_2: type: string + description: Address line 2 + example: Suite 369 city: type: string + description: City + example: South Geoffreyview country_code: type: string + description: The 2 character ISO code of the country in lower case + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + example: st country: - $ref: '#/components/schemas/country' + description: A country object. Available if the relation `country` is expanded. + type: object + province: + type: string + description: Province + example: Kentucky + postal_code: + type: string + description: Postal Code + example: 72093 + phone: + type: string + description: Phone Number + example: 16128234334802 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white batch_job: title: Batch Job description: A Batch Job. x-resourceId: batch_job + required: + - type properties: id: + type: string description: The unique identifier for the batch job. - type: string + example: batch_01G8T782965PYFG0751G0Z38B4 type: + type: string description: The type of batch job. - type: string enum: - - product_import - - product_export + - product-import + - product-export status: - description: The status of the batch job. type: string + description: The status of the batch job. enum: - created - pre_processed + - confirmed - processing - completed - canceled - failed + default: created created_by: - description: The unique identifier of the user that created the batch job. type: string + description: The unique identifier of the user that created the batch job. + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + created_by_user: + description: >- + A user object. Available if the relation `created_by_user` is + expanded. + type: object context: + type: object description: >- The context of the batch job, the type of the batch job determines what the context should contain. - type: object + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images dry_run: - description: Specify if the job must apply the modifications or not. type: boolean + description: Specify if the job must apply the modifications or not. default: false result: - description: The result of the batch job. type: object + description: The result of the batch job. + properties: + count: + type: number + advancement_count: + type: number + progress: + type: number + errors: + type: object + properties: + message: + type: string + code: + oneOf: + - type: string + - type: number + err: + type: array + stat_descriptors: + type: object + properties: + key: + type: string + name: + type: string + message: + type: string + file_key: + type: string + file_size: + type: number + example: + errors: + - err: [] + code: unknown + message: Method not implemented. + stat_descriptors: + - key: product-export-count + name: Product count to export + message: There will be 8 products exported by this action pre_processed_at: - description: The date from which the job has been pre processed. type: string + description: The date from which the job has been pre processed. + format: date-time + processing_at: + type: string + description: The date the job is processing at. format: date-time confirmed_at: - description: The date when the confirmation has been done. type: string + description: The date when the confirmation has been done. format: date-time completed_at: - description: The date of the completion. type: string + description: The date of the completion. format: date-time canceled_at: - description: The date of the concellation. type: string + description: The date of the concellation. + format: date-time + failed_at: + type: string + description: The date when the job failed. format: date-time created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was last updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time cart: title: Cart @@ -1788,127 +2269,261 @@ components: properties: id: type: string + description: The cart's ID + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 email: type: string + description: The email associated with the cart + format: email billing_address_id: type: string + description: The billing address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW billing_address: + description: Available if the relation `billing_address` is expanded. $ref: '#/components/schemas/address' shipping_address_id: type: string + description: The shipping address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW shipping_address: + description: Available if the relation `shipping_address` is expanded. $ref: '#/components/schemas/address' items: + description: Available if the relation `items` is expanded. type: array items: $ref: '#/components/schemas/line_item' region_id: type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object discounts: type: array + description: Available if the relation `discounts` is expanded. items: - $ref: '#/components/schemas/region' + type: object + description: A discount object. gift_cards: type: array + description: Available if the relation `gift_cards` is expanded. items: - $ref: '#/components/schemas/gift_card' + type: object + description: A gift card object. customer_id: type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 customer: - $ref: '#/components/schemas/customer' + description: A customer object. Available if the relation `customer` is expanded. + type: object payment_session: + description: The selected payment session in the cart. $ref: '#/components/schemas/payment_session' payment_sessions: type: array + description: The payment sessions created on the cart. items: $ref: '#/components/schemas/payment_session' + payment_id: + type: string + description: The payment's ID if available + example: pay_01G8ZCC5W42ZNY842124G7P5R9 payment: + description: Available if the relation `payment` is expanded. $ref: '#/components/schemas/payment' shipping_methods: type: array + description: The shipping methods added to the cart. items: $ref: '#/components/schemas/shipping_method' type: type: string + description: The cart's type. enum: - default - swap + - draft_order - payment_link + - claim + default: default completed_at: type: string + description: The date with timezone at which the cart was completed. format: date-time + payment_authorized_at: + type: string + description: The date with timezone at which the payment was authorized. + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + context: + type: object + description: >- + The context of the cart which can include info like IP or user + agent. + example: + ip: '::1' + user_agent: PostmanRuntime/7.29.2 + sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white shipping_total: type: integer + description: The total of shipping + example: 1000 discount_total: type: integer + description: The total of discount + example: 800 tax_total: type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: >- + The total amount refunded if the order associated with this cart is + returned. + example: 0 + total: + type: integer + description: The total amount of the cart + example: 8200 subtotal: type: integer + description: The subtotal of the cart + example: 8000 refundable_amount: type: integer + description: The amount that can be refunded + example: 8200 gift_card_total: type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 claim_image: title: Claim Image description: Represents photo documentation of a claim. x-resourceId: claim_image + required: + - claim_item_id + - url properties: id: type: string + description: The claim image's ID + example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 claim_item_id: type: string + description: The ID of the claim item associated with the image + claim_item: + description: >- + A claim item object. Available if the relation `claim_item` is + expanded. + type: object url: type: string + description: The URL of the image + format: uri created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white claim_item: title: Claim Item description: >- Represents a claimed item along with information about the reasons for the claim. x-resourceId: claim_item + required: + - claim_order_id + - item_id + - variant_id + - reason + - quantity properties: id: type: string + description: The claim item's ID + example: citm_01G8ZH853Y6TFXWPG5EYE81X63 images: type: array + description: Available if the relation `images` is expanded. items: $ref: '#/components/schemas/claim_image' claim_order_id: + description: The ID of the claim this item is associated with. type: string + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object item_id: + description: The ID of the line item that the claim item refers to. type: string + example: item_01G8ZM25TN49YV9EQBE2NC27KC item: - description: The Line Item that the claim refers to + description: Available if the relation `item` is expanded. $ref: '#/components/schemas/line_item' variant_id: + description: The ID of the product variant that is claimed. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 variant: - description: The Product Variant that is claimed. - $ref: '#/components/schemas/product_variant' + description: A variant object. Available if the relation `variant` is expanded. + type: object reason: description: The reason for the claim type: string @@ -1920,27 +2535,37 @@ components: note: description: 'An optional note about the claim, for additional information' type: string + example: I don't like it. quantity: description: >- The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order. type: integer + example: 1 tags: - description: User defined tags for easy filtering and grouping. + description: >- + User defined tags for easy filtering and grouping. Available if the + relation 'tags' is expanded. type: array items: $ref: '#/components/schemas/claim_tag' created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white claim_order: title: Claim Order description: >- @@ -1948,9 +2573,14 @@ components: order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns. x-resourceId: claim_order + required: + - type + - order_id properties: id: type: string + description: The claim's ID + example: claim_01G8ZH853Y6TFXWPG5EYE81X63 type: type: string enum: @@ -1958,10 +2588,12 @@ components: - replace payment_status: type: string + description: The status of the claim's payment enum: - na - not_refunded - refunded + default: na fulfillment_status: type: string enum: @@ -1974,6 +2606,7 @@ components: - returned - canceled - requires_action + default: not_fulfilled claim_items: description: The items that have been claimed type: array @@ -1987,16 +2620,23 @@ components: items: $ref: '#/components/schemas/line_item' order_id: - description: The id of the order that the claim comes from. + description: The ID of the order that the claim comes from. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object return_order: - description: Holds information about the return if the claim is to be returned - $ref: '#/components/schemas/return' + description: >- + A return object. Holds information about the return if the claim is + to be returned. Available if the relation 'return_order' is expanded + type: object shipping_address_id: - description: The id of the address that the new items should be shipped to + description: The ID of the address that the new items should be shipped to type: string + example: addr_01G8ZH853YPY9B94857DY91YGW shipping_address: - description: The address that the new items should be shipped to + description: Available if the relation `shipping_address` is expanded. $ref: '#/components/schemas/address' shipping_methods: description: The shipping methods that the claim order will be shipped with. @@ -2011,94 +2651,160 @@ components: refund_amount: description: The amount that will be refunded in conjunction with the claim type: integer + example: 1000 canceled_at: - description: The date with timezone at which the Swap was canceled. + description: The date with timezone at which the claim was canceled. type: string format: date-time created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white no_notification: description: >- Flag for describing whether or not notifications related to this should be send. type: boolean - metadata: - type: object + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the claim in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. claim_tag: title: Claim Tag description: >- Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping. x-resourceId: claim_tag + required: + - value properties: id: - description: The id of the claim tag. Will be prefixed by `ctag_`. type: string + description: The claim tag's ID + example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 value: description: The value that the claim tag holds type: string + example: Damaged created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white country: title: Country description: Country details x-resourceId: country + required: + - iso_2 + - iso_3 + - num_code + - name + - display_name properties: id: - description: The database id of the country - type: integer + type: string + description: The country's ID + example: 109 iso_2: - description: The 2 character ISO code for the country. type: string + description: The 2 character ISO code of the country in lower case + example: it + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. iso_3: - description: The 3 character ISO code for the country. type: string + description: The 2 character ISO code of the country in lower case + example: ita + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements + description: See a list of codes. num_code: description: The numerical ISO code for the country. type: string + example: 380 + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements + description: See a list of codes. name: - description: The normalized country name; in upper case. + description: The normalized country name in upper case. type: string + example: ITALY display_name: description: The country name appropriate for display. type: string + example: Italy + region_id: + type: string + description: The region ID this country is associated with. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object currency: title: Currency description: Currency x-resourceId: currency + required: + - code + - symbol + - symbol_native + - name properties: code: description: The 3 character ISO code for the currency. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. symbol: description: The symbol used to indicate the currency. type: string + example: $ symbol_native: description: The native symbol used to indicate the currency. type: string + example: $ name: description: The written name of the currency type: string + example: US Dollar custom_shipping_option: title: Custom Shipping Option description: >- @@ -2106,242 +2812,363 @@ components: can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option x-resourceId: custom_shipping_option + required: + - price + - shipping_option_id properties: id: - description: >- - The id of the Custom Shipping Option. This value will be prefixed - with `cso_`. type: string + description: The custom shipping option's ID + example: cso_01G8X99XNB77DMFBJFWX6DN9V9 price: description: >- The custom price set that will override the shipping option's original price type: integer + example: 1000 shipping_option_id: description: >- - The id of the Shipping Option that the custom shipping option + The ID of the Shipping Option that the custom shipping option overrides - anyOf: - - $ref: '#/components/schemas/shipping_option' - cart_id: - description: The id of the Cart that the custom shipping option is attached to - anyOf: - - $ref: '#/components/schemas/cart' - created_at: - description: The date with timezone at which the resource was created. type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: >- + A shipping option object. Available if the relation + `shipping_option` is expanded. + type: object + cart_id: + description: The ID of the Cart that the custom shipping option is attached to + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white customer_group: title: Customer Group description: Represents a customer group x-resourceId: customer_group + required: + - name properties: id: type: string + description: The customer group's ID + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 name: type: string + description: The name of the customer group + example: VIP customers: type: array + description: >- + The customers that belong to the customer group. Available if the + relation `customers` is expanded. items: - $ref: '#/components/schemas/customer' + type: object + description: A customer object. + price_lists: + type: array + description: >- + The price lists that are associated with the customer group. + Available if the relation `price_lists` is expanded. + items: + $ref: '#/components/schemas/price_list' created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white customer: title: Customer description: Represents a customer x-resourceId: customer + required: + - email properties: id: type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 email: type: string + description: The customer's email + format: email + first_name: + type: string + description: The customer's first name + example: Arno + last_name: + type: string + description: The customer's first name + example: Willms billing_address_id: type: string + description: The customer's billing address ID + example: addr_01G8ZH853YPY9B94857DY91YGW billing_address: - description: The Customer's billing address. - anyOf: - - $ref: '#/components/schemas/address' + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' shipping_addresses: + description: Available if the relation `shipping_addresses` is expanded. type: array items: $ref: '#/components/schemas/address' - first_name: - type: string - last_name: - type: string phone: type: string + description: The customer's phone number + example: 16128234334802 has_account: type: boolean + description: Whether the customer has an account or not + default: false + orders: + description: Available if the relation `orders` is expanded. + type: array + items: + type: object + description: An order object. + groups: + description: >- + The customer groups the customer belongs to. Available if the + relation `groups` is expanded. + type: array + items: + $ref: '#/components/schemas/customer_group' created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_customer_group: title: Product Tag Discount Condition description: Associates a discount condition with a customer group x-resourceId: discount_condition_customer_group + required: + - customer_group_id + - condition_id properties: customer_group_id: - description: The id of the Product Tag + description: The ID of the Product Tag type: string + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + customer_group: + description: Available if the relation `customer_group` is expanded. + $ref: '#/components/schemas/customer_group' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product_collection: title: Product Collection Discount Condition description: Associates a discount condition with a product collection x-resourceId: discount_condition_product_collection + required: + - product_collection_id + - condition_id properties: product_collection_id: - description: The id of the Product Collection + description: The ID of the Product Collection type: string + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_collection: + description: Available if the relation `product_collection` is expanded. + $ref: '#/components/schemas/product_collection' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product_tag: title: Product Tag Discount Condition description: Associates a discount condition with a product tag x-resourceId: discount_condition_product_tag + required: + - product_tag_id + - condition_id properties: product_tag_id: - description: The id of the Product Tag + description: The ID of the Product Tag type: string + example: ptag_01F0YESHPZYY3H4SJ3A5918SBN condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_tag: + description: Available if the relation `product_tag` is expanded. + $ref: '#/components/schemas/product_tag' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product_type: title: Product Type Discount Condition description: Associates a discount condition with a product type x-resourceId: discount_condition_product + required: + - product_type_id + - condition_id properties: product_type_id: - description: The id of the Product Type + description: The ID of the Product Tag type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: '#/components/schemas/product_type' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition_product: title: Product Discount Condition description: Associates a discount condition with a product x-resourceId: discount_condition_product + required: + - product_id + - condition_id properties: product_id: - description: The id of the Product + description: The ID of the Product Tag type: string + example: prod_01G1G5V2MBA328390B5AXJ610F condition_id: - description: The id of the Discount Condition + description: The ID of the Discount Condition type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product: + description: Available if the relation `product` is expanded. + $ref: '#/components/schemas/product' + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: '#/components/schemas/discount_condition' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_condition: title: Discount Condition description: Holds rule conditions for when a discount is applicable x-resourceId: discount_condition + required: + - type + - operator + - discount_rule_id properties: id: - description: The id of the Discount Condition. Will be prefixed by `discon_`. type: string + description: The discount condition's ID + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A type: description: The type of the Condition type: string @@ -2351,31 +3178,93 @@ components: - product_collections - product_tags - customer_groups + operator: + description: The operator of the Condition + type: string + enum: + - in + - not_in + discount_rule_id: + type: string + description: The ID of the discount rule associated with the condition + example: dru_01F0YESMVK96HVX7N419E3CJ7C + discount_rule: + description: Available if the relation `discount_rule` is expanded. + $ref: '#/components/schemas/discount_rule' + products: + description: >- + products associated with this condition if type = products. + Available if the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + product_types: + description: >- + product types associated with this condition if type = + product_types. Available if the relation `product_types` is + expanded. + type: array + items: + type: object + description: A product type object. + product_tags: + description: >- + product tags associated with this condition if type = product_tags. + Available if the relation `product_tags` is expanded. + type: array + items: + type: object + description: A product tag object. + product_collections: + description: >- + product collections associated with this condition if type = + product_collections. Available if the relation `product_collections` + is expanded. + type: array + items: + type: object + description: A product collection object. + customer_groups: + description: >- + customer groups associated with this condition if type = + customer_groups. Available if the relation `customer_groups` is + expanded. + type: array + items: + type: object + description: A customer group object. created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount_rule: title: Discount Rule description: >- Holds the rules that governs how a Discount is calculated when applied to a Cart. x-resourceId: discount_rule + required: + - type + - value properties: id: - description: The id of the Discount Rule. Will be prefixed by `dru_`. type: string + description: The discount rule's ID + example: dru_01F0YESMVK96HVX7N419E3CJ7C type: description: >- The type of the Discount, can be `fixed` for discounts that reduce @@ -2386,76 +3275,97 @@ components: - fixed - percentage - free_shipping + example: percentage description: description: A short description of the discount type: string + example: 10 Percent value: description: >- The value that the discount represents; this will depend on the type of the discount type: integer + example: 10 allocation: description: The scope that the discount should apply to. type: string enum: - total - item + example: total conditions: description: >- A set of conditions that can be used to limit when the discount can - be used + be used. Available if the relation `conditions` is expanded. type: array items: - $ref: '#/components/schemas/discount_condition' + type: object + description: A discount condition object. created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white discount: title: Discount description: >- Represents a discount that can be applied to a cart for promotional purposes. x-resourceId: discount + required: + - code + - is_dynamic properties: id: - description: The id of the Discount. Will be prefixed by `disc_`. type: string + description: The discount's ID + example: disc_01F0YESMW10MGHWJKZSDDMN0VN code: description: >- A unique code for the discount - this will be used by the customer to apply the discount type: string + example: 10DISC is_dynamic: description: >- A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts type: boolean - rule: + example: false + rule_id: + type: string description: The Discount Rule that governs the behaviour of the Discount - anyOf: - - $ref: '#/components/schemas/discount_rule' + example: dru_01F0YESMVK96HVX7N419E3CJ7C + rule: + description: Available if the relation `rule` is expanded. + $ref: '#/components/schemas/discount_rule' is_disabled: description: >- Whether the Discount has been disabled. Disabled discounts cannot be applied to carts type: boolean + example: false parent_discount_id: + type: string description: >- The Discount that the discount was created from. This will always be a dynamic discount - type: string + example: disc_01G8ZH853YPY9B94857DY91YGW + parent_discount: + description: Available if the relation `parent_discount` is expanded. + $ref: '#/components/schemas/discount' starts_at: description: The time at which the discount can be used. type: string @@ -2464,32 +3374,44 @@ components: description: The time at which the discount can no longer be used. type: string format: date-time + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S regions: - description: The Regions in which the Discount can be used + description: >- + The Regions in which the Discount can be used. Available if the + relation `regions` is expanded. type: array items: - $ref: '#/components/schemas/region' + type: object + description: A region object. usage_limit: description: The maximum number of times that a discount can be used. type: integer + example: 100 usage_count: description: The number of times a discount has been used. type: integer + example: 50 + default: 0 created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white draft-order: title: DraftOrder description: Represents a draft order @@ -2497,64 +3419,102 @@ components: properties: id: type: string + description: The draft order's ID + example: dorder_01G8TJFKBG38YYFQ035MSVG03C status: type: string + description: The status of the draft order enum: - open - completed + default: open display_id: type: string + description: The draft order's display ID + example: 2 cart_id: type: string + description: The ID of the cart associated with the draft order. + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 cart: - anyOf: - - $ref: '#/components/schemas/cart' + description: A cart object. Available if the relation `cart` is expanded. + type: object order_id: type: string + description: The ID of the order associated with the draft order. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK order: - anyOf: - - $ref: '#/components/schemas/order' + description: An order object. Available if the relation `order` is expanded. + type: object canceled_at: type: string - format: date-time - created_at: - type: string - format: date-time - update_at: - type: string - format: date-time - deleted_at: - type: string + description: The date the draft order was canceled at. format: date-time completed_at: type: string + description: The date the draft order was completed at. format: date-time no_notification_order: type: boolean - metadata: - type: object + description: Whether to send the customer notifications regarding order updates. + example: false idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the draft order in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white fulfillment_item: title: Fulfillment Item description: >- Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item. x-resourceId: fulfillment_item + required: + - fulfillment_id + - item_id + - quantity properties: fulfillment_id: description: The id of the Fulfillment that the Fulfillment Item belongs to. type: string + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF item_id: description: The id of the Line Item that the Fulfillment Item references. type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + fulfillment: + description: >- + A fulfillment object. Available if the relation `fulfillment` is + expanded. + type: object item: - description: The Line Item that the Fulfillment Item references. - anyOf: - - $ref: '#/components/schemas/line_item' + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' quantity: description: The quantity of the Line Item that is included in the Fulfillment. type: integer + example: 1 fulfillment_provider: title: Fulfillment Provider description: >- @@ -2565,12 +3525,14 @@ components: id: description: The id of the fulfillment provider as given by the plugin. type: string + example: manual is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + example: true fulfillment: title: Fulfillment description: >- @@ -2582,28 +3544,50 @@ components: these providers through webhooks in order to automatically update and synchronize the state of Fulfillments. x-resourceId: fulfillment + required: + - provider_id properties: id: - description: The id of the Fulfillment. This value will be prefixed by `ful_`. type: string + description: The cart's ID + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF claim_order_id: description: The id of the Claim that the Fulfillment belongs to. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object swap_id: description: The id of the Swap that the Fulfillment belongs to. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object order_id: description: The id of the Order that the Fulfillment belongs to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object provider_id: description: >- The id of the Fulfillment Provider responsible for handling the fulfillment type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/fulfillment_provider' items: description: >- The Fulfillment Items in the Fulfillment - these hold information - about how many of each Line Item has been fulfilled. + about how many of each Line Item has been fulfilled. Available if + the relation `items` is expanded. type: array items: $ref: '#/components/schemas/fulfillment_item' @@ -2611,7 +3595,7 @@ components: description: >- The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment - Provider. + Provider. Available if the relation `tracking_links` is expanded. type: array items: $ref: '#/components/schemas/tracking_link' @@ -2623,6 +3607,12 @@ components: type: array items: type: string + data: + description: >- + This contains all the data necessary for the Fulfillment provider to + handle the fulfillment. + type: object + example: {} shipped_at: description: The date with timezone at which the Fulfillment was shipped. type: string @@ -2632,164 +3622,378 @@ components: Flag for describing whether or not notifications related to this should be send. type: boolean + example: false canceled_at: description: The date with timezone at which the Fulfillment was canceled. type: string format: date-time - created_at: - description: The date with timezone at which the resource was created. + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of the + fulfillment in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white gift_card_transaction: title: Gift Card Transaction description: >- Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order x-resourceId: gift_card_transaction + required: + - gift_card_id + - amount properties: id: - description: >- - The id of the Gift Card Transaction. This value will be prefixed by - `gct_`. type: string + description: The gift card transaction's ID + example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A gift_card_id: - description: The id of the Gift Card that was used in the transaction. + description: The ID of the Gift Card that was used in the transaction. type: string + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ gift_card: - description: The Gift Card that was used in the transaction. - anyOf: - - $ref: '#/components/schemas/gift_card' + description: >- + A gift card object. Available if the relation `gift_card` is + expanded. + type: object order_id: - description: The id of the Order that the Gift Card was used to pay for. + description: The ID of the Order that the Gift Card was used to pay for. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object amount: description: The amount that was used from the Gift Card. type: integer + example: 10 created_at: description: The date with timezone at which the resource was created. type: string format: date-time + is_taxable: + description: Whether the transaction is taxable or not. + type: boolean + example: false + tax_rate: + description: The tax rate of the transaction + type: number + example: 0 gift_card: title: Gift Card description: >- Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. x-resourceId: gift_card + required: + - code + - value + - balance + - region_id properties: id: - description: The id of the Gift Card. This value will be prefixed by `gift_`. type: string + description: The cart's ID + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ code: description: >- The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card. type: string + example: 3RFT-MH2C-Y4YZ-XMN4 value: description: The value that the Gift Card represents. type: integer + example: 10 balance: description: The remaining value on the Gift Card. type: integer + example: 10 region_id: + type: string description: The id of the Region in which the Gift Card is available. - type: string + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - description: The Region in which the Gift Card is available. - anyOf: - - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object order_id: - description: The id of the Order that the Gift Card was purchased in. type: string + description: The id of the Order that the Gift Card was purchased in. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object is_disabled: description: >- Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts. type: boolean + example: false ends_at: description: The time at which the Gift Card can no longer be used. type: string format: date-time created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white + idempotency_key: + title: Idempotency Key + description: >- + Idempotency Key is used to continue a process in case of any failure + that might occur. + x-resourceId: idempotency_key + required: + - idempotency_key + properties: + id: + type: string + description: The idempotency key's ID + example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A + idempotency_key: + description: >- + The unique randomly generated key used to determine the state of a + process. + type: string + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + locked_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + request_method: + description: The method of the request + type: string + example: POST + request_params: + type: object + description: The parameters passed to the request + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + request_path: + description: The request's path + type: string + example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + response_code: + type: string + description: The response's code. + example: 200 + response_body: + type: object + description: The response's body + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + recovery_point: + type: string + description: Where to continue from. + default: started image: title: Image description: Images holds a reference to a URL at which the image file can be found. x-resourceId: image + required: + - url properties: id: - description: The id of the Image. This value will be prefixed by `img_`. type: string + description: The image's ID + example: img_01G749BFYR6T8JTVW6SGW3K3E6 url: description: The URL at which the image file can be found. type: string + format: uri created_at: + type: string description: The date with timezone at which the resource was created. - type: string format: date-time - update_at: - description: The date with timezone at which the resource was last updated. + updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white invite: title: Invite description: Represents an invite x-resourceId: invite + required: + - user_email properties: id: type: string + description: The invite's ID + example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 user_email: type: string + description: The email of the user being invited. + format: email role: type: string + description: The user's role. enum: - admin - member - developer + default: member accepted: type: boolean + description: Whether the invite was accepted or not. + example: false token: type: string + description: The token used to accept the invite. expores_at: type: string + description: The date the invite expires at. format: date-time created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white + line_item_adjustment: + title: Line Item Adjustment + description: Represents an Line Item Adjustment + x-resourceId: line_item_adjustment + required: + - item_id + - description + - amount + properties: + id: + type: string + description: The invite's ID + example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + description: + type: string + description: The line item's adjustment description + example: Adjusted item's price. + discount_id: + type: string + description: The ID of the discount associated with the adjustment + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + discount: + description: Available if the relation `discount` is expanded. + $ref: '#/components/schemas/discount' + amount: + type: number + description: The adjustment amount + example: 1000 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + line_item_tax_line: + title: Line Item Tax Line + description: Represents an Line Item Tax Line + x-resourceId: line_item_tax_line + required: + - item_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white line_item: title: Line Item description: >- @@ -2799,87 +4003,176 @@ components: Returns. Line Items may also be created when processing Swaps and Claims. x-resourceId: line_item + required: + - title + - unit_price + - quantity properties: id: - description: The id of the Line Item. This value will be prefixed by `item_`. type: string + description: The cart's ID + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN cart_id: - description: The id of the Cart that the Line Item belongs to. + description: The ID of the Cart that the Line Item belongs to. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object order_id: - description: The id of the Order that the Line Item belongs to. + description: The ID of the Order that the Line Item belongs to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object swap_id: description: The id of the Swap that the Line Item belongs to. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object claim_order_id: description: The id of the Claim that the Line Item belongs to. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + description: Available if the relation `tax_lines` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_tax_line' + adjustments: + description: Available if the relation `adjustments` is expanded. + type: array + items: + $ref: '#/components/schemas/line_item_adjustment' title: description: >- The title of the Line Item, this should be easily identifiable by the Customer. type: string + example: Medusa Coffee Mug description: description: A more detailed description of the contents of the Line Item. type: string + example: One Size thumbnail: description: A URL string to a small image of the contents of the Line Item. type: string + format: uri + example: >- + https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png + is_return: + description: Is the item being returned + type: boolean + example: false is_giftcard: description: Flag to indicate if the Line Item is a Gift Card. type: boolean + example: false should_merge: description: >- Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item. type: boolean + example: false allow_discounts: description: >- Flag to indicate if the Line Item should be included when doing discount calculations. type: boolean + example: false + has_shipping: + description: >- + Flag to indicate if the Line Item has fulfillment associated with + it. + type: boolean + example: false unit_price: description: >- The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to. type: boolean + example: 8000 variant_id: description: The id of the Product Variant contained in the Line Item. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 variant: - description: The Product Variant contained in the Line Item. - anyOf: - - $ref: '#/components/schemas/product_variant' + description: >- + A product variant object. The Product Variant contained in the Line + Item. Available if the relation `variant` is expanded. + type: object quantity: description: The quantity of the content in the Line Item. type: integer + example: 1 fulfilled_quantity: description: The quantity of the Line Item that has been fulfilled. type: integer + example: 0 returned_quantity: description: The quantity of the Line Item that has been returned. type: integer + example: 0 shipped_quantity: description: The quantity of the Line Item that has been shipped. type: integer - created_at: - description: The date with timezone at which the resource was created. - type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - metadata: - description: An optional key-value map with additional information. - type: object + example: 0 refundable: description: >- The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration. type: integer + example: 0 + subtotal: + type: integer + description: The subtotal of the line item + example: 8000 + tax_total: + type: integer + description: The total of tax of the line item + example: 0 + total: + type: integer + description: The total amount of the line item + example: 8000 + original_total: + type: integer + description: The original total amount of the line item + example: 8000 + original_tax_total: + type: integer + description: The original tax total amount of the line item + example: 0 + discount_total: + type: integer + description: The total of discount of the line item + example: 0 + gift_card_total: + type: integer + description: The total of the gift card of the line item + example: 0 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white money_amount: title: Money Amount description: >- @@ -2890,50 +4183,82 @@ components: region-based pricing is used the amount will be in the currency defined for the Reigon. x-resourceId: money_amount + required: + - currency_code + - amount properties: id: - description: The id of the Money Amount. This value will be prefixed by `ma_`. type: string + description: The money amount's ID + example: ma_01F0YESHRFQNH5S8Q0PK84YYZN currency_code: description: The 3 character currency code that the Money Amount is given in. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' amount: description: >- The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost. type: integer + example: 100 min_quantity: description: >- The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities. type: integer + example: 1 max_quantity: description: >- The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities. type: integer + example: 1 + price_list_id: + type: string + description: The ID of the price list associated with the money amount + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + price_list: + description: Available if the relation `price_list` is expanded. + $ref: '#/components/schemas/price_list' variant_id: - description: The id of the Product Variant that the Money Amount belongs to. + description: The id of the Product Variant contained in the Line Item. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + The Product Variant contained in the Line Item. Available if the + relation `variant` is expanded. + type: object region_id: - description: The id of the Region that the Money Amount is defined for. type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - description: The Region that the Money Amount is defined for. - anyOf: - - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white note: title: Note description: >- @@ -2941,54 +4266,71 @@ components: resources to allow users to describe additional information in relation to these. x-resourceId: note + required: + - value + - resource_type + - resource_id properties: id: - description: The id of the Note. This value will be prefixed by `note_`. type: string + description: The note's ID + example: note_01G8TM8ENBMC7R90XRR1G6H26Q resource_type: description: The type of resource that the Note refers to. type: string + example: order resource_id: - description: The id of the resource that the Note refers to. + description: The ID of the resource that the Note refers to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK value: description: The contents of the note. type: string - author: - description: The author of the note. - anyOf: - - $ref: '#/components/schemas/user' - created_at: - description: The date with timezone at which the resource was created. + example: This order must be fulfilled on Monday + author_id: type: string + description: The ID of the author (user) + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + author: + description: Available if the relation `author` is expanded. + $ref: '#/components/schemas/user' + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white notification_provider: title: Notification Provider description: >- Represents a notification provider plugin and holds its installation status. x-resourceId: notification_provider + required: + - id properties: id: description: The id of the notification provider as given by the plugin. type: string + example: sendgrid is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + default: true notification: title: Notification description: >- @@ -2997,40 +4339,47 @@ components: used to show a chronological timeline for communications sent to a Customer regarding an Order, and enables resends. x-resourceId: notification + required: + - resource_type + - resource_id + - to properties: id: - description: The id of the Notification. This value will be prefixed by `noti_`. type: string + description: The notification's ID + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX event_name: description: The name of the event that the notification was sent for. type: string + example: order.placed resource_type: description: The type of resource that the Notification refers to. type: string + example: order resource_id: - description: The id of the resource that the Notification refers to. + description: The ID of the resource that the Notification refers to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK customer_id: - description: The id of the Customer that the Notification was sent to. + description: The ID of the Customer that the Notification was sent to. type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 customer: - description: The Customer that the Notification was sent to. - anyOf: - - $ref: '#/components/schemas/customer' + description: A customer object. Available if the relation `customer` is expanded. + type: object to: description: >- 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 type: string + example: user@example.com data: description: >- The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend. type: object - parent_id: - description: The id of the Notification that was originally sent. - type: string + example: {} resends: description: >- The resends that have been completed after the original @@ -3041,13 +4390,17 @@ components: provider_id: description: The id of the Notification Provider that handles the Notification. type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time notification_resend: title: Notification Resend @@ -3055,76 +4408,123 @@ components: x-resourceId: notification_resend properties: id: - description: The id of the Notification. This value will be prefixed by `noti_`. + description: The notification resend's ID type: string + example: noti_01F0YET45G9NHP08Z66CE4QKBS event_name: description: The name of the event that the notification was sent for. type: string + example: order.placed resource_type: description: The type of resource that the Notification refers to. type: string + example: order resource_id: - description: The id of the resource that the Notification refers to. + description: The ID of the resource that the Notification refers to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + customer_id: + description: The ID of the Customer that the Notification was sent to. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object to: description: >- 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 type: string + example: user@example.com data: description: >- The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend. type: object + example: {} parent_id: - description: The id of the Notification that was originally sent. + description: The ID of the Notification that was originally sent. type: string + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + parent_notification: + description: Available if the relation `parent_notification` is expanded. + $ref: '#/components/schemas/notification' provider_id: - description: The id of the Notification Provider that handles the Notification. + description: The ID of the Notification Provider that handles the Notification. type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/notification_provider' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time OAuth: title: OAuth description: Represent an OAuth app x-resourceId: OAuth + required: + - id + - display_name + - application_name properties: id: type: string + description: The app's ID + example: example_app display_name: type: string + description: The app's display name + example: Example app application_name: type: string + description: The app's name + example: example install_url: type: string + description: The URL to install the app + format: uri uninstall_url: - type: integer + type: string + description: The URL to uninstall the app + format: uri data: type: object + description: Any data necessary to the app. + example: {} order: title: Order description: Represents an order x-resourceId: order + required: + - customer_id + - email + - region_id + - currency_code properties: id: type: string + description: The order's ID + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK status: type: string + description: The order's status enum: - pending - completed - archived - canceled - requires_action + default: pending fulfillment_status: type: string + description: The order's fulfillment status enum: - not_fulfilled - partially_fulfilled @@ -3135,8 +4535,10 @@ components: - returned - canceled - requires_action + default: not_fulfilled payment_status: type: string + description: The order's payment status enum: - not_paid - awaiting @@ -3145,134 +4547,246 @@ components: - refuneded - canceled - requires_action + default: not_paid display_id: type: integer + description: The order's display ID + example: 2 cart_id: type: string - currency_code: - type: string - tax_rate: - type: number - discounts: - type: array - items: - $ref: '#/components/schemas/discount' - email: - type: string - billing_address_id: - type: string - billing_address: - anyOf: - - $ref: '#/components/schemas/address' - shipping_address_id: - type: string - shipping_address: - anyOf: - - $ref: '#/components/schemas/address' - items: - type: array - items: - $ref: '#/components/schemas/line_item' - region_id: - type: string - region: - anyOf: - - $ref: '#/components/schemas/region' - gift_cards: - type: array - items: - $ref: '#/components/schemas/gift_card' + description: The ID of the cart associated with the order + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object customer_id: type: string + description: The ID of the customer associated with the order + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 customer: - anyOf: - - $ref: '#/components/schemas/customer' - payment_session: - anyOf: - - $ref: '#/components/schemas/payment_session' - payment_sessions: + description: A customer object. Available if the relation `customer` is expanded. + type: object + email: + description: The email associated with the order + type: string + format: email + billing_address_id: + type: string + description: The ID of the billing address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: '#/components/schemas/address' + shipping_address_id: + type: string + description: The ID of the shipping address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + currency_code: + description: The 3 character currency code that is used in the order + type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' + tax_rate: + description: The order's tax rate + type: number + example: 0 + discounts: type: array + description: >- + The discounts used in the order. Available if the relation + `discounts` is expanded. items: - $ref: '#/components/schemas/payment_session' - payments: + type: object + description: A discount object. + gift_cards: type: array + description: >- + The gift cards used in the order. Available if the relation + `gift_cards` is expanded. items: - $ref: '#/components/schemas/payment' + type: object + description: A gift card object. shipping_methods: type: array + description: >- + The shipping methods used in the order. Available if the relation + `shipping_methods` is expanded. items: $ref: '#/components/schemas/shipping_method' + payments: + type: array + description: >- + The payments used in the order. Available if the relation `payments` + is expanded. + items: + $ref: '#/components/schemas/payment' fulfillments: type: array + description: >- + The fulfillments used in the order. Available if the relation + `fulfillments` is expanded. items: $ref: '#/components/schemas/fulfillment' returns: type: array + description: >- + The returns associated with the order. Available if the relation + `returns` is expanded. items: - $ref: '#/components/schemas/return' + type: object + description: A return object. claims: type: array + description: >- + The claims associated with the order. Available if the relation + `claims` is expanded. items: - $ref: '#/components/schemas/claim_order' + type: object + description: A claim order object. refunds: type: array + description: >- + The refunds associated with the order. Available if the relation + `refunds` is expanded. items: - $ref: '#/components/schemas/refund' + type: object + description: A refund object. swaps: type: array + description: >- + The swaps associated with the order. Available if the relation + `swaps` is expanded. items: - $ref: '#/components/schemas/refund' + type: object + description: A swap object. + draft_order_id: + type: string + description: The ID of the draft order this order is associated with. + example: null + draft_order: + description: >- + A draft order object. Available if the relation `draft_order` is + expanded. + type: object + items: + type: array + description: >- + The line items that belong to the order. Available if the relation + `items` is expanded. + items: + $ref: '#/components/schemas/line_item' gift_card_transactions: type: array + description: >- + The gift card transactions used in the order. Available if the + relation `gift_card_transactions` is expanded. items: $ref: '#/components/schemas/gift_card_transaction' canceled_at: type: string + description: The date the order was canceled on. format: date-time - created_at: - type: string - format: date-time - update_at: - type: string - format: date-time - deleted_at: - type: string - format: date-time - metadata: - type: object - shipping_total: - type: integer - discount_total: - type: integer - tax_total: - type: integer - subtotal: - type: integer - refundable_amount: - type: integer - gift_card_total: - type: integer - paid_total: - type: integer no_notification: description: >- Flag for describing whether or not notifications related to this should be send. type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the processing of the order + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + external_id: + description: The ID of an external order. + type: string + example: null + sales_channel_id: + type: string + description: The ID of the sales channel this order is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: The total amount refunded if the order is returned. + example: 0 + total: + type: integer + description: The total amount of the order + example: 8200 + subtotal: + type: integer + description: The subtotal of the order + example: 8000 + paid_total: + type: integer + description: The total amount paid + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 payment_provider: title: Payment Provider description: Represents a Payment Provider plugin and holds its installation status. x-resourceId: payment_provider + required: + - id properties: id: description: The id of the payment provider as given by the plugin. type: string + example: manual is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + default: true payment_session: title: Payment Session description: >- @@ -3283,25 +4797,34 @@ components: Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc. x-resourceId: payment_session + required: + - cart_id + - provider_id + - status properties: id: - description: >- - The id of the Payment Session. This value will be prefixed with - `ps_`. type: string + description: The payment session's ID + example: ps_01G901XNSRM2YS3ASN9H5KG3FZ cart_id: description: The id of the Cart that the Payment Session is created for. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object provider_id: description: >- The id of the Payment Provider that is responsible for the Payment Session type: string + example: manual is_selected: description: >- A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase. type: boolean + example: true status: description: >- Indicates the status of the Payment Session. Will default to @@ -3315,6 +4838,7 @@ components: - requires_more - error - canceled + example: pending data: description: >- The data required for the Payment Provider to identify, modify and @@ -3322,13 +4846,23 @@ components: holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state. type: object - created_at: - description: The date with timezone at which the resource was created. + example: {} + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of a cart in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time payment: title: Payment @@ -3336,33 +4870,59 @@ components: Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded. x-resourceId: payment + required: + - amount + - currency_code + - provider_id properties: id: - description: The id of the Payment. This value will be prefixed with `pay_`. type: string + description: The payment's ID + example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE swap_id: - description: The id of the Swap that the Payment is used for. - type: string - order_id: - description: The id of the Order that the Payment is used for. + description: The ID of the Swap that the Payment is used for. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object cart_id: description: The id of the Cart that the Payment Session is created for. type: string + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Payment is used for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object amount: description: The amount that the Payment has been authorized for. type: integer + example: 100 currency_code: description: The 3 character ISO currency code that the Payment is completed in. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' amount_refunded: description: >- The amount of the original Payment amount that has been refunded back to the Customer. type: integer + example: 0 provider_id: description: The id of the Payment Provider that is responsible for the Payment type: string + example: manual data: description: >- The data required for the Payment Provider to identify, modify and @@ -3370,6 +4930,7 @@ components: id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state. type: object + example: {} captured_at: description: The date with timezone at which the Payment was captured. type: string @@ -3378,27 +4939,50 @@ components: description: The date with timezone at which the Payment was canceled. type: string format: date-time - created_at: - description: The date with timezone at which the resource was created. + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of a payment + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white price_list: title: Price List description: >- Price Lists represents a set of prices that overrides the default price for one or more product variants. x-resourceId: price_list + required: + - name + - description properties: id: - description: The id of the Price List. This value will be prefixed by `pl_`. type: string + description: The price list's ID + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + name: + type: string + description: The price list's name + example: VIP Prices + description: + type: string + description: The price list's description + example: Prices for VIP customers type: description: >- The type of Price List. This can be one of either `sale` or @@ -3407,6 +4991,14 @@ components: enum: - sale - override + default: sale + status: + description: The status of the Price List + type: string + enum: + - active + - draft + default: draft starts_at: description: The date with timezone that the Price List starts being valid. type: string @@ -3416,60 +5008,78 @@ components: type: string format: date-time customer_groups: - description: The Customer Groups that the Price List applies to. + description: >- + The Customer Groups that the Price List applies to. Available if the + relation `customer_groups` is expanded. type: array items: - $ref: '#/components/schemas/customer_group' + type: object + description: A customer group object. + prices: + description: >- + The Money Amounts that are associated with the Price List. Available + if the relation `prices` is expanded. + type: array + items: + $ref: '#/components/schemas/money_amount' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time product_collection: title: Product Collection description: Product Collections represents a group of Products that are related. x-resourceId: product_collection + required: + - title properties: id: - description: >- - The id of the Product Collection. This value will be prefixed with - `pcol_`. type: string + description: The product collection's ID + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG title: description: The title that the Product Collection is identified by. type: string + example: Summer Collection handle: description: >- A unique string that identifies the Product Collection - can for example be used in slug structures. type: string + example: summer-collection products: - description: The Products contained in the Product Collection. + description: >- + The Products contained in the Product Collection. Available if the + relation `products` is expanded. type: array items: - $ref: '#/components/schemas/product' + type: object + description: A product collection object. created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_option_value: title: Product Option Value description: >- @@ -3477,43 +5087,57 @@ components: Product Option Value for each of the Product Options defined on the Product. x-resourceId: product_option_value + required: + - value + - option_id + - variant_id properties: id: - description: >- - The id of the Product Option Value. This value will be prefixed with - `optval_`. type: string + description: The product option value's ID + example: optval_01F0YESHR7S6ECD03RF6W12DSJ value: description: >- The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is "Size" this value could be "Small", "Medium" or "Large"). type: string + example: large option_id: description: >- - The id of the Product Option that the Product Option Value is + The ID of the Product Option that the Product Option Value is defined for. type: string + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + option: + description: Available if the relation `option` is expanded. + $ref: '#/components/schemas/product_option' variant_id: description: >- - The id of the Product Variant that the Product Option Value is + The ID of the Product Variant that the Product Option Value is defined for. type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: Available if the relation `variant` is expanded. + $ref: '#/components/schemas/product_variant' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_option: title: Product Option description: >- @@ -3521,150 +5145,189 @@ components: variants of a Product. Common Product Options are "Size" and "Color", but Medusa doesn't limit what Product Options that can be defined. x-resourceId: product_option + required: + - title + - product_id properties: id: - description: >- - The id of the Product Option. This value will be prefixed with - `opt_`. type: string + description: The product option's ID + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 title: description: The title that the Product Option is defined by (e.g. "Size"). type: string + example: Size values: - description: The Product Option Values that are defined for the Product Option. + description: >- + The Product Option Values that are defined for the Product Option. + Available if the relation `values` is expanded. type: array items: $ref: '#/components/schemas/product_option_value' product_id: - description: The id of the Product that the Product Option is defined for. + description: The ID of the Product that the Product Option is defined for. type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_tag: title: Product Tag description: Product Tags can be added to Products for easy filtering and grouping. x-resourceId: product_tag + required: + - value properties: id: - description: The id of the Product Tag. This value will be prefixed with `ptag_`. type: string + description: The product tag's ID + example: ptag_01G8K2MTMG9168F2B70S1TAVK3 value: - description: The value that the Product Tag represents (e.g. "Pants"). + description: The value that the Product Tag represents type: string + example: Pants created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_tax_rate: title: Product Tax Rate description: >- Associates a tax rate with a product to indicate that the product is taxed in a certain way x-resourceId: product_tax_rate + required: + - product_id + - rate_id properties: product_id: - description: The id of the Product + description: The ID of the Product type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: Available if the relation `product` is expanded. + $ref: '#/components/schemas/product' rate_id: - description: The id of the Tax Rate + description: The ID of the Tax Rate type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: '#/components/schemas/tax_rate' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_type_tax_rate: title: Product Type Tax Rate description: >- Associates a tax rate with a product type to indicate that the product type is taxed in a certain way x-resourceId: product_type_tax_rate + required: + - product_type_id + - rate_id properties: product_type_id: - description: The id of the Product type + description: The ID of the Product type type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: '#/components/schemas/product_type' rate_id: description: The id of the Tax Rate type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: '#/components/schemas/tax_rate' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_type: title: Product Type description: >- Product Type can be added to Products for filtering and reporting purposes. x-resourceId: product_type + required: + - value properties: id: - description: >- - The id of the Product Type. This value will be prefixed with - `ptyp_`. type: string + description: The product type's ID + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A value: - description: The value that the Product Type represents (e.g. "Clothing"). + description: The value that the Product Type represents. type: string + example: Clothing created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product_variant: title: Product Variant description: >- @@ -3673,25 +5336,33 @@ components: Product can have is given by the number of available Product Option combinations. x-resourceId: product_variant + required: + - title + - product_id + - inventory_quantity properties: id: - description: >- - The id of the Product Variant. This value will be prefixed with - `variant_`. type: string + description: The product variant's ID + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 title: description: >- A title that can be displayed for easy identification of the Product Variant. type: string + example: Small product_id: - description: The id of the Product that the Product Variant belongs to. + description: The ID of the Product that the Product Variant belongs to. type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object prices: description: >- The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific - Region. + Region. Available if the relation `prices` is expanded. type: array items: $ref: '#/components/schemas/money_amount' @@ -3701,96 +5372,119 @@ components: This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems. type: string + example: shirt-123 barcode: description: >- A generic field for a GTIN number that can be used to identify the Product Variant. type: string + example: null ean: description: >- An EAN barcode number that can be used to identify the Product Variant. type: string + example: null upc: description: >- A UPC barcode number that can be used to identify the Product Variant. type: string + example: null + variant_rank: + description: The ranking of this variant + type: number + default: 0 inventory_quantity: description: The current quantity of the item that is stocked. type: integer + example: 100 allow_backorder: description: >- Whether the Product Variant should be purchasable when `inventory_quantity` is 0. type: boolean + default: false manage_inventory: description: Whether Medusa should manage inventory for the Product Variant. type: boolean + default: true hs_code: description: >- The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null origin_country: description: >- The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null mid_code: description: >- The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null material: description: >- The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null weight: description: >- The weight of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null height: description: >- The height of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null width: description: >- The width of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null length: description: >- The length of the Product Variant. May be used in shipping rate calculations. - type: string + type: number + example: null options: - description: The Product Option Values specified for the Product Variant. + description: >- + The Product Option Values specified for the Product Variant. + Available if the relation `options` is expanded. type: array items: $ref: '#/components/schemas/product_option_value' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white product: title: Product description: >- @@ -3798,15 +5492,20 @@ components: such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. x-resourceId: product + required: + - title + - profile_id properties: id: - description: The id of the Product. This value will be prefixed with `prod_`. type: string + description: The product's ID + example: prod_01G1G5V2MBA328390B5AXJ610F title: description: >- A title that can be displayed for easy identification of the Product. type: string + example: Medusa Coffee Mug subtitle: description: >- An optional subtitle that can be used to further specify the @@ -3815,121 +5514,174 @@ components: description: description: A short description of the Product. type: string + example: Every programmer's best friend. handle: description: A unique identifier for the Product (e.g. for slug structure). type: string + example: coffee-mug is_giftcard: description: >- Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased. type: boolean - discountable: - description: >- - Whether the Product can be discounted. Discounts will not apply to - Line Items of this Product when this flag is set to `false`. - type: boolean + default: false + status: + description: The status of the product + type: string + enum: + - draft + - proposed + - published + - rejected + default: draft images: - description: Images of the Product + description: >- + Images of the Product. Available if the relation `images` is + expanded. type: array items: $ref: '#/components/schemas/image' thumbnail: description: A URL to an image file that can be used to identify the Product. type: string + format: uri options: description: >- The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product - Option Values. + Option Values. Available if the relation `options` is expanded. type: array items: $ref: '#/components/schemas/product_option' variants: description: >- The Product Variants that belong to the Product. Each will have a - unique combination of Product Option Values. + unique combination of Product Option Values. Available if the + relation `variants` is expanded. type: array items: $ref: '#/components/schemas/product_variant' profile_id: description: >- - The id of the Shipping Profile that the Product belongs to. Shipping + The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products. type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: '#/components/schemas/shipping_profile' + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null hs_code: description: >- The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null origin_country: description: >- The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null mid_code: description: >- The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string + example: null material: description: >- The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. type: string - weight: - description: >- - The weight of the Product Variant. May be used in shipping rate - calculations. + example: null + collection_id: type: string - height: - description: >- - The height of the Product Variant. May be used in shipping rate - calculations. - type: string - width: - description: >- - The width of the Product Variant. May be used in shipping rate - calculations. - type: string - length: - description: >- - The length of the Product Variant. May be used in shipping rate - calculations. - type: string - type: - description: The Product Type of the Product (e.g. "Clothing") - anyOf: - - $ref: '#/components/schemas/product_type' + description: The Product Collection that the Product belongs to + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG collection: - description: The Product Collection that the Product belongs to (e.g. "SS20") - anyOf: - - $ref: '#/components/schemas/product_collection' + description: >- + A product collection object. Available if the relation `collection` + is expanded. + type: object + type_id: + type: string + description: The Product type that the Product belongs to + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: Available if the relation `type` is expanded. + $ref: '#/components/schemas/product_type' tags: - description: The Product Tags assigned to the Product. + description: >- + The Product Tags assigned to the Product. Available if the relation + `tags` is expanded. type: array items: $ref: '#/components/schemas/product_tag' - created_at: - description: The date with timezone at which the resource was created. + discountable: + description: >- + Whether the Product can be discounted. Discounts will not apply to + Line Items of this Product when this flag is set to `false`. + type: boolean + default: true + external_id: + description: The external ID of the product type: string + example: null + sales_channels: + description: >- + The sales channels the product is associated with. Available if the + relation `sales_channels` is expanded. + type: array + items: + type: object + description: A sales channel object. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white refund: title: Refund description: >- @@ -3937,19 +5689,26 @@ components: a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by a store operator. x-resourceId: refund + required: + - order_id + - amount properties: id: - description: The id of the Refund. This value will be prefixed with `ref_`. type: string + description: The refund's ID + example: ref_01G1G5V27GYX4QXNARRQCW1N8T order_id: description: The id of the Order that the Refund is related to. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK amount: description: The amount that has be refunded to the Customer. type: integer + example: 1000 note: description: An optional note explaining why the amount was refunded. type: string + example: I didn't like it reason: description: >- The reason given for the Refund, will automatically be set when @@ -3961,17 +5720,33 @@ components: - swap - claim - other - created_at: - description: The date with timezone at which the resource was created. + example: return + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of the refund + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white region: title: Region description: >- @@ -3980,137 +5755,212 @@ components: Region can consist of multiple countries to accomodate common shopping settings across countries. x-resourceId: region + required: + - name + - currency_code + - tax_rate properties: id: - description: The id of the Region. This value will be prefixed with `reg_`. type: string + description: The cart's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G name: description: >- The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name. type: string + example: EU currency_code: - description: >- - The 3 character ISO currency code that Customers will shop in in the - Region. + description: The 3 character currency code that the Region uses. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: '#/components/schemas/currency' tax_rate: description: The tax rate that should be charged on purchases in the Region. type: number + example: 0 + tax_rates: + description: >- + The tax rates that are included in the Region. Available if the + relation `tax_rates` is expanded. + type: array + items: + $ref: '#/components/schemas/tax_rate' tax_code: description: >- The tax code used on purchases in the Region. This may be used by other systems for accounting purposes. type: string + example: null + gift_cards_taxable: + description: Whether the gift cards are taxable or not in this region. + type: boolean + default: true + automatic_taxes: + description: Whether taxes should be automated in this region. + type: boolean + default: true countries: - description: The countries that are included in the Region. + description: >- + The countries that are included in the Region. Available if the + relation `countries` is expanded. type: array items: $ref: '#/components/schemas/country' + tax_provider_id: + type: string + description: The ID of the tax provider used in this region + example: null + tax_provider: + description: Available if the relation `tax_provider` is expanded. + $ref: '#/components/schemas/tax_provider' payment_providers: description: >- The Payment Providers that can be used to process Payments in the - Region. + Region. Available if the relation `payment_providers` is expanded. type: array items: $ref: '#/components/schemas/payment_provider' fulfillment_providers: description: >- The Fulfillment Providers that can be used to fulfill orders in the - Region. + Region. Available if the relation `payment_providers` is expanded. type: array items: $ref: '#/components/schemas/fulfillment_provider' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white return_item: title: Return Item description: >- Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned. x-resourceId: return_item + required: + - return_id + - item_id properties: return_id: description: The id of the Return that the Return Item belongs to. type: string + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + return_order: + description: Available if the relation `return_order` is expanded. + $ref: '#/components/schemas/return' item_id: description: The id of the Line Item that the Return Item references. type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN item: - description: The Line Item that the Return Item references. - anyOf: - - $ref: '#/components/schemas/line_item' + description: Available if the relation `item` is expanded. + $ref: '#/components/schemas/line_item' quantity: description: The quantity of the Line Item that is included in the Return. type: integer + example: 1 is_requested: description: >- Whether the Return Item was requested initially or received unexpectedly in the warehouse. type: boolean + default: true requested_quantity: description: The quantity that was originally requested to be returned. type: integer + example: 1 recieved_quantity: description: The quantity that was received in the warehouse. type: integer + example: 1 + reason_id: + description: The ID of the reason for returning the item. + type: string + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ reason: - description: The reason for returning the item. - anyOf: - - $ref: '#/components/schemas/return_reason' + description: Available if the relation `reason` is expanded. + $ref: '#/components/schemas/return_reason' note: description: An optional note with additional details about the Return. type: string + example: I didn't like it. metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white return_reason: title: Return Reason description: >- A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned. x-resourceId: return_reason + required: + - value + - label properties: id: - description: The id of the Return Reason will start with `rr_`. type: string + description: The cart's ID + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ description: description: A description of the Reason. type: string + example: Items that are damaged label: description: A text that can be displayed to the Customer as a reason. type: string + example: Damaged goods value: description: The value to identify the reason by. type: string - created_at: - description: The date with timezone at which the resource was created. + example: damaged + parent_return_reason_id: type: string + description: The ID of the parent reason. + example: null + parent_return_reason: + description: Available if the relation `parent_return_reason` is expanded. + $ref: '#/components/schemas/return_reason' + return_reason_children: + description: Available if the relation `return_reason_children` is expanded. + $ref: '#/components/schemas/return_reason' + created_at: + type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white return: title: Return description: >- @@ -4118,10 +5968,13 @@ components: to send back, along with how the items will be returned. Returns can be used as part of a Swap. x-resourceId: return + required: + - refund_amount properties: id: - description: The id of the Return. This value will be prefixed with `ret_`. type: string + description: The return's ID + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V status: description: Status of the Return. type: string @@ -4129,53 +5982,168 @@ components: - requested - received - requires_action + - canceled + default: requested items: description: >- - The Return Items that will be shipped back to the warehouse. type: - array items: $ref: + The Return Items that will be shipped back to the warehouse. + Available if the relation `items` is expanded. + type: array + items: + $ref: '#/components/schemas/return_item' swap_id: - description: The id of the Swap that the Return is a part of. + description: The ID of the Swap that the Return is a part of. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object order_id: - description: The id of the Order that the Return is made from. + description: The ID of the Order that the Return is made from. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object claim_order_id: - description: The id of the Claim that the Return is a part of. + description: The ID of the Claim that the Return is a part of. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object shipping_method: description: >- The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves. - anyOf: - - $ref: '#/components/schemas/shipping_method' + Available if the relation `shipping_method` is expanded. + type: array + items: + $ref: '#/components/schemas/shipping_method' shipping_data: description: >- Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment. type: object + example: {} refund_amount: description: The amount that should be refunded as a result of the return. type: integer - received_at: - description: The date with timezone at which the return was received. - type: string - format: date-time - created_at: - description: The date with timezone at which the resource was created. - type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time + example: 1000 no_notification: description: >- When set to true, no notification will be sent related to this return. type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the return + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + received_at: + description: The date with timezone at which the return was received. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white + sales_channel: + title: Sales Channel + description: A Sales Channel + x-resourceId: sales_channel + required: + - name + properties: + id: + type: string + description: The sales channel's ID + example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + name: + description: The name of the sales channel. + type: string + example: Market + description: + description: The description of the sales channel. + type: string + example: Multi-vendor market + is_disabled: + description: Specify if the sales channel is enabled or disabled. + type: boolean + default: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + sales_channel_tax_line: + title: Sales Channel + description: A Sales Channel + x-resourceId: sales_channel_tax_line + required: + - shipping_method_id + - rate + - name + properties: + id: + type: string + description: The line item tax line's ID + example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + shipping_method_id: + type: string + description: The ID of the line item + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_method: + description: Available if the relation `shipping_method` is expanded. + $ref: '#/components/schemas/shipping_method' + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white shipping_method: title: Shipping Method description: >- @@ -4184,65 +6152,105 @@ components: contain additional details, that can be necessary for the Fulfillment Provider to handle the shipment. x-resourceId: shipping_method + required: + - shipping_option_id + - price properties: id: - description: >- - The id of the Shipping Method. This value will be prefixed with - `sm_`. type: string + description: The shipping method's ID + example: sm_01F0YET7DR2E7CYVSDHM593QG2 shipping_option_id: description: >- The id of the Shipping Option that the Shipping Method is built from. type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T shipping_option: - description: The Shipping Option that the Shipping Method is built from. - anyOf: - - $ref: '#/components/schemas/shipping_option' + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' order_id: description: The id of the Order that the Shipping Method is used on. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object return_id: description: The id of the Return that the Shipping Method is used on. type: string + example: null + return_order: + description: >- + A return object. Available if the relation `return_order` is + expanded. + type: object swap_id: description: The id of the Swap that the Shipping Method is used on. type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object cart_id: description: The id of the Cart that the Shipping Method is used on. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object claim_order_id: description: The id of the Claim that the Shipping Method is used on. type: string + example: null + claim_order: + description: >- + A claim order object. Available if the relation `claim_order` is + expanded. + type: object + tax_lines: + type: array + description: Available if the relation `tax_lines` is expanded. + items: + $ref: '#/components/schemas/tax_line' price: description: >- The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of. type: integer + example: 200 data: description: >- Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id. type: object + example: {} shipping_option_requirement: title: Shipping Option Requirement description: >- A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart. x-resourceId: shipping_option_requirement + required: + - shipping_option_id + - type + - amount properties: id: - description: >- - The id of the Shipping Option Requirement. This value will be - prefixed with `sor_`. type: string + description: The shipping option requirement's ID + example: sor_01G1G5V29AB4CTNDRFSRWSRKWD shipping_option_id: description: >- - The id of the Shipping Option that the Shipping Option Requirement - belongs to. + The id of the Shipping Option that the hipping option requirement + belongs to type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' type: description: >- The type of the requirement, this defines how the value will be @@ -4254,9 +6262,15 @@ components: enum: - min_subtotal - max_subtotal + example: min_subtotal amount: description: The amount to compare the Cart subtotal to. type: integer + example: 100 + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time shipping_option: title: Shipping Option description: >- @@ -4267,35 +6281,49 @@ components: Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. x-resourceId: shipping_option + required: + - name + - region_id + - profile_id + - provider_id + - price_type properties: id: - description: >- - The id of the Shipping Option. This value will be prefixed with - `so_`. type: string + description: The shipping option's ID + example: so_01G1G5V27GYX4QXNARRQCW1N8T name: description: >- The name given to the Shipping Option - this may be displayed to the Customer. type: string + example: PostFake Standard region_id: - description: The id of the Region that the Shipping Option belongs to. type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G region: - description: The id of the Region that the Shipping Option belongs to. - anyOf: - - $ref: '#/components/schemas/region' + description: A region object. Available if the relation `region` is expanded. + type: object profile_id: description: >- - The id of the Shipping Profile that the Shipping Option belongs to. + The ID of the Shipping Profile that the shipping option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products. type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: '#/components/schemas/shipping_profile' provider_id: description: >- The id of the Fulfillment Provider, that will be used to process Fulfillments from the Shipping Option. type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: '#/components/schemas/fulfillment_provider' price_type: description: >- The type of pricing calculation that is used when creatin Shipping @@ -4306,20 +6334,24 @@ components: enum: - flat_rate - calculated + example: flat_rate amount: description: >- The amount to charge for shipping when the Shipping Option price type is `flat_rate`. type: integer + example: 200 is_return: description: >- Flag to indicate if the Shipping Option can be used for Return shipments. type: boolean + default: false requirements: description: >- The requirements that must be satisfied for the Shipping Option to - be available for a Cart. + be available for a Cart. Available if the relation `requirements` is + expanded. type: array items: $ref: '#/components/schemas/shipping_option_requirement' @@ -4328,38 +6360,44 @@ components: The data needed for the Fulfillment Provider to identify the Shipping Option. type: object + example: {} created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white shipping_profile: title: Shipping Profile description: >- Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. x-resourceId: shipping_profile + required: + - name + - type properties: id: - description: >- - The id of the Shipping Profile. This value will be prefixed with - `sp_`. type: string + description: The shipping profile's ID + example: sp_01G1G5V239ENSZ5MV4JAR737BM name: description: >- The name given to the Shipping profile - this may be displayed to the Customer. type: string + example: Default Shipping Profile type: description: >- The type of the Shipping Profile, may be `default`, `gift_card` or @@ -4369,99 +6407,156 @@ components: - default - gift_card - custom + example: default products: - description: The Products that the Shipping Profile defines Shipping Options for. + description: >- + The Products that the Shipping Profile defines Shipping Options for. + Available if the relation `products` is expanded. type: array items: - $ref: '#/components/schemas/product' + type: object + description: A product object. shipping_options: description: >- The Shipping Options that can be used to fulfill the Products in the - Shipping Profile. + Shipping Profile. Available if the relation `shipping_options` is + expanded. type: array items: - anyOf: - - $ref: '#/components/schemas/shipping_option' + $ref: '#/components/schemas/shipping_option' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white shipping_tax_rate: title: Shipping Tax Rate description: >- Associates a tax rate with a shipping option to indicate that the shipping option is taxed in a certain way x-resourceId: shipping_tax_rate + required: + - shipping_option_id + - rate_id properties: shipping_option_id: - description: The id of the Shipping Option + description: The ID of the Shipping Option type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: '#/components/schemas/shipping_option' rate_id: - description: The id of the Tax Rate + description: The ID of the Tax Rate type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: '#/components/schemas/tax_rate' created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time - deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white + staged_job: + title: Staged Job + description: A staged job resource + x-resourceId: staged_job + required: + - event_name + properties: + id: + type: string + description: The staged job's ID + example: job_01F0YET7BZTARY9MKN1SJ7AAXF + event_name: + description: The name of the event + type: string + example: order.placed + data: + description: Data necessary for the job + type: object + example: {} store: title: Store description: 'Holds settings for the Store, such as name, currencies, etc.' x-resourceId: store properties: id: - description: The id of the Store. This value will be prefixed with `store_`. type: string + description: The store's ID + example: store_01G1G5V21KADXNGH29BJMAJ4B4 name: description: The name of the Store - this may be displayed to the Customer. type: string + example: Medusa Store default_currency_code: - description: >- - The default currency code used when no other currency code is - specified. + description: The 3 character currency code that is the default of the store. type: string + example: usd + externalDocs: + url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes' + description: See a list of codes. + default_currency: + description: Available if the relation `default_currency` is expanded. + $ref: '#/components/schemas/currency' currencies: - description: The currencies that are enabled for the Store. + description: >- + The currencies that are enabled for the Store. Available if the + relation `currencies` is expanded. type: array items: $ref: '#/components/schemas/currency' swap_link_template: description: >- - A template to generate Swap links from use {{cart_id}} to include + A template to generate Swap links from. Use {{cart_id}} to include the Swap's `cart_id` in the link. type: string - created_at: - description: The date with timezone at which the resource was created. + example: null + payment_link_template: + description: >- + A template to generate Payment links from. Use {{cart_id}} to + include the payment's `cart_id` in the link. type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. + example: null + invite_link_template: + description: A template to generate Invite links from type: string - format: date-time - metadata: - description: An optional key-value map with additional information. + example: null + default_sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + default_sales_channel: + description: >- + A sales channel object. Available if the relation + `default_sales_channel` is expanded. type: object + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white swap: title: Swap description: >- @@ -4473,23 +6568,25 @@ components: Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference. x-resourceId: swap + required: + - fulfillment_status + - payment_status + - order_id properties: id: - description: The id of the Swap. This value will be prefixed with `swap_`. type: string + description: The swap's ID + example: swap_01F0YET86Y9G92D3YDR9Y6V676 fulfillment_status: description: The status of the Fulfillment of the Swap. type: string enum: - not_fulfilled - - partially_fulfilled - fulfilled - - partially_shipped - shipped - - partially_returned - - returned - canceled - requires_action + example: not_fulfilled payment_status: description: >- The status of the Payment of the Swap. The payment may either refer @@ -4499,71 +6596,96 @@ components: - not_paid - awaiting - captured + - confirmed - canceled - difference_refunded + - partially_refunded + - refunded - requires_action + example: not_paid order_id: description: >- - The id of the Order where the Line Items to be returned where + The ID of the Order where the Line Items to be returned where purchased. type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object additional_items: - description: The new Line Items to ship to the Customer. + description: >- + The new Line Items to ship to the Customer. Available if the + relation `additional_items` is expanded. type: array items: $ref: '#/components/schemas/line_item' return_order: - description: The Return that is issued for the return part of the Swap. - anyOf: - - $ref: '#/components/schemas/return' + description: >- + A return order object. The Return that is issued for the return part + of the Swap. Available if the relation `return_order` is expanded. + type: object fulfillments: - description: The Fulfillments used to send the new Line Items. + description: >- + The Fulfillments used to send the new Line Items. Available if the + relation `fulfillments` is expanded. type: array items: $ref: '#/components/schemas/fulfillment' payment: description: >- The Payment authorized when the Swap requires an additional amount - to be charged from the Customer. - anyOf: - - $ref: '#/components/schemas/payment' + to be charged from the Customer. Available if the relation `payment` + is expanded. + $ref: '#/components/schemas/payment' difference_due: description: >- The difference that is paid or refunded as a result of the Swap. May be negative when the amount paid for the returned items exceed the total of the new Products. type: integer - shipping_address: + example: 0 + shipping_address_id: description: >- The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order. - anyOf: - - $ref: '#/components/schemas/address' + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: '#/components/schemas/address' shipping_methods: - description: The Shipping Methods used to fulfill the addtional items purchased. + description: >- + The Shipping Methods used to fulfill the addtional items purchased. + Available if the relation `shipping_methods` is expanded. type: array items: $ref: '#/components/schemas/shipping_method' cart_id: description: The id of the Cart that the Customer will use to confirm the Swap. type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object allow_backorder: description: 'If true, swaps can be completed with items out of stock' type: boolean + default: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the swap + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. confirmed_at: description: >- The date with timezone at which the Swap was confirmed by the Customer. type: string format: date-time - created_at: - description: The date with timezone at which the resource was created. - type: string - format: date-time - updated_at: - description: The date with timezone at which the resource was last updated. - type: string - format: date-time canceled_at: description: The date with timezone at which the Swap was canceled. type: string @@ -4571,37 +6693,61 @@ components: no_notification: description: 'If set to true, no notification will be sent related to this swap' type: boolean + example: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white tax_line: title: Tax Line description: Line item that specifies an amount of tax to add to a line item. x-resourceId: tax_line + required: + - rate + - name properties: id: - description: The id of the Tax Line. This value will be prefixed by `tl_`. type: string + description: The tax line's ID + example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 code: description: A code to identify the tax type by type: string + example: tax01 name: description: A human friendly name for the tax type: string + example: Tax Example rate: description: The numeric rate to charge tax by type: number + example: 10 created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white tax_provider: title: Tax Provider description: The tax service used to calculate taxes @@ -4610,50 +6756,96 @@ components: id: description: The id of the tax provider as given by the plugin. type: string + example: manual is_installed: description: >- Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`. type: boolean + default: true tax_rate: title: Tax Rate description: >- A Tax Rate can be used to associate a certain rate to charge on products within a given Region x-resourceId: line_item + required: + - name + - region_id properties: id: - description: The id of the Tax Rate. This value will be prefixed by `txr_`. type: string + description: The tax rate's ID + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR rate: description: The numeric rate to charge type: number + example: 10 code: description: A code to identify the tax type by type: string + example: tax01 name: description: A human friendly name for the tax type: string + example: Tax Example region_id: + type: string description: The id of the Region that the rate belongs to - type: string + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + products: + type: array + description: >- + The products that belong to this tax rate. Available if the relation + `products` is expanded. + items: + type: object + description: A product object. + product_types: + type: array + description: >- + The product types that belong to this tax rate. Available if the + relation `product_types` is expanded. + items: + type: object + description: A product type object. + shipping_options: + type: array + description: >- + The shipping options that belong to this tax rate. Available if the + relation `shipping_options` is expanded. + items: + type: object + description: A shipping option object. + product_count: + description: The count of products + type: integer + example: null + product_type_count: + description: The count of product types + type: integer + example: null + shipping_option_count: + description: The count of shipping options + type: integer + example: null created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time metadata: - description: An optional key-value map with additional information. type: object - refundable: - description: >- - The amount that can be refunded from the given Line Item. Takes - taxes and discounts into consideration. - type: integer + description: An optional key-value map with additional details + example: + car: white tracking_link: title: Tracking Link description: >- @@ -4661,61 +6853,96 @@ components: Fulfillment. Tracking Links can optionally contain a URL that can be visited to see the status of the shipment. x-resourceId: tracking_link + required: + - tracking_number + - fulfillment_id properties: id: - description: >- - The id of the Tracking Link. This value will be prefixed with - `tlink_`. type: string + description: The tracking link's ID + example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 url: description: The URL at which the status of the shipment can be tracked. type: string + format: uri tracking_number: description: The tracking number given by the shipping carrier. type: string + format: RH370168054CN fulfillment_id: + type: string description: The id of the Fulfillment that the Tracking Link references. + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + fulfillment: + description: Available if the relation `fulfillment` is expanded. + $ref: '#/components/schemas/fulfillment' + idempotency_key: type: string + description: >- + Randomly generated key used to continue the completion of a process + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. created_at: - description: The date with timezone at which the resource was created. type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: - description: The date with timezone at which the resource was last updated. type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: - description: The date with timezone at which the resource was deleted. type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: - description: An optional key-value map with additional information. type: object + description: An optional key-value map with additional details + example: + car: white user: title: User description: Represents a User who can manage store settings. x-resourceId: user + required: + - email properties: id: - description: The unique id of the User. This will be prefixed with `usr_` type: string + description: The user's ID + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V email: description: The email of the User type: string + format: email first_name: + description: The first name of the User type: string + example: Levi last_name: - description: The Customer's billing address. - anyOf: - - $ref: '#/components/schemas/address' + description: The last name of the User + type: string + example: Bogan + api_token: + description: An API token associated with the user. + type: string + example: null created_at: type: string + description: The date with timezone at which the resource was created. format: date-time updated_at: type: string + description: The date with timezone at which the resource was updated. format: date-time deleted_at: type: string + description: The date with timezone at which the resource was deleted. format: date-time metadata: type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/OAuth.yaml b/docs/api/store/components/schemas/OAuth.yaml new file mode 100644 index 0000000000..a9afba0974 --- /dev/null +++ b/docs/api/store/components/schemas/OAuth.yaml @@ -0,0 +1,32 @@ +title: OAuth +description: Represent an OAuth app +x-resourceId: OAuth +required: + - id + - display_name + - application_name +properties: + id: + type: string + description: The app's ID + example: example_app + display_name: + type: string + description: The app's display name + example: Example app + application_name: + type: string + description: The app's name + example: example + install_url: + type: string + description: The URL to install the app + format: uri + uninstall_url: + type: string + description: The URL to uninstall the app + format: uri + data: + type: object + description: Any data necessary to the app. + example: {} diff --git a/docs/api/store/components/schemas/address.yaml b/docs/api/store/components/schemas/address.yaml new file mode 100644 index 0000000000..ff413792f1 --- /dev/null +++ b/docs/api/store/components/schemas/address.yaml @@ -0,0 +1,82 @@ +title: Address +description: An address. +x-resourceId: address +properties: + id: + type: string + description: ID of the address + example: addr_01G8ZC9VS1XVE149MGH2J7QSSH + customer_id: + type: string + description: ID of the customer this address belongs to + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: Available if the relation `customer` is expanded. + type: array + items: + type: object + description: A customer object. + company: + type: string + description: Company name + example: Acme + first_name: + type: string + description: First name + example: Arno + last_name: + type: string + description: Last name + example: Willms + address_1: + type: string + description: Address line 1 + example: 14433 Kemmer Court + address_2: + type: string + description: Address line 2 + example: Suite 369 + city: + type: string + description: City + example: South Geoffreyview + country_code: + type: string + description: The 2 character ISO code of the country in lower case + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + example: st + country: + description: A country object. Available if the relation `country` is expanded. + type: object + province: + type: string + description: Province + example: Kentucky + postal_code: + type: string + description: Postal Code + example: 72093 + phone: + type: string + description: Phone Number + example: 16128234334802 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/batch_job.yaml b/docs/api/store/components/schemas/batch_job.yaml new file mode 100644 index 0000000000..dcb63d5f55 --- /dev/null +++ b/docs/api/store/components/schemas/batch_job.yaml @@ -0,0 +1,139 @@ +title: Batch Job +description: A Batch Job. +x-resourceId: batch_job +required: + - type +properties: + id: + type: string + description: The unique identifier for the batch job. + example: batch_01G8T782965PYFG0751G0Z38B4 + type: + type: string + description: The type of batch job. + enum: + - product-import + - product-export + status: + type: string + description: The status of the batch job. + enum: + - created + - pre_processed + - confirmed + - processing + - completed + - canceled + - failed + default: created + created_by: + type: string + description: The unique identifier of the user that created the batch job. + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + created_by_user: + description: A user object. Available if the relation `created_by_user` is expanded. + type: object + context: + type: object + description: >- + The context of the batch job, the type of the batch job determines what + the context should contain. + example: + shape: + prices: + - region: null + currency_code: eur + dynamicImageColumnCount: 4 + dynamicOptionColumnCount: 2 + list_config: + skip: 0 + take: 50 + order: + created_at: DESC + relations: + - variants + - variant.prices + - images + dry_run: + type: boolean + description: Specify if the job must apply the modifications or not. + default: false + result: + type: object + description: The result of the batch job. + properties: + count: + type: number + advancement_count: + type: number + progress: + type: number + errors: + type: object + properties: + message: + type: string + code: + oneOf: + - type: string + - type: number + err: + type: array + stat_descriptors: + type: object + properties: + key: + type: string + name: + type: string + message: + type: string + file_key: + type: string + file_size: + type: number + example: + errors: + - err: [] + code: unknown + message: Method not implemented. + stat_descriptors: + - key: product-export-count + name: Product count to export + message: There will be 8 products exported by this action + pre_processed_at: + type: string + description: The date from which the job has been pre processed. + format: date-time + processing_at: + type: string + description: The date the job is processing at. + format: date-time + confirmed_at: + type: string + description: The date when the confirmation has been done. + format: date-time + completed_at: + type: string + description: The date of the completion. + format: date-time + canceled_at: + type: string + description: The date of the concellation. + format: date-time + failed_at: + type: string + description: The date when the job failed. + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was last updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/store/components/schemas/cart.yaml b/docs/api/store/components/schemas/cart.yaml new file mode 100644 index 0000000000..0881621115 --- /dev/null +++ b/docs/api/store/components/schemas/cart.yaml @@ -0,0 +1,174 @@ +title: Cart +description: Represents a user cart +x-resourceId: cart +properties: + id: + type: string + description: The cart's ID + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + email: + type: string + description: The email associated with the cart + format: email + billing_address_id: + type: string + description: The billing address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: ./address.yaml + shipping_address_id: + type: string + description: The shipping address's ID + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + items: + description: Available if the relation `items` is expanded. + type: array + items: + $ref: ./line_item.yaml + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + discounts: + type: array + description: Available if the relation `discounts` is expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: Available if the relation `gift_cards` is expanded. + items: + type: object + description: A gift card object. + customer_id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + payment_session: + description: The selected payment session in the cart. + $ref: ./payment_session.yaml + payment_sessions: + type: array + description: The payment sessions created on the cart. + items: + $ref: ./payment_session.yaml + payment_id: + type: string + description: The payment's ID if available + example: pay_01G8ZCC5W42ZNY842124G7P5R9 + payment: + description: Available if the relation `payment` is expanded. + $ref: ./payment.yaml + shipping_methods: + type: array + description: The shipping methods added to the cart. + items: + $ref: ./shipping_method.yaml + type: + type: string + description: The cart's type. + enum: + - default + - swap + - draft_order + - payment_link + - claim + default: default + completed_at: + type: string + description: The date with timezone at which the cart was completed. + format: date-time + payment_authorized_at: + type: string + description: The date with timezone at which the payment was authorized. + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in case + of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + context: + type: object + description: The context of the cart which can include info like IP or user agent. + example: + ip: '::1' + user_agent: PostmanRuntime/7.29.2 + sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: >- + The total amount refunded if the order associated with this cart is + returned. + example: 0 + total: + type: integer + description: The total amount of the cart + example: 8200 + subtotal: + type: integer + description: The subtotal of the cart + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 diff --git a/docs/api/store/components/schemas/claim_image.yaml b/docs/api/store/components/schemas/claim_image.yaml new file mode 100644 index 0000000000..5b2d04e74b --- /dev/null +++ b/docs/api/store/components/schemas/claim_image.yaml @@ -0,0 +1,38 @@ +title: Claim Image +description: Represents photo documentation of a claim. +x-resourceId: claim_image +required: + - claim_item_id + - url +properties: + id: + type: string + description: The claim image's ID + example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 + claim_item_id: + type: string + description: The ID of the claim item associated with the image + claim_item: + description: A claim item object. Available if the relation `claim_item` is expanded. + type: object + url: + type: string + description: The URL of the image + format: uri + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/claim_item.yaml b/docs/api/store/components/schemas/claim_item.yaml new file mode 100644 index 0000000000..ccec3c8ebf --- /dev/null +++ b/docs/api/store/components/schemas/claim_item.yaml @@ -0,0 +1,83 @@ +title: Claim Item +description: >- + Represents a claimed item along with information about the reasons for the + claim. +x-resourceId: claim_item +required: + - claim_order_id + - item_id + - variant_id + - reason + - quantity +properties: + id: + type: string + description: The claim item's ID + example: citm_01G8ZH853Y6TFXWPG5EYE81X63 + images: + type: array + description: Available if the relation `images` is expanded. + items: + $ref: ./claim_image.yaml + claim_order_id: + description: The ID of the claim this item is associated with. + type: string + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + item_id: + description: The ID of the line item that the claim item refers to. + type: string + example: item_01G8ZM25TN49YV9EQBE2NC27KC + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + variant_id: + description: The ID of the product variant that is claimed. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: A variant object. Available if the relation `variant` is expanded. + type: object + reason: + description: The reason for the claim + type: string + enum: + - missing_item + - wrong_item + - production_failure + - other + note: + description: An optional note about the claim, for additional information + type: string + example: I don't like it. + quantity: + description: >- + The quantity of the item that is being claimed; must be less than or equal + to the amount purchased in the original order. + type: integer + example: 1 + tags: + description: >- + User defined tags for easy filtering and grouping. Available if the + relation 'tags' is expanded. + type: array + items: + $ref: ./claim_tag.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/claim_order.yaml b/docs/api/store/components/schemas/claim_order.yaml new file mode 100644 index 0000000000..1d26758cec --- /dev/null +++ b/docs/api/store/components/schemas/claim_order.yaml @@ -0,0 +1,121 @@ +title: Claim Order +description: >- + Claim Orders represent a group of faulty or missing items. Each claim order + consists of a subset of items associated with an original order, and can + contain additional information about fulfillments and returns. +x-resourceId: claim_order +required: + - type + - order_id +properties: + id: + type: string + description: The claim's ID + example: claim_01G8ZH853Y6TFXWPG5EYE81X63 + type: + type: string + enum: + - refund + - replace + payment_status: + type: string + description: The status of the claim's payment + enum: + - na + - not_refunded + - refunded + default: na + fulfillment_status: + type: string + enum: + - not_fulfilled + - partially_fulfilled + - fulfilled + - partially_shipped + - shipped + - partially_returned + - returned + - canceled + - requires_action + default: not_fulfilled + claim_items: + description: The items that have been claimed + type: array + items: + $ref: ./claim_item.yaml + additional_items: + description: >- + Refers to the new items to be shipped when the claim order has the type + `replace` + type: array + items: + $ref: ./line_item.yaml + order_id: + description: The ID of the order that the claim comes from. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + return_order: + description: >- + A return object. Holds information about the return if the claim is to be + returned. Available if the relation 'return_order' is expanded + type: object + shipping_address_id: + description: The ID of the address that the new items should be shipped to + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + shipping_methods: + description: The shipping methods that the claim order will be shipped with. + type: array + items: + $ref: ./shipping_method.yaml + fulfillments: + description: The fulfillments of the new items to be shipped + type: array + items: + $ref: ./fulfillment.yaml + refund_amount: + description: The amount that will be refunded in conjunction with the claim + type: integer + example: 1000 + canceled_at: + description: The date with timezone at which the claim was canceled. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white + no_notification: + description: >- + Flag for describing whether or not notifications related to this should be + send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the claim in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. diff --git a/docs/api/store/components/schemas/claim_tag.yaml b/docs/api/store/components/schemas/claim_tag.yaml new file mode 100644 index 0000000000..bf7b96a3db --- /dev/null +++ b/docs/api/store/components/schemas/claim_tag.yaml @@ -0,0 +1,33 @@ +title: Claim Tag +description: >- + Claim Tags are user defined tags that can be assigned to claim items for easy + filtering and grouping. +x-resourceId: claim_tag +required: + - value +properties: + id: + type: string + description: The claim tag's ID + example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 + value: + description: The value that the claim tag holds + type: string + example: Damaged + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/country.yaml b/docs/api/store/components/schemas/country.yaml new file mode 100644 index 0000000000..8bd271c77c --- /dev/null +++ b/docs/api/store/components/schemas/country.yaml @@ -0,0 +1,53 @@ +title: Country +description: Country details +x-resourceId: country +required: + - iso_2 + - iso_3 + - num_code + - name + - display_name +properties: + id: + type: string + description: The country's ID + example: 109 + iso_2: + type: string + description: The 2 character ISO code of the country in lower case + example: it + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + iso_3: + type: string + description: The 2 character ISO code of the country in lower case + example: ita + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements + description: See a list of codes. + num_code: + description: The numerical ISO code for the country. + type: string + example: 380 + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements + description: See a list of codes. + name: + description: The normalized country name in upper case. + type: string + example: ITALY + display_name: + description: The country name appropriate for display. + type: string + example: Italy + region_id: + type: string + description: The region ID this country is associated with. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object diff --git a/docs/api/store/components/schemas/currency.yaml b/docs/api/store/components/schemas/currency.yaml new file mode 100644 index 0000000000..aecf3200e2 --- /dev/null +++ b/docs/api/store/components/schemas/currency.yaml @@ -0,0 +1,28 @@ +title: Currency +description: Currency +x-resourceId: currency +required: + - code + - symbol + - symbol_native + - name +properties: + code: + description: The 3 character ISO code for the currency. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + symbol: + description: The symbol used to indicate the currency. + type: string + example: $ + symbol_native: + description: The native symbol used to indicate the currency. + type: string + example: $ + name: + description: The written name of the currency + type: string + example: US Dollar diff --git a/docs/api/store/components/schemas/custom_shipping_option.yaml b/docs/api/store/components/schemas/custom_shipping_option.yaml new file mode 100644 index 0000000000..488258a5cb --- /dev/null +++ b/docs/api/store/components/schemas/custom_shipping_option.yaml @@ -0,0 +1,53 @@ +title: Custom Shipping Option +description: >- + Custom Shipping Options are 'overriden' Shipping Options. Store managers can + attach a Custom Shipping Option to a cart in order to set a custom price for a + particular Shipping Option +x-resourceId: custom_shipping_option +required: + - price + - shipping_option_id +properties: + id: + type: string + description: The custom shipping option's ID + example: cso_01G8X99XNB77DMFBJFWX6DN9V9 + price: + description: >- + The custom price set that will override the shipping option's original + price + type: integer + example: 1000 + shipping_option_id: + description: The ID of the Shipping Option that the custom shipping option overrides + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: >- + A shipping option object. Available if the relation `shipping_option` is + expanded. + type: object + cart_id: + description: The ID of the Cart that the custom shipping option is attached to + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/customer.yaml b/docs/api/store/components/schemas/customer.yaml new file mode 100644 index 0000000000..e3df6d690b --- /dev/null +++ b/docs/api/store/components/schemas/customer.yaml @@ -0,0 +1,72 @@ +title: Customer +description: Represents a customer +x-resourceId: customer +required: + - email +properties: + id: + type: string + description: The customer's ID + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + email: + type: string + description: The customer's email + format: email + first_name: + type: string + description: The customer's first name + example: Arno + last_name: + type: string + description: The customer's first name + example: Willms + billing_address_id: + type: string + description: The customer's billing address ID + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: ./address.yaml + shipping_addresses: + description: Available if the relation `shipping_addresses` is expanded. + type: array + items: + $ref: ./address.yaml + phone: + type: string + description: The customer's phone number + example: 16128234334802 + has_account: + type: boolean + description: Whether the customer has an account or not + default: false + orders: + description: Available if the relation `orders` is expanded. + type: array + items: + type: object + description: An order object. + groups: + description: >- + The customer groups the customer belongs to. Available if the relation + `groups` is expanded. + type: array + items: + $ref: ./customer_group.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/customer_group.yaml b/docs/api/store/components/schemas/customer_group.yaml new file mode 100644 index 0000000000..d99e3a5923 --- /dev/null +++ b/docs/api/store/components/schemas/customer_group.yaml @@ -0,0 +1,46 @@ +title: Customer Group +description: Represents a customer group +x-resourceId: customer_group +required: + - name +properties: + id: + type: string + description: The customer group's ID + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + name: + type: string + description: The name of the customer group + example: VIP + customers: + type: array + description: >- + The customers that belong to the customer group. Available if the relation + `customers` is expanded. + items: + type: object + description: A customer object. + price_lists: + type: array + description: >- + The price lists that are associated with the customer group. Available if + the relation `price_lists` is expanded. + items: + $ref: ./price_list.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount.yaml b/docs/api/store/components/schemas/discount.yaml new file mode 100644 index 0000000000..48f090532a --- /dev/null +++ b/docs/api/store/components/schemas/discount.yaml @@ -0,0 +1,91 @@ +title: Discount +description: Represents a discount that can be applied to a cart for promotional purposes. +x-resourceId: discount +required: + - code + - is_dynamic +properties: + id: + type: string + description: The discount's ID + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + code: + description: >- + A unique code for the discount - this will be used by the customer to + apply the discount + type: string + example: 10DISC + is_dynamic: + description: >- + A flag to indicate if multiple instances of the discount can be generated. + I.e. for newsletter discounts + type: boolean + example: false + rule_id: + type: string + description: The Discount Rule that governs the behaviour of the Discount + example: dru_01F0YESMVK96HVX7N419E3CJ7C + rule: + description: Available if the relation `rule` is expanded. + $ref: ./discount_rule.yaml + is_disabled: + description: >- + Whether the Discount has been disabled. Disabled discounts cannot be + applied to carts + type: boolean + example: false + parent_discount_id: + type: string + description: >- + The Discount that the discount was created from. This will always be a + dynamic discount + example: disc_01G8ZH853YPY9B94857DY91YGW + parent_discount: + description: Available if the relation `parent_discount` is expanded. + $ref: ./discount.yaml + starts_at: + description: The time at which the discount can be used. + type: string + format: date-time + ends_at: + description: The time at which the discount can no longer be used. + type: string + format: date-time + valid_duration: + type: string + description: Duration the discount runs between + example: P3Y6M4DT12H30M5S + regions: + description: >- + The Regions in which the Discount can be used. Available if the relation + `regions` is expanded. + type: array + items: + type: object + description: A region object. + usage_limit: + description: The maximum number of times that a discount can be used. + type: integer + example: 100 + usage_count: + description: The number of times a discount has been used. + type: integer + example: 50 + default: 0 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_condition.yaml b/docs/api/store/components/schemas/discount_condition.yaml new file mode 100644 index 0000000000..57a0dea0b9 --- /dev/null +++ b/docs/api/store/components/schemas/discount_condition.yaml @@ -0,0 +1,92 @@ +title: Discount Condition +description: Holds rule conditions for when a discount is applicable +x-resourceId: discount_condition +required: + - type + - operator + - discount_rule_id +properties: + id: + type: string + description: The discount condition's ID + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: The type of the Condition + type: string + enum: + - products + - product_types + - product_collections + - product_tags + - customer_groups + operator: + description: The operator of the Condition + type: string + enum: + - in + - not_in + discount_rule_id: + type: string + description: The ID of the discount rule associated with the condition + example: dru_01F0YESMVK96HVX7N419E3CJ7C + discount_rule: + description: Available if the relation `discount_rule` is expanded. + $ref: ./discount_rule.yaml + products: + description: >- + products associated with this condition if type = products. Available if + the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + product_types: + description: >- + product types associated with this condition if type = product_types. + Available if the relation `product_types` is expanded. + type: array + items: + type: object + description: A product type object. + product_tags: + description: >- + product tags associated with this condition if type = product_tags. + Available if the relation `product_tags` is expanded. + type: array + items: + type: object + description: A product tag object. + product_collections: + description: >- + product collections associated with this condition if type = + product_collections. Available if the relation `product_collections` is + expanded. + type: array + items: + type: object + description: A product collection object. + customer_groups: + description: >- + customer groups associated with this condition if type = customer_groups. + Available if the relation `customer_groups` is expanded. + type: array + items: + type: object + description: A customer group object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_condition_customer_group.yaml b/docs/api/store/components/schemas/discount_condition_customer_group.yaml new file mode 100644 index 0000000000..ad6527d260 --- /dev/null +++ b/docs/api/store/components/schemas/discount_condition_customer_group.yaml @@ -0,0 +1,34 @@ +title: Product Tag Discount Condition +description: Associates a discount condition with a customer group +x-resourceId: discount_condition_customer_group +required: + - customer_group_id + - condition_id +properties: + customer_group_id: + description: The ID of the Product Tag + type: string + example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + customer_group: + description: Available if the relation `customer_group` is expanded. + $ref: ./customer_group.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_condition_product.yaml b/docs/api/store/components/schemas/discount_condition_product.yaml new file mode 100644 index 0000000000..77f4fa6b9e --- /dev/null +++ b/docs/api/store/components/schemas/discount_condition_product.yaml @@ -0,0 +1,34 @@ +title: Product Discount Condition +description: Associates a discount condition with a product +x-resourceId: discount_condition_product +required: + - product_id + - condition_id +properties: + product_id: + description: The ID of the Product Tag + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product: + description: Available if the relation `product` is expanded. + $ref: ./product.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_condition_product_collection.yaml b/docs/api/store/components/schemas/discount_condition_product_collection.yaml new file mode 100644 index 0000000000..43c7548e34 --- /dev/null +++ b/docs/api/store/components/schemas/discount_condition_product_collection.yaml @@ -0,0 +1,34 @@ +title: Product Collection Discount Condition +description: Associates a discount condition with a product collection +x-resourceId: discount_condition_product_collection +required: + - product_collection_id + - condition_id +properties: + product_collection_id: + description: The ID of the Product Collection + type: string + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_collection: + description: Available if the relation `product_collection` is expanded. + $ref: ./product_collection.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_condition_product_tag.yaml b/docs/api/store/components/schemas/discount_condition_product_tag.yaml new file mode 100644 index 0000000000..ed3a8b2e79 --- /dev/null +++ b/docs/api/store/components/schemas/discount_condition_product_tag.yaml @@ -0,0 +1,34 @@ +title: Product Tag Discount Condition +description: Associates a discount condition with a product tag +x-resourceId: discount_condition_product_tag +required: + - product_tag_id + - condition_id +properties: + product_tag_id: + description: The ID of the Product Tag + type: string + example: ptag_01F0YESHPZYY3H4SJ3A5918SBN + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_tag: + description: Available if the relation `product_tag` is expanded. + $ref: ./product_tag.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_condition_product_type.yaml b/docs/api/store/components/schemas/discount_condition_product_type.yaml new file mode 100644 index 0000000000..3125b2119c --- /dev/null +++ b/docs/api/store/components/schemas/discount_condition_product_type.yaml @@ -0,0 +1,34 @@ +title: Product Type Discount Condition +description: Associates a discount condition with a product type +x-resourceId: discount_condition_product +required: + - product_type_id + - condition_id +properties: + product_type_id: + description: The ID of the Product Tag + type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + condition_id: + description: The ID of the Discount Condition + type: string + example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: ./product_type.yaml + discount_condition: + description: Available if the relation `discount_condition` is expanded. + $ref: ./discount_condition.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/discount_rule.yaml b/docs/api/store/components/schemas/discount_rule.yaml new file mode 100644 index 0000000000..328171368f --- /dev/null +++ b/docs/api/store/components/schemas/discount_rule.yaml @@ -0,0 +1,66 @@ +title: Discount Rule +description: >- + Holds the rules that governs how a Discount is calculated when applied to a + Cart. +x-resourceId: discount_rule +required: + - type + - value +properties: + id: + type: string + description: The discount rule's ID + example: dru_01F0YESMVK96HVX7N419E3CJ7C + type: + description: >- + The type of the Discount, can be `fixed` for discounts that reduce the + price by a fixed amount, `percentage` for percentage reductions or + `free_shipping` for shipping vouchers. + type: string + enum: + - fixed + - percentage + - free_shipping + example: percentage + description: + description: A short description of the discount + type: string + example: 10 Percent + value: + description: >- + The value that the discount represents; this will depend on the type of + the discount + type: integer + example: 10 + allocation: + description: The scope that the discount should apply to. + type: string + enum: + - total + - item + example: total + conditions: + description: >- + A set of conditions that can be used to limit when the discount can be + used. Available if the relation `conditions` is expanded. + type: array + items: + type: object + description: A discount condition object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/draft-order.yaml b/docs/api/store/components/schemas/draft-order.yaml new file mode 100644 index 0000000000..12152dc3e0 --- /dev/null +++ b/docs/api/store/components/schemas/draft-order.yaml @@ -0,0 +1,71 @@ +title: DraftOrder +description: Represents a draft order +x-resourceId: draft-order +properties: + id: + type: string + description: The draft order's ID + example: dorder_01G8TJFKBG38YYFQ035MSVG03C + status: + type: string + description: The status of the draft order + enum: + - open + - completed + default: open + display_id: + type: string + description: The draft order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the draft order. + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + type: string + description: The ID of the order associated with the draft order. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + canceled_at: + type: string + description: The date the draft order was canceled at. + format: date-time + completed_at: + type: string + description: The date the draft order was completed at. + format: date-time + no_notification_order: + type: boolean + description: Whether to send the customer notifications regarding order updates. + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the cart + associated with the draft order in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/fulfillment.yaml b/docs/api/store/components/schemas/fulfillment.yaml new file mode 100644 index 0000000000..0ea09f97e5 --- /dev/null +++ b/docs/api/store/components/schemas/fulfillment.yaml @@ -0,0 +1,117 @@ +title: Fulfillment +description: >- + Fulfillments are created once store operators can prepare the purchased goods. + Fulfillments will eventually be shipped and hold information about how to + track shipments. Fulfillments are created through a provider, which is + typically an external shipping aggregator, shipping partner og 3PL, most + plugins will have asynchronous communications with these providers through + webhooks in order to automatically update and synchronize the state of + Fulfillments. +x-resourceId: fulfillment +required: + - provider_id +properties: + id: + type: string + description: The cart's ID + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + claim_order_id: + description: The id of the Claim that the Fulfillment belongs to. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Fulfillment belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The id of the Order that the Fulfillment belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + provider_id: + description: >- + The id of the Fulfillment Provider responsible for handling the + fulfillment + type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: ./fulfillment_provider.yaml + items: + description: >- + The Fulfillment Items in the Fulfillment - these hold information about + how many of each Line Item has been fulfilled. Available if the relation + `items` is expanded. + type: array + items: + $ref: ./fulfillment_item.yaml + tracking_links: + description: >- + The Tracking Links that can be used to track the status of the + Fulfillment, these will usually be provided by the Fulfillment Provider. + Available if the relation `tracking_links` is expanded. + type: array + items: + $ref: ./tracking_link.yaml + tracking_numbers: + deprecated: true + description: >- + The tracking numbers that can be used to track the status of the + fulfillment. + type: array + items: + type: string + data: + description: >- + This contains all the data necessary for the Fulfillment provider to + handle the fulfillment. + type: object + example: {} + shipped_at: + description: The date with timezone at which the Fulfillment was shipped. + type: string + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this should be + send. + type: boolean + example: false + canceled_at: + description: The date with timezone at which the Fulfillment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the fulfillment + in case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/fulfillment_item.yaml b/docs/api/store/components/schemas/fulfillment_item.yaml new file mode 100644 index 0000000000..29fe0f87b9 --- /dev/null +++ b/docs/api/store/components/schemas/fulfillment_item.yaml @@ -0,0 +1,28 @@ +title: Fulfillment Item +description: >- + Correlates a Line Item with a Fulfillment, keeping track of the quantity of + the Line Item. +x-resourceId: fulfillment_item +required: + - fulfillment_id + - item_id + - quantity +properties: + fulfillment_id: + description: The id of the Fulfillment that the Fulfillment Item belongs to. + type: string + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + item_id: + description: The id of the Line Item that the Fulfillment Item references. + type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + fulfillment: + description: A fulfillment object. Available if the relation `fulfillment` is expanded. + type: object + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + quantity: + description: The quantity of the Line Item that is included in the Fulfillment. + type: integer + example: 1 diff --git a/docs/api/store/components/schemas/fulfillment_provider.yaml b/docs/api/store/components/schemas/fulfillment_provider.yaml new file mode 100644 index 0000000000..d6fdd8ce64 --- /dev/null +++ b/docs/api/store/components/schemas/fulfillment_provider.yaml @@ -0,0 +1,15 @@ +title: Fulfillment Provider +description: Represents a fulfillment provider plugin and holds its installation status. +x-resourceId: fulfillment_provider +properties: + id: + description: The id of the fulfillment provider as given by the plugin. + type: string + example: manual + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + example: true diff --git a/docs/api/store/components/schemas/gift_card.yaml b/docs/api/store/components/schemas/gift_card.yaml new file mode 100644 index 0000000000..713a2a39fc --- /dev/null +++ b/docs/api/store/components/schemas/gift_card.yaml @@ -0,0 +1,70 @@ +title: Gift Card +description: >- + Gift Cards are redeemable and represent a value that can be used towards the + payment of an Order. +x-resourceId: gift_card +required: + - code + - value + - balance + - region_id +properties: + id: + type: string + description: The cart's ID + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ + code: + description: >- + The unique code that identifies the Gift Card. This is used by the + Customer to redeem the value of the Gift Card. + type: string + example: 3RFT-MH2C-Y4YZ-XMN4 + value: + description: The value that the Gift Card represents. + type: integer + example: 10 + balance: + description: The remaining value on the Gift Card. + type: integer + example: 10 + region_id: + type: string + description: The id of the Region in which the Gift Card is available. + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + order_id: + type: string + description: The id of the Order that the Gift Card was purchased in. + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + is_disabled: + description: >- + Whether the Gift Card has been disabled. Disabled Gift Cards cannot be + applied to carts. + type: boolean + example: false + ends_at: + description: The time at which the Gift Card can no longer be used. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/gift_card_transaction.yaml b/docs/api/store/components/schemas/gift_card_transaction.yaml new file mode 100644 index 0000000000..0d923b3653 --- /dev/null +++ b/docs/api/store/components/schemas/gift_card_transaction.yaml @@ -0,0 +1,43 @@ +title: Gift Card Transaction +description: >- + Gift Card Transactions are created once a Customer uses a Gift Card to pay for + their Order +x-resourceId: gift_card_transaction +required: + - gift_card_id + - amount +properties: + id: + type: string + description: The gift card transaction's ID + example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A + gift_card_id: + description: The ID of the Gift Card that was used in the transaction. + type: string + example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ + gift_card: + description: A gift card object. Available if the relation `gift_card` is expanded. + type: object + order_id: + description: The ID of the Order that the Gift Card was used to pay for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + amount: + description: The amount that was used from the Gift Card. + type: integer + example: 10 + created_at: + description: The date with timezone at which the resource was created. + type: string + format: date-time + is_taxable: + description: Whether the transaction is taxable or not. + type: boolean + example: false + tax_rate: + description: The tax rate of the transaction + type: number + example: 0 diff --git a/docs/api/store/components/schemas/idempotency_key.yaml b/docs/api/store/components/schemas/idempotency_key.yaml new file mode 100644 index 0000000000..ac4f6b63b7 --- /dev/null +++ b/docs/api/store/components/schemas/idempotency_key.yaml @@ -0,0 +1,55 @@ +title: Idempotency Key +description: >- + Idempotency Key is used to continue a process in case of any failure that + might occur. +x-resourceId: idempotency_key +required: + - idempotency_key +properties: + id: + type: string + description: The idempotency key's ID + example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A + idempotency_key: + description: >- + The unique randomly generated key used to determine the state of a + process. + type: string + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + locked_at: + description: Date which the idempotency key was locked. + type: string + format: date-time + request_method: + description: The method of the request + type: string + example: POST + request_params: + type: object + description: The parameters passed to the request + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + request_path: + description: The request's path + type: string + example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + response_code: + type: string + description: The response's code. + example: 200 + response_body: + type: object + description: The response's body + example: + id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + recovery_point: + type: string + description: Where to continue from. + default: started diff --git a/docs/api/store/components/schemas/image.yaml b/docs/api/store/components/schemas/image.yaml new file mode 100644 index 0000000000..24bf973e75 --- /dev/null +++ b/docs/api/store/components/schemas/image.yaml @@ -0,0 +1,31 @@ +title: Image +description: Images holds a reference to a URL at which the image file can be found. +x-resourceId: image +required: + - url +properties: + id: + type: string + description: The image's ID + example: img_01G749BFYR6T8JTVW6SGW3K3E6 + url: + description: The URL at which the image file can be found. + type: string + format: uri + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/invite.yaml b/docs/api/store/components/schemas/invite.yaml new file mode 100644 index 0000000000..492a71eeb2 --- /dev/null +++ b/docs/api/store/components/schemas/invite.yaml @@ -0,0 +1,50 @@ +title: Invite +description: Represents an invite +x-resourceId: invite +required: + - user_email +properties: + id: + type: string + description: The invite's ID + example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 + user_email: + type: string + description: The email of the user being invited. + format: email + role: + type: string + description: The user's role. + enum: + - admin + - member + - developer + default: member + accepted: + type: boolean + description: Whether the invite was accepted or not. + example: false + token: + type: string + description: The token used to accept the invite. + expores_at: + type: string + description: The date the invite expires at. + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/line_item.yaml b/docs/api/store/components/schemas/line_item.yaml new file mode 100644 index 0000000000..d949a50d95 --- /dev/null +++ b/docs/api/store/components/schemas/line_item.yaml @@ -0,0 +1,172 @@ +title: Line Item +description: >- + Line Items represent purchasable units that can be added to a Cart for + checkout. When Line Items are purchased they will get copied to the resulting + order and can eventually be referenced in Fulfillments and Returns. Line Items + may also be created when processing Swaps and Claims. +x-resourceId: line_item +required: + - title + - unit_price + - quantity +properties: + id: + type: string + description: The cart's ID + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + cart_id: + description: The ID of the Cart that the Line Item belongs to. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Line Item belongs to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Line Item belongs to. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Line Item belongs to. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + tax_lines: + description: Available if the relation `tax_lines` is expanded. + type: array + items: + $ref: ./line_item_tax_line.yaml + adjustments: + description: Available if the relation `adjustments` is expanded. + type: array + items: + $ref: ./line_item_adjustment.yaml + title: + description: >- + The title of the Line Item, this should be easily identifiable by the + Customer. + type: string + example: Medusa Coffee Mug + description: + description: A more detailed description of the contents of the Line Item. + type: string + example: One Size + thumbnail: + description: A URL string to a small image of the contents of the Line Item. + type: string + format: uri + example: https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png + is_return: + description: Is the item being returned + type: boolean + example: false + is_giftcard: + description: Flag to indicate if the Line Item is a Gift Card. + type: boolean + example: false + should_merge: + description: >- + Flag to indicate if new Line Items with the same variant should be merged + or added as an additional Line Item. + type: boolean + example: false + allow_discounts: + description: >- + Flag to indicate if the Line Item should be included when doing discount + calculations. + type: boolean + example: false + has_shipping: + description: Flag to indicate if the Line Item has fulfillment associated with it. + type: boolean + example: false + unit_price: + description: >- + The price of one unit of the content in the Line Item. This should be in + the currency defined by the Cart/Order/Swap/Claim that the Line Item + belongs to. + type: boolean + example: 8000 + variant_id: + description: The id of the Product Variant contained in the Line Item. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + A product variant object. The Product Variant contained in the Line Item. + Available if the relation `variant` is expanded. + type: object + quantity: + description: The quantity of the content in the Line Item. + type: integer + example: 1 + fulfilled_quantity: + description: The quantity of the Line Item that has been fulfilled. + type: integer + example: 0 + returned_quantity: + description: The quantity of the Line Item that has been returned. + type: integer + example: 0 + shipped_quantity: + description: The quantity of the Line Item that has been shipped. + type: integer + example: 0 + refundable: + description: >- + The amount that can be refunded from the given Line Item. Takes taxes and + discounts into consideration. + type: integer + example: 0 + subtotal: + type: integer + description: The subtotal of the line item + example: 8000 + tax_total: + type: integer + description: The total of tax of the line item + example: 0 + total: + type: integer + description: The total amount of the line item + example: 8000 + original_total: + type: integer + description: The original total amount of the line item + example: 8000 + original_tax_total: + type: integer + description: The original tax total amount of the line item + example: 0 + discount_total: + type: integer + description: The total of discount of the line item + example: 0 + gift_card_total: + type: integer + description: The total of the gift card of the line item + example: 0 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/line_item_adjustment.yaml b/docs/api/store/components/schemas/line_item_adjustment.yaml new file mode 100644 index 0000000000..8ae889c8dc --- /dev/null +++ b/docs/api/store/components/schemas/line_item_adjustment.yaml @@ -0,0 +1,39 @@ +title: Line Item Adjustment +description: Represents an Line Item Adjustment +x-resourceId: line_item_adjustment +required: + - item_id + - description + - amount +properties: + id: + type: string + description: The invite's ID + example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + description: + type: string + description: The line item's adjustment description + example: Adjusted item's price. + discount_id: + type: string + description: The ID of the discount associated with the adjustment + example: disc_01F0YESMW10MGHWJKZSDDMN0VN + discount: + description: Available if the relation `discount` is expanded. + $ref: ./discount.yaml + amount: + type: number + description: The adjustment amount + example: 1000 + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/line_item_tax_line.yaml b/docs/api/store/components/schemas/line_item_tax_line.yaml new file mode 100644 index 0000000000..9320de67e3 --- /dev/null +++ b/docs/api/store/components/schemas/line_item_tax_line.yaml @@ -0,0 +1,44 @@ +title: Line Item Tax Line +description: Represents an Line Item Tax Line +x-resourceId: line_item_tax_line +required: + - item_id + - rate + - name +properties: + id: + type: string + description: The line item tax line's ID + example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + item_id: + type: string + description: The ID of the line item + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/money_amount.yaml b/docs/api/store/components/schemas/money_amount.yaml new file mode 100644 index 0000000000..f54d7e4a7a --- /dev/null +++ b/docs/api/store/components/schemas/money_amount.yaml @@ -0,0 +1,84 @@ +title: Money Amount +description: >- + Money Amounts represents an amount that a given Product Variant can be + purcased for. Each Money Amount either has a Currency or Region associated + with it to indicate the pricing in a given Currency or, for fully region-based + pricing, the given price in a specific Region. If region-based pricing is used + the amount will be in the currency defined for the Reigon. +x-resourceId: money_amount +required: + - currency_code + - amount +properties: + id: + type: string + description: The money amount's ID + example: ma_01F0YESHRFQNH5S8Q0PK84YYZN + currency_code: + description: The 3 character currency code that the Money Amount is given in. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + amount: + description: >- + The amount in the smallest currecny unit (e.g. cents 100 cents to charge + $1) that the Product Variant will cost. + type: integer + example: 100 + min_quantity: + description: >- + The minimum quantity that the Money Amount applies to. If this value is + not set, the Money Amount applies to all quantities. + type: integer + example: 1 + max_quantity: + description: >- + The maximum quantity that the Money Amount applies to. If this value is + not set, the Money Amount applies to all quantities. + type: integer + example: 1 + price_list_id: + type: string + description: The ID of the price list associated with the money amount + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + price_list: + description: Available if the relation `price_list` is expanded. + $ref: ./price_list.yaml + variant_id: + description: The id of the Product Variant contained in the Line Item. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: >- + The Product Variant contained in the Line Item. Available if the relation + `variant` is expanded. + type: object + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/note.yaml b/docs/api/store/components/schemas/note.yaml new file mode 100644 index 0000000000..9333e49472 --- /dev/null +++ b/docs/api/store/components/schemas/note.yaml @@ -0,0 +1,50 @@ +title: Note +description: >- + Notes are elements which we can use in association with different resources to + allow users to describe additional information in relation to these. +x-resourceId: note +required: + - value + - resource_type + - resource_id +properties: + id: + type: string + description: The note's ID + example: note_01G8TM8ENBMC7R90XRR1G6H26Q + resource_type: + description: The type of resource that the Note refers to. + type: string + example: order + resource_id: + description: The ID of the resource that the Note refers to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + value: + description: The contents of the note. + type: string + example: This order must be fulfilled on Monday + author_id: + type: string + description: The ID of the author (user) + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + author: + description: Available if the relation `author` is expanded. + $ref: ./user.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/notification.yaml b/docs/api/store/components/schemas/notification.yaml new file mode 100644 index 0000000000..559d58d79a --- /dev/null +++ b/docs/api/store/components/schemas/notification.yaml @@ -0,0 +1,67 @@ +title: Notification +description: >- + Notifications a communications sent via Notification Providers as a reaction + to internal events such as `order.placed`. Notifications can be used to show a + chronological timeline for communications sent to a Customer regarding an + Order, and enables resends. +x-resourceId: notification +required: + - resource_type + - resource_id + - to +properties: + id: + type: string + description: The notification's ID + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + event_name: + description: The name of the event that the notification was sent for. + type: string + example: order.placed + resource_type: + description: The type of resource that the Notification refers to. + type: string + example: order + resource_id: + description: The ID of the resource that the Notification refers to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + customer_id: + description: The ID of the Customer that the Notification was sent to. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + to: + description: >- + 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 + type: string + example: user@example.com + data: + description: >- + The data that the Notification was sent with. This contains all the data + necessary for the Notification Provider to initiate a resend. + type: object + example: {} + resends: + description: The resends that have been completed after the original Notification. + type: array + items: + $ref: ./notification_resend.yaml + provider_id: + description: The id of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: ./notification_provider.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time diff --git a/docs/api/store/components/schemas/notification_provider.yaml b/docs/api/store/components/schemas/notification_provider.yaml new file mode 100644 index 0000000000..6ac490109f --- /dev/null +++ b/docs/api/store/components/schemas/notification_provider.yaml @@ -0,0 +1,17 @@ +title: Notification Provider +description: Represents a notification provider plugin and holds its installation status. +x-resourceId: notification_provider +required: + - id +properties: + id: + description: The id of the notification provider as given by the plugin. + type: string + example: sendgrid + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + default: true diff --git a/docs/api/store/components/schemas/notification_resend.yaml b/docs/api/store/components/schemas/notification_resend.yaml new file mode 100644 index 0000000000..c5cfe4431f --- /dev/null +++ b/docs/api/store/components/schemas/notification_resend.yaml @@ -0,0 +1,61 @@ +title: Notification Resend +description: A resend of a Notification. +x-resourceId: notification_resend +properties: + id: + description: The notification resend's ID + type: string + example: noti_01F0YET45G9NHP08Z66CE4QKBS + event_name: + description: The name of the event that the notification was sent for. + type: string + example: order.placed + resource_type: + description: The type of resource that the Notification refers to. + type: string + example: order + resource_id: + description: The ID of the resource that the Notification refers to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + customer_id: + description: The ID of the Customer that the Notification was sent to. + type: string + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + to: + description: >- + 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 + type: string + example: user@example.com + data: + description: >- + The data that the Notification was sent with. This contains all the data + necessary for the Notification Provider to initiate a resend. + type: object + example: {} + parent_id: + description: The ID of the Notification that was originally sent. + type: string + example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + parent_notification: + description: Available if the relation `parent_notification` is expanded. + $ref: ./notification.yaml + provider_id: + description: The ID of the Notification Provider that handles the Notification. + type: string + example: sengrid + provider: + description: Available if the relation `provider` is expanded. + $ref: ./notification_provider.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time diff --git a/docs/api/store/components/schemas/order.yaml b/docs/api/store/components/schemas/order.yaml new file mode 100644 index 0000000000..45e495fab3 --- /dev/null +++ b/docs/api/store/components/schemas/order.yaml @@ -0,0 +1,268 @@ +title: Order +description: Represents an order +x-resourceId: order +required: + - customer_id + - email + - region_id + - currency_code +properties: + id: + type: string + description: The order's ID + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + status: + type: string + description: The order's status + enum: + - pending + - completed + - archived + - canceled + - requires_action + default: pending + fulfillment_status: + type: string + description: The order's fulfillment status + enum: + - not_fulfilled + - partially_fulfilled + - fulfilled + - partially_shipped + - shipped + - partially_returned + - returned + - canceled + - requires_action + default: not_fulfilled + payment_status: + type: string + description: The order's payment status + enum: + - not_paid + - awaiting + - captured + - partially_refunded + - refuneded + - canceled + - requires_action + default: not_paid + display_id: + type: integer + description: The order's display ID + example: 2 + cart_id: + type: string + description: The ID of the cart associated with the order + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + customer_id: + type: string + description: The ID of the customer associated with the order + example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + customer: + description: A customer object. Available if the relation `customer` is expanded. + type: object + email: + description: The email associated with the order + type: string + format: email + billing_address_id: + type: string + description: The ID of the billing address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + billing_address: + description: Available if the relation `billing_address` is expanded. + $ref: ./address.yaml + shipping_address_id: + type: string + description: The ID of the shipping address associated with the order + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + currency_code: + description: The 3 character currency code that is used in the order + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + tax_rate: + description: The order's tax rate + type: number + example: 0 + discounts: + type: array + description: >- + The discounts used in the order. Available if the relation `discounts` is + expanded. + items: + type: object + description: A discount object. + gift_cards: + type: array + description: >- + The gift cards used in the order. Available if the relation `gift_cards` + is expanded. + items: + type: object + description: A gift card object. + shipping_methods: + type: array + description: >- + The shipping methods used in the order. Available if the relation + `shipping_methods` is expanded. + items: + $ref: ./shipping_method.yaml + payments: + type: array + description: >- + The payments used in the order. Available if the relation `payments` is + expanded. + items: + $ref: ./payment.yaml + fulfillments: + type: array + description: >- + The fulfillments used in the order. Available if the relation + `fulfillments` is expanded. + items: + $ref: ./fulfillment.yaml + returns: + type: array + description: >- + The returns associated with the order. Available if the relation `returns` + is expanded. + items: + type: object + description: A return object. + claims: + type: array + description: >- + The claims associated with the order. Available if the relation `claims` + is expanded. + items: + type: object + description: A claim order object. + refunds: + type: array + description: >- + The refunds associated with the order. Available if the relation `refunds` + is expanded. + items: + type: object + description: A refund object. + swaps: + type: array + description: >- + The swaps associated with the order. Available if the relation `swaps` is + expanded. + items: + type: object + description: A swap object. + draft_order_id: + type: string + description: The ID of the draft order this order is associated with. + example: null + draft_order: + description: A draft order object. Available if the relation `draft_order` is expanded. + type: object + items: + type: array + description: >- + The line items that belong to the order. Available if the relation `items` + is expanded. + items: + $ref: ./line_item.yaml + gift_card_transactions: + type: array + description: >- + The gift card transactions used in the order. Available if the relation + `gift_card_transactions` is expanded. + items: + $ref: ./gift_card_transaction.yaml + canceled_at: + type: string + description: The date the order was canceled on. + format: date-time + no_notification: + description: >- + Flag for describing whether or not notifications related to this should be + send. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the processing of the order in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + external_id: + description: The ID of an external order. + type: string + example: null + sales_channel_id: + type: string + description: The ID of the sales channel this order is associated with. + example: null + sales_channel: + description: >- + A sales channel object. Available if the relation `sales_channel` is + expanded. + type: object + shipping_total: + type: integer + description: The total of shipping + example: 1000 + discount_total: + type: integer + description: The total of discount + example: 800 + tax_total: + type: integer + description: The total of tax + example: 0 + refunded_total: + type: integer + description: The total amount refunded if the order is returned. + example: 0 + total: + type: integer + description: The total amount of the order + example: 8200 + subtotal: + type: integer + description: The subtotal of the order + example: 8000 + paid_total: + type: integer + description: The total amount paid + example: 8000 + refundable_amount: + type: integer + description: The amount that can be refunded + example: 8200 + gift_card_total: + type: integer + description: The total of gift cards + example: 0 + gift_card_tax_total: + type: integer + description: The total of gift cards with taxes + example: 0 diff --git a/docs/api/store/components/schemas/payment.yaml b/docs/api/store/components/schemas/payment.yaml new file mode 100644 index 0000000000..92294bd2e6 --- /dev/null +++ b/docs/api/store/components/schemas/payment.yaml @@ -0,0 +1,96 @@ +title: Payment +description: >- + Payments represent an amount authorized with a given payment method, Payments + can be captured, canceled or refunded. +x-resourceId: payment +required: + - amount + - currency_code + - provider_id +properties: + id: + type: string + description: The payment's ID + example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE + swap_id: + description: The ID of the Swap that the Payment is used for. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + order_id: + description: The ID of the Order that the Payment is used for. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + amount: + description: The amount that the Payment has been authorized for. + type: integer + example: 100 + currency_code: + description: The 3 character ISO currency code that the Payment is completed in. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + amount_refunded: + description: >- + The amount of the original Payment amount that has been refunded back to + the Customer. + type: integer + example: 0 + provider_id: + description: The id of the Payment Provider that is responsible for the Payment + type: string + example: manual + data: + description: >- + The data required for the Payment Provider to identify, modify and process + the Payment. Typically this will be an object that holds an id to the + external payment session, but can be an empty object if the Payment + Provider doesn't hold any state. + type: object + example: {} + captured_at: + description: The date with timezone at which the Payment was captured. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Payment was canceled. + type: string + format: date-time + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a payment in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/payment_provider.yaml b/docs/api/store/components/schemas/payment_provider.yaml new file mode 100644 index 0000000000..7f39ed6355 --- /dev/null +++ b/docs/api/store/components/schemas/payment_provider.yaml @@ -0,0 +1,17 @@ +title: Payment Provider +description: Represents a Payment Provider plugin and holds its installation status. +x-resourceId: payment_provider +required: + - id +properties: + id: + description: The id of the payment provider as given by the plugin. + type: string + example: manual + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + default: true diff --git a/docs/api/store/components/schemas/payment_session.yaml b/docs/api/store/components/schemas/payment_session.yaml new file mode 100644 index 0000000000..c9f52a749b --- /dev/null +++ b/docs/api/store/components/schemas/payment_session.yaml @@ -0,0 +1,74 @@ +title: Payment Session +description: >- + Payment Sessions are created when a Customer initilizes the checkout flow, and + can be used to hold the state of a payment flow. Each Payment Session is + controlled by a Payment Provider, who is responsible for the communication + with external payment services. Authorized Payment Sessions will eventually + get promoted to Payments to indicate that they are authorized for + capture/refunds/etc. +x-resourceId: payment_session +required: + - cart_id + - provider_id + - status +properties: + id: + type: string + description: The payment session's ID + example: ps_01G901XNSRM2YS3ASN9H5KG3FZ + cart_id: + description: The id of the Cart that the Payment Session is created for. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + provider_id: + description: The id of the Payment Provider that is responsible for the Payment Session + type: string + example: manual + is_selected: + description: >- + A flag to indicate if the Payment Session has been selected as the method + that will be used to complete the purchase. + type: boolean + example: true + status: + description: >- + Indicates the status of the Payment Session. Will default to `pending`, + and will eventually become `authorized`. Payment Sessions may have the + status of `requires_more` to indicate that further actions are to be + completed by the Customer. + type: string + enum: + - authorized + - pending + - requires_more + - error + - canceled + example: pending + data: + description: >- + The data required for the Payment Provider to identify, modify and process + the Payment Session. Typically this will be an object that holds an id to + the external payment session, but can be an empty object if the Payment + Provider doesn't hold any state. + type: object + example: {} + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a cart in case + of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time diff --git a/docs/api/store/components/schemas/price_list.yaml b/docs/api/store/components/schemas/price_list.yaml new file mode 100644 index 0000000000..a39b820583 --- /dev/null +++ b/docs/api/store/components/schemas/price_list.yaml @@ -0,0 +1,70 @@ +title: Price List +description: >- + Price Lists represents a set of prices that overrides the default price for + one or more product variants. +x-resourceId: price_list +required: + - name + - description +properties: + id: + type: string + description: The price list's ID + example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + name: + type: string + description: The price list's name + example: VIP Prices + description: + type: string + description: The price list's description + example: Prices for VIP customers + type: + description: The type of Price List. This can be one of either `sale` or `override`. + type: string + enum: + - sale + - override + default: sale + status: + description: The status of the Price List + type: string + enum: + - active + - draft + default: draft + starts_at: + description: The date with timezone that the Price List starts being valid. + type: string + format: date-time + ends_at: + description: The date with timezone that the Price List stops being valid. + type: string + format: date-time + customer_groups: + description: >- + The Customer Groups that the Price List applies to. Available if the + relation `customer_groups` is expanded. + type: array + items: + type: object + description: A customer group object. + prices: + description: >- + The Money Amounts that are associated with the Price List. Available if + the relation `prices` is expanded. + type: array + items: + $ref: ./money_amount.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/store/components/schemas/product.yaml b/docs/api/store/components/schemas/product.yaml new file mode 100644 index 0000000000..41bf53f444 --- /dev/null +++ b/docs/api/store/components/schemas/product.yaml @@ -0,0 +1,188 @@ +title: Product +description: >- + Products are a grouping of Product Variants that have common properties such + as images and descriptions. Products can have multiple options which define + the properties that Product Variants differ by. +x-resourceId: product +required: + - title + - profile_id +properties: + id: + type: string + description: The product's ID + example: prod_01G1G5V2MBA328390B5AXJ610F + title: + description: A title that can be displayed for easy identification of the Product. + type: string + example: Medusa Coffee Mug + subtitle: + description: An optional subtitle that can be used to further specify the Product. + type: string + description: + description: A short description of the Product. + type: string + example: Every programmer's best friend. + handle: + description: A unique identifier for the Product (e.g. for slug structure). + type: string + example: coffee-mug + is_giftcard: + description: >- + Whether the Product represents a Gift Card. Products that represent Gift + Cards will automatically generate a redeemable Gift Card code once they + are purchased. + type: boolean + default: false + status: + description: The status of the product + type: string + enum: + - draft + - proposed + - published + - rejected + default: draft + images: + description: Images of the Product. Available if the relation `images` is expanded. + type: array + items: + $ref: ./image.yaml + thumbnail: + description: A URL to an image file that can be used to identify the Product. + type: string + format: uri + options: + description: >- + The Product Options that are defined for the Product. Product Variants of + the Product will have a unique combination of Product Option Values. + Available if the relation `options` is expanded. + type: array + items: + $ref: ./product_option.yaml + variants: + description: >- + The Product Variants that belong to the Product. Each will have a unique + combination of Product Option Values. Available if the relation `variants` + is expanded. + type: array + items: + $ref: ./product_variant.yaml + profile_id: + description: >- + The ID of the Shipping Profile that the Product belongs to. Shipping + Profiles have a set of defined Shipping Options that can be used to + Fulfill a given set of Products. + type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: ./shipping_profile.yaml + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + hs_code: + description: >- + The Harmonized System code of the Product Variant. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + origin_country: + description: >- + The country in which the Product Variant was produced. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + mid_code: + description: >- + The Manufacturers Identification code that identifies the manufacturer of + the Product Variant. May be used by Fulfillment Providers to pass customs + information to shipping carriers. + type: string + example: null + material: + description: >- + The material and composition that the Product Variant is made of, May be + used by Fulfillment Providers to pass customs information to shipping + carriers. + type: string + example: null + collection_id: + type: string + description: The Product Collection that the Product belongs to + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + collection: + description: >- + A product collection object. Available if the relation `collection` is + expanded. + type: object + type_id: + type: string + description: The Product type that the Product belongs to + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + type: + description: Available if the relation `type` is expanded. + $ref: ./product_type.yaml + tags: + description: >- + The Product Tags assigned to the Product. Available if the relation `tags` + is expanded. + type: array + items: + $ref: ./product_tag.yaml + discountable: + description: >- + Whether the Product can be discounted. Discounts will not apply to Line + Items of this Product when this flag is set to `false`. + type: boolean + default: true + external_id: + description: The external ID of the product + type: string + example: null + sales_channels: + description: >- + The sales channels the product is associated with. Available if the + relation `sales_channels` is expanded. + type: array + items: + type: object + description: A sales channel object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_collection.yaml b/docs/api/store/components/schemas/product_collection.yaml new file mode 100644 index 0000000000..711acc6c10 --- /dev/null +++ b/docs/api/store/components/schemas/product_collection.yaml @@ -0,0 +1,45 @@ +title: Product Collection +description: Product Collections represents a group of Products that are related. +x-resourceId: product_collection +required: + - title +properties: + id: + type: string + description: The product collection's ID + example: pcol_01F0YESBFAZ0DV6V831JXWH0BG + title: + description: The title that the Product Collection is identified by. + type: string + example: Summer Collection + handle: + description: >- + A unique string that identifies the Product Collection - can for example + be used in slug structures. + type: string + example: summer-collection + products: + description: >- + The Products contained in the Product Collection. Available if the + relation `products` is expanded. + type: array + items: + type: object + description: A product collection object. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_option.yaml b/docs/api/store/components/schemas/product_option.yaml new file mode 100644 index 0000000000..66fd46f4fd --- /dev/null +++ b/docs/api/store/components/schemas/product_option.yaml @@ -0,0 +1,49 @@ +title: Product Option +description: >- + Product Options define properties that may vary between different variants of + a Product. Common Product Options are "Size" and "Color", but Medusa doesn't + limit what Product Options that can be defined. +x-resourceId: product_option +required: + - title + - product_id +properties: + id: + type: string + description: The product option's ID + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + title: + description: The title that the Product Option is defined by (e.g. "Size"). + type: string + example: Size + values: + description: >- + The Product Option Values that are defined for the Product Option. + Available if the relation `values` is expanded. + type: array + items: + $ref: ./product_option_value.yaml + product_id: + description: The ID of the Product that the Product Option is defined for. + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_option_value.yaml b/docs/api/store/components/schemas/product_option_value.yaml new file mode 100644 index 0000000000..3b8606ea53 --- /dev/null +++ b/docs/api/store/components/schemas/product_option_value.yaml @@ -0,0 +1,54 @@ +title: Product Option Value +description: >- + A value given to a Product Variant's option set. Product Variant have a + Product Option Value for each of the Product Options defined on the Product. +x-resourceId: product_option_value +required: + - value + - option_id + - variant_id +properties: + id: + type: string + description: The product option value's ID + example: optval_01F0YESHR7S6ECD03RF6W12DSJ + value: + description: >- + The value that the Product Variant has defined for the specific Product + Option (e.g. if the Product Option is "Size" this value could be "Small", + "Medium" or "Large"). + type: string + example: large + option_id: + description: The ID of the Product Option that the Product Option Value is defined for. + type: string + example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + option: + description: Available if the relation `option` is expanded. + $ref: ./product_option.yaml + variant_id: + description: >- + The ID of the Product Variant that the Product Option Value is defined + for. + type: string + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + variant: + description: Available if the relation `variant` is expanded. + $ref: ./product_variant.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_tag.yaml b/docs/api/store/components/schemas/product_tag.yaml new file mode 100644 index 0000000000..cdfa21d4ad --- /dev/null +++ b/docs/api/store/components/schemas/product_tag.yaml @@ -0,0 +1,31 @@ +title: Product Tag +description: Product Tags can be added to Products for easy filtering and grouping. +x-resourceId: product_tag +required: + - value +properties: + id: + type: string + description: The product tag's ID + example: ptag_01G8K2MTMG9168F2B70S1TAVK3 + value: + description: The value that the Product Tag represents + type: string + example: Pants + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_tax_rate.yaml b/docs/api/store/components/schemas/product_tax_rate.yaml new file mode 100644 index 0000000000..f72e8896a8 --- /dev/null +++ b/docs/api/store/components/schemas/product_tax_rate.yaml @@ -0,0 +1,36 @@ +title: Product Tax Rate +description: >- + Associates a tax rate with a product to indicate that the product is taxed in + a certain way +x-resourceId: product_tax_rate +required: + - product_id + - rate_id +properties: + product_id: + description: The ID of the Product + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: Available if the relation `product` is expanded. + $ref: ./product.yaml + rate_id: + description: The ID of the Tax Rate + type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: ./tax_rate.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_type.yaml b/docs/api/store/components/schemas/product_type.yaml new file mode 100644 index 0000000000..e2be2bf920 --- /dev/null +++ b/docs/api/store/components/schemas/product_type.yaml @@ -0,0 +1,31 @@ +title: Product Type +description: Product Type can be added to Products for filtering and reporting purposes. +x-resourceId: product_type +required: + - value +properties: + id: + type: string + description: The product type's ID + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + value: + description: The value that the Product Type represents. + type: string + example: Clothing + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_type_tax_rate.yaml b/docs/api/store/components/schemas/product_type_tax_rate.yaml new file mode 100644 index 0000000000..5bc7d5c302 --- /dev/null +++ b/docs/api/store/components/schemas/product_type_tax_rate.yaml @@ -0,0 +1,36 @@ +title: Product Type Tax Rate +description: >- + Associates a tax rate with a product type to indicate that the product type is + taxed in a certain way +x-resourceId: product_type_tax_rate +required: + - product_type_id + - rate_id +properties: + product_type_id: + description: The ID of the Product type + type: string + example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + product_type: + description: Available if the relation `product_type` is expanded. + $ref: ./product_type.yaml + rate_id: + description: The id of the Tax Rate + type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: ./tax_rate.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/product_variant.yaml b/docs/api/store/components/schemas/product_variant.yaml new file mode 100644 index 0000000000..aa7386d615 --- /dev/null +++ b/docs/api/store/components/schemas/product_variant.yaml @@ -0,0 +1,149 @@ +title: Product Variant +description: >- + Product Variants represent a Product with a specific set of Product Option + configurations. The maximum number of Product Variants that a Product can have + is given by the number of available Product Option combinations. +x-resourceId: product_variant +required: + - title + - product_id + - inventory_quantity +properties: + id: + type: string + description: The product variant's ID + example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + title: + description: >- + A title that can be displayed for easy identification of the Product + Variant. + type: string + example: Small + product_id: + description: The ID of the Product that the Product Variant belongs to. + type: string + example: prod_01G1G5V2MBA328390B5AXJ610F + product: + description: A product object. Available if the relation `product` is expanded. + type: object + prices: + description: >- + The Money Amounts defined for the Product Variant. Each Money Amount + represents a price in a given currency or a price in a specific Region. + Available if the relation `prices` is expanded. + type: array + items: + $ref: ./money_amount.yaml + sku: + description: >- + The unique stock keeping unit used to identify the Product Variant. This + will usually be a unqiue identifer for the item that is to be shipped, and + can be referenced across multiple systems. + type: string + example: shirt-123 + barcode: + description: >- + A generic field for a GTIN number that can be used to identify the Product + Variant. + type: string + example: null + ean: + description: An EAN barcode number that can be used to identify the Product Variant. + type: string + example: null + upc: + description: A UPC barcode number that can be used to identify the Product Variant. + type: string + example: null + variant_rank: + description: The ranking of this variant + type: number + default: 0 + inventory_quantity: + description: The current quantity of the item that is stocked. + type: integer + example: 100 + allow_backorder: + description: >- + Whether the Product Variant should be purchasable when + `inventory_quantity` is 0. + type: boolean + default: false + manage_inventory: + description: Whether Medusa should manage inventory for the Product Variant. + type: boolean + default: true + hs_code: + description: >- + The Harmonized System code of the Product Variant. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + origin_country: + description: >- + The country in which the Product Variant was produced. May be used by + Fulfillment Providers to pass customs information to shipping carriers. + type: string + example: null + mid_code: + description: >- + The Manufacturers Identification code that identifies the manufacturer of + the Product Variant. May be used by Fulfillment Providers to pass customs + information to shipping carriers. + type: string + example: null + material: + description: >- + The material and composition that the Product Variant is made of, May be + used by Fulfillment Providers to pass customs information to shipping + carriers. + type: string + example: null + weight: + description: >- + The weight of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + height: + description: >- + The height of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + width: + description: >- + The width of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + length: + description: >- + The length of the Product Variant. May be used in shipping rate + calculations. + type: number + example: null + options: + description: >- + The Product Option Values specified for the Product Variant. Available if + the relation `options` is expanded. + type: array + items: + $ref: ./product_option_value.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/refund.yaml b/docs/api/store/components/schemas/refund.yaml new file mode 100644 index 0000000000..c1fc4cfc0f --- /dev/null +++ b/docs/api/store/components/schemas/refund.yaml @@ -0,0 +1,64 @@ +title: Refund +description: >- + Refund represent an amount of money transfered back to the Customer for a + given reason. Refunds may occur in relation to Returns, Swaps and Claims, but + can also be initiated by a store operator. +x-resourceId: refund +required: + - order_id + - amount +properties: + id: + type: string + description: The refund's ID + example: ref_01G1G5V27GYX4QXNARRQCW1N8T + order_id: + description: The id of the Order that the Refund is related to. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + amount: + description: The amount that has be refunded to the Customer. + type: integer + example: 1000 + note: + description: An optional note explaining why the amount was refunded. + type: string + example: I didn't like it + reason: + description: >- + The reason given for the Refund, will automatically be set when processed + as part of a Swap, Claim or Return. + type: string + enum: + - discount + - return + - swap + - claim + - other + example: return + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the refund in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/region.yaml b/docs/api/store/components/schemas/region.yaml new file mode 100644 index 0000000000..877489af02 --- /dev/null +++ b/docs/api/store/components/schemas/region.yaml @@ -0,0 +1,102 @@ +title: Region +description: >- + Regions hold settings for how Customers in a given geographical location shop. + The is, for example, where currencies and tax rates are defined. A Region can + consist of multiple countries to accomodate common shopping settings across + countries. +x-resourceId: region +required: + - name + - currency_code + - tax_rate +properties: + id: + type: string + description: The cart's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + name: + description: >- + The name of the region as displayed to the customer. If the Region only + has one country it is recommended to write the country name. + type: string + example: EU + currency_code: + description: The 3 character currency code that the Region uses. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + currency: + description: Available if the relation `currency` is expanded. + $ref: ./currency.yaml + tax_rate: + description: The tax rate that should be charged on purchases in the Region. + type: number + example: 0 + tax_rates: + description: >- + The tax rates that are included in the Region. Available if the relation + `tax_rates` is expanded. + type: array + items: + $ref: ./tax_rate.yaml + tax_code: + description: >- + The tax code used on purchases in the Region. This may be used by other + systems for accounting purposes. + type: string + example: null + gift_cards_taxable: + description: Whether the gift cards are taxable or not in this region. + type: boolean + default: true + automatic_taxes: + description: Whether taxes should be automated in this region. + type: boolean + default: true + countries: + description: >- + The countries that are included in the Region. Available if the relation + `countries` is expanded. + type: array + items: + $ref: ./country.yaml + tax_provider_id: + type: string + description: The ID of the tax provider used in this region + example: null + tax_provider: + description: Available if the relation `tax_provider` is expanded. + $ref: ./tax_provider.yaml + payment_providers: + description: >- + The Payment Providers that can be used to process Payments in the Region. + Available if the relation `payment_providers` is expanded. + type: array + items: + $ref: ./payment_provider.yaml + fulfillment_providers: + description: >- + The Fulfillment Providers that can be used to fulfill orders in the + Region. Available if the relation `payment_providers` is expanded. + type: array + items: + $ref: ./fulfillment_provider.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/return.yaml b/docs/api/store/components/schemas/return.yaml new file mode 100644 index 0000000000..a475900106 --- /dev/null +++ b/docs/api/store/components/schemas/return.yaml @@ -0,0 +1,98 @@ +title: Return +description: >- + Return orders hold information about Line Items that a Customer wishes to send + back, along with how the items will be returned. Returns can be used as part + of a Swap. +x-resourceId: return +required: + - refund_amount +properties: + id: + type: string + description: The return's ID + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + status: + description: Status of the Return. + type: string + enum: + - requested + - received + - requires_action + - canceled + default: requested + items: + description: >- + The Return Items that will be shipped back to the warehouse. Available if + the relation `items` is expanded. + type: array + items: + $ref: ./return_item.yaml + swap_id: + description: The ID of the Swap that the Return is a part of. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + order_id: + description: The ID of the Order that the Return is made from. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + claim_order_id: + description: The ID of the Claim that the Return is a part of. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + shipping_method: + description: >- + The Shipping Method that will be used to send the Return back. Can be null + if the Customer facilitates the return shipment themselves. Available if + the relation `shipping_method` is expanded. + type: array + items: + $ref: ./shipping_method.yaml + shipping_data: + description: >- + Data about the return shipment as provided by the Fulfilment Provider that + handles the return shipment. + type: object + example: {} + refund_amount: + description: The amount that should be refunded as a result of the return. + type: integer + example: 1000 + no_notification: + description: When set to true, no notification will be sent related to this return. + type: boolean + example: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the return in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + received_at: + description: The date with timezone at which the return was received. + type: string + format: date-time + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/return_item.yaml b/docs/api/store/components/schemas/return_item.yaml new file mode 100644 index 0000000000..3c45a35003 --- /dev/null +++ b/docs/api/store/components/schemas/return_item.yaml @@ -0,0 +1,57 @@ +title: Return Item +description: >- + Correlates a Line Item with a Return, keeping track of the quantity of the + Line Item that will be returned. +x-resourceId: return_item +required: + - return_id + - item_id +properties: + return_id: + description: The id of the Return that the Return Item belongs to. + type: string + example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + return_order: + description: Available if the relation `return_order` is expanded. + $ref: ./return.yaml + item_id: + description: The id of the Line Item that the Return Item references. + type: string + example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + item: + description: Available if the relation `item` is expanded. + $ref: ./line_item.yaml + quantity: + description: The quantity of the Line Item that is included in the Return. + type: integer + example: 1 + is_requested: + description: >- + Whether the Return Item was requested initially or received unexpectedly + in the warehouse. + type: boolean + default: true + requested_quantity: + description: The quantity that was originally requested to be returned. + type: integer + example: 1 + recieved_quantity: + description: The quantity that was received in the warehouse. + type: integer + example: 1 + reason_id: + description: The ID of the reason for returning the item. + type: string + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + reason: + description: Available if the relation `reason` is expanded. + $ref: ./return_reason.yaml + note: + description: An optional note with additional details about the Return. + type: string + example: I didn't like it. + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/return_reason.yaml b/docs/api/store/components/schemas/return_reason.yaml new file mode 100644 index 0000000000..7873cfc3f2 --- /dev/null +++ b/docs/api/store/components/schemas/return_reason.yaml @@ -0,0 +1,52 @@ +title: Return Reason +description: >- + A Reason for why a given product is returned. A Return Reason can be used on + Return Items in order to indicate why a Line Item was returned. +x-resourceId: return_reason +required: + - value + - label +properties: + id: + type: string + description: The cart's ID + example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ + description: + description: A description of the Reason. + type: string + example: Items that are damaged + label: + description: A text that can be displayed to the Customer as a reason. + type: string + example: Damaged goods + value: + description: The value to identify the reason by. + type: string + example: damaged + parent_return_reason_id: + type: string + description: The ID of the parent reason. + example: null + parent_return_reason: + description: Available if the relation `parent_return_reason` is expanded. + $ref: ./return_reason.yaml + return_reason_children: + description: Available if the relation `return_reason_children` is expanded. + $ref: ./return_reason.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/sales_channel.yaml b/docs/api/store/components/schemas/sales_channel.yaml new file mode 100644 index 0000000000..0523299105 --- /dev/null +++ b/docs/api/store/components/schemas/sales_channel.yaml @@ -0,0 +1,34 @@ +title: Sales Channel +description: A Sales Channel +x-resourceId: sales_channel +required: + - name +properties: + id: + type: string + description: The sales channel's ID + example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + name: + description: The name of the sales channel. + type: string + example: Market + description: + description: The description of the sales channel. + type: string + example: Multi-vendor market + is_disabled: + description: Specify if the sales channel is enabled or disabled. + type: boolean + default: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/store/components/schemas/sales_channel_tax_line.yaml b/docs/api/store/components/schemas/sales_channel_tax_line.yaml new file mode 100644 index 0000000000..8aac42859c --- /dev/null +++ b/docs/api/store/components/schemas/sales_channel_tax_line.yaml @@ -0,0 +1,44 @@ +title: Sales Channel +description: A Sales Channel +x-resourceId: sales_channel_tax_line +required: + - shipping_method_id + - rate + - name +properties: + id: + type: string + description: The line item tax line's ID + example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + shipping_method_id: + type: string + description: The ID of the line item + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_method: + description: Available if the relation `shipping_method` is expanded. + $ref: ./shipping_method.yaml + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/shipping_method.yaml b/docs/api/store/components/schemas/shipping_method.yaml new file mode 100644 index 0000000000..d53bafb241 --- /dev/null +++ b/docs/api/store/components/schemas/shipping_method.yaml @@ -0,0 +1,76 @@ +title: Shipping Method +description: >- + Shipping Methods represent a way in which an Order or Return can be shipped. + Shipping Methods are built from a Shipping Option, but may contain additional + details, that can be necessary for the Fulfillment Provider to handle the + shipment. +x-resourceId: shipping_method +required: + - shipping_option_id + - price +properties: + id: + type: string + description: The shipping method's ID + example: sm_01F0YET7DR2E7CYVSDHM593QG2 + shipping_option_id: + description: The id of the Shipping Option that the Shipping Method is built from. + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: ./shipping_option.yaml + order_id: + description: The id of the Order that the Shipping Method is used on. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + return_id: + description: The id of the Return that the Shipping Method is used on. + type: string + example: null + return_order: + description: A return object. Available if the relation `return_order` is expanded. + type: object + swap_id: + description: The id of the Swap that the Shipping Method is used on. + type: string + example: null + swap: + description: A swap object. Available if the relation `swap` is expanded. + type: object + cart_id: + description: The id of the Cart that the Shipping Method is used on. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + claim_order_id: + description: The id of the Claim that the Shipping Method is used on. + type: string + example: null + claim_order: + description: A claim order object. Available if the relation `claim_order` is expanded. + type: object + tax_lines: + type: array + description: Available if the relation `tax_lines` is expanded. + items: + $ref: ./tax_line.yaml + price: + description: >- + The amount to charge for the Shipping Method. The currency of the price is + defined by the Region that the Order that the Shipping Method belongs to + is a part of. + type: integer + example: 200 + data: + description: >- + Additional data that the Fulfillment Provider needs to fulfill the + shipment. This is used in combination with the Shipping Options data, and + may contain information such as a drop point id. + type: object + example: {} diff --git a/docs/api/store/components/schemas/shipping_option.yaml b/docs/api/store/components/schemas/shipping_option.yaml new file mode 100644 index 0000000000..61f298af6f --- /dev/null +++ b/docs/api/store/components/schemas/shipping_option.yaml @@ -0,0 +1,103 @@ +title: Shipping Option +description: >- + Shipping Options represent a way in which an Order or Return can be shipped. + Shipping Options have an associated Fulfillment Provider that will be used + when the fulfillment of an Order is initiated. Shipping Options themselves + cannot be added to Carts, but serve as a template for Shipping Methods. This + distinction makes it possible to customize individual Shipping Methods with + additional information. +x-resourceId: shipping_option +required: + - name + - region_id + - profile_id + - provider_id + - price_type +properties: + id: + type: string + description: The shipping option's ID + example: so_01G1G5V27GYX4QXNARRQCW1N8T + name: + description: >- + The name given to the Shipping Option - this may be displayed to the + Customer. + type: string + example: PostFake Standard + region_id: + type: string + description: The region's ID + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + profile_id: + description: >- + The ID of the Shipping Profile that the shipping option belongs to. + Shipping Profiles have a set of defined Shipping Options that can be used + to Fulfill a given set of Products. + type: string + example: sp_01G1G5V239ENSZ5MV4JAR737BM + profile: + description: Available if the relation `profile` is expanded. + $ref: ./shipping_profile.yaml + provider_id: + description: >- + The id of the Fulfillment Provider, that will be used to process + Fulfillments from the Shipping Option. + type: string + example: manual + provider: + description: Available if the relation `provider` is expanded. + $ref: ./fulfillment_provider.yaml + price_type: + description: >- + The type of pricing calculation that is used when creatin Shipping Methods + from the Shipping Option. Can be `flat_rate` for fixed prices or + `calculated` if the Fulfillment Provider can provide price calulations. + type: string + enum: + - flat_rate + - calculated + example: flat_rate + amount: + description: >- + The amount to charge for shipping when the Shipping Option price type is + `flat_rate`. + type: integer + example: 200 + is_return: + description: Flag to indicate if the Shipping Option can be used for Return shipments. + type: boolean + default: false + requirements: + description: >- + The requirements that must be satisfied for the Shipping Option to be + available for a Cart. Available if the relation `requirements` is + expanded. + type: array + items: + $ref: ./shipping_option_requirement.yaml + data: + description: >- + The data needed for the Fulfillment Provider to identify the Shipping + Option. + type: object + example: {} + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/shipping_option_requirement.yaml b/docs/api/store/components/schemas/shipping_option_requirement.yaml new file mode 100644 index 0000000000..559d21de44 --- /dev/null +++ b/docs/api/store/components/schemas/shipping_option_requirement.yaml @@ -0,0 +1,43 @@ +title: Shipping Option Requirement +description: >- + A requirement that a Cart must satisfy for the Shipping Option to be available + to the Cart. +x-resourceId: shipping_option_requirement +required: + - shipping_option_id + - type + - amount +properties: + id: + type: string + description: The shipping option requirement's ID + example: sor_01G1G5V29AB4CTNDRFSRWSRKWD + shipping_option_id: + description: >- + The id of the Shipping Option that the hipping option requirement belongs + to + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: ./shipping_option.yaml + type: + description: >- + The type of the requirement, this defines how the value will be compared + to the Cart's total. `min_subtotal` requirements define the minimum + subtotal that is needed for the Shipping Option to be available, while the + `max_subtotal` defines the maximum subtotal that the Cart can have for the + Shipping Option to be available. + type: string + enum: + - min_subtotal + - max_subtotal + example: min_subtotal + amount: + description: The amount to compare the Cart subtotal to. + type: integer + example: 100 + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time diff --git a/docs/api/store/components/schemas/shipping_profile.yaml b/docs/api/store/components/schemas/shipping_profile.yaml new file mode 100644 index 0000000000..cb55e4f134 --- /dev/null +++ b/docs/api/store/components/schemas/shipping_profile.yaml @@ -0,0 +1,62 @@ +title: Shipping Profile +description: >- + Shipping Profiles have a set of defined Shipping Options that can be used to + fulfill a given set of Products. +x-resourceId: shipping_profile +required: + - name + - type +properties: + id: + type: string + description: The shipping profile's ID + example: sp_01G1G5V239ENSZ5MV4JAR737BM + name: + description: >- + The name given to the Shipping profile - this may be displayed to the + Customer. + type: string + example: Default Shipping Profile + type: + description: >- + The type of the Shipping Profile, may be `default`, `gift_card` or + `custom`. + type: string + enum: + - default + - gift_card + - custom + example: default + products: + description: >- + The Products that the Shipping Profile defines Shipping Options for. + Available if the relation `products` is expanded. + type: array + items: + type: object + description: A product object. + shipping_options: + description: >- + The Shipping Options that can be used to fulfill the Products in the + Shipping Profile. Available if the relation `shipping_options` is + expanded. + type: array + items: + $ref: ./shipping_option.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/shipping_tax_rate.yaml b/docs/api/store/components/schemas/shipping_tax_rate.yaml new file mode 100644 index 0000000000..ddf13f172a --- /dev/null +++ b/docs/api/store/components/schemas/shipping_tax_rate.yaml @@ -0,0 +1,36 @@ +title: Shipping Tax Rate +description: >- + Associates a tax rate with a shipping option to indicate that the shipping + option is taxed in a certain way +x-resourceId: shipping_tax_rate +required: + - shipping_option_id + - rate_id +properties: + shipping_option_id: + description: The ID of the Shipping Option + type: string + example: so_01G1G5V27GYX4QXNARRQCW1N8T + shipping_option: + description: Available if the relation `shipping_option` is expanded. + $ref: ./shipping_option.yaml + rate_id: + description: The ID of the Tax Rate + type: string + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + tax_rate: + description: Available if the relation `tax_rate` is expanded. + $ref: ./tax_rate.yaml + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/staged_job.yaml b/docs/api/store/components/schemas/staged_job.yaml new file mode 100644 index 0000000000..95fd6aaf34 --- /dev/null +++ b/docs/api/store/components/schemas/staged_job.yaml @@ -0,0 +1,18 @@ +title: Staged Job +description: A staged job resource +x-resourceId: staged_job +required: + - event_name +properties: + id: + type: string + description: The staged job's ID + example: job_01F0YET7BZTARY9MKN1SJ7AAXF + event_name: + description: The name of the event + type: string + example: order.placed + data: + description: Data necessary for the job + type: object + example: {} diff --git a/docs/api/store/components/schemas/store.yaml b/docs/api/store/components/schemas/store.yaml new file mode 100644 index 0000000000..09844ff155 --- /dev/null +++ b/docs/api/store/components/schemas/store.yaml @@ -0,0 +1,59 @@ +title: Store +description: Holds settings for the Store, such as name, currencies, etc. +x-resourceId: store +properties: + id: + type: string + description: The store's ID + example: store_01G1G5V21KADXNGH29BJMAJ4B4 + name: + description: The name of the Store - this may be displayed to the Customer. + type: string + example: Medusa Store + default_currency_code: + description: The 3 character currency code that is the default of the store. + type: string + example: usd + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + default_currency: + description: Available if the relation `default_currency` is expanded. + $ref: ./currency.yaml + currencies: + description: >- + The currencies that are enabled for the Store. Available if the relation + `currencies` is expanded. + type: array + items: + $ref: ./currency.yaml + swap_link_template: + description: >- + A template to generate Swap links from. Use {{cart_id}} to include the + Swap's `cart_id` in the link. + type: string + example: null + payment_link_template: + description: >- + A template to generate Payment links from. Use {{cart_id}} to include the + payment's `cart_id` in the link. + type: string + example: null + invite_link_template: + description: A template to generate Invite links from + type: string + example: null + default_sales_channel_id: + type: string + description: The sales channel ID the cart is associated with. + example: null + default_sales_channel: + description: >- + A sales channel object. Available if the relation `default_sales_channel` + is expanded. + type: object + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/swap.yaml b/docs/api/store/components/schemas/swap.yaml new file mode 100644 index 0000000000..35a81eed87 --- /dev/null +++ b/docs/api/store/components/schemas/swap.yaml @@ -0,0 +1,149 @@ +title: Swap +description: >- + Swaps can be created when a Customer wishes to exchange Products that they + have purchased to different Products. Swaps consist of a Return of previously + purchased Products and a Fulfillment of new Products, the amount paid for the + Products being returned will be used towards payment for the new Products. In + the case where the amount paid for the the Products being returned exceed the + amount to be paid for the new Products, a Refund will be issued for the + difference. +x-resourceId: swap +required: + - fulfillment_status + - payment_status + - order_id +properties: + id: + type: string + description: The swap's ID + example: swap_01F0YET86Y9G92D3YDR9Y6V676 + fulfillment_status: + description: The status of the Fulfillment of the Swap. + type: string + enum: + - not_fulfilled + - fulfilled + - shipped + - canceled + - requires_action + example: not_fulfilled + payment_status: + description: >- + The status of the Payment of the Swap. The payment may either refer to the + refund of an amount or the authorization of a new amount. + type: string + enum: + - not_paid + - awaiting + - captured + - confirmed + - canceled + - difference_refunded + - partially_refunded + - refunded + - requires_action + example: not_paid + order_id: + description: The ID of the Order where the Line Items to be returned where purchased. + type: string + example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + order: + description: An order object. Available if the relation `order` is expanded. + type: object + additional_items: + description: >- + The new Line Items to ship to the Customer. Available if the relation + `additional_items` is expanded. + type: array + items: + $ref: ./line_item.yaml + return_order: + description: >- + A return order object. The Return that is issued for the return part of + the Swap. Available if the relation `return_order` is expanded. + type: object + fulfillments: + description: >- + The Fulfillments used to send the new Line Items. Available if the + relation `fulfillments` is expanded. + type: array + items: + $ref: ./fulfillment.yaml + payment: + description: >- + The Payment authorized when the Swap requires an additional amount to be + charged from the Customer. Available if the relation `payment` is + expanded. + $ref: ./payment.yaml + difference_due: + description: >- + The difference that is paid or refunded as a result of the Swap. May be + negative when the amount paid for the returned items exceed the total of + the new Products. + type: integer + example: 0 + shipping_address_id: + description: >- + The Address to send the new Line Items to - in most cases this will be the + same as the shipping address on the Order. + type: string + example: addr_01G8ZH853YPY9B94857DY91YGW + shipping_address: + description: Available if the relation `shipping_address` is expanded. + $ref: ./address.yaml + shipping_methods: + description: >- + The Shipping Methods used to fulfill the addtional items purchased. + Available if the relation `shipping_methods` is expanded. + type: array + items: + $ref: ./shipping_method.yaml + cart_id: + description: The id of the Cart that the Customer will use to confirm the Swap. + type: string + example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + cart: + description: A cart object. Available if the relation `cart` is expanded. + type: object + allow_backorder: + description: If true, swaps can be completed with items out of stock + type: boolean + default: false + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of the swap in case + of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + confirmed_at: + description: The date with timezone at which the Swap was confirmed by the Customer. + type: string + format: date-time + canceled_at: + description: The date with timezone at which the Swap was canceled. + type: string + format: date-time + no_notification: + description: If set to true, no notification will be sent related to this swap + type: boolean + example: false + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/tax_line.yaml b/docs/api/store/components/schemas/tax_line.yaml new file mode 100644 index 0000000000..491a7e0c00 --- /dev/null +++ b/docs/api/store/components/schemas/tax_line.yaml @@ -0,0 +1,36 @@ +title: Tax Line +description: Line item that specifies an amount of tax to add to a line item. +x-resourceId: tax_line +required: + - rate + - name +properties: + id: + type: string + description: The tax line's ID + example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + rate: + description: The numeric rate to charge tax by + type: number + example: 10 + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/tax_provider.yaml b/docs/api/store/components/schemas/tax_provider.yaml new file mode 100644 index 0000000000..267d162eae --- /dev/null +++ b/docs/api/store/components/schemas/tax_provider.yaml @@ -0,0 +1,15 @@ +title: Tax Provider +description: The tax service used to calculate taxes +x-resourceId: tax_provider +properties: + id: + description: The id of the tax provider as given by the plugin. + type: string + example: manual + is_installed: + description: >- + Whether the plugin is installed in the current version. Plugins that are + no longer installed are not deleted by will have this field set to + `false`. + type: boolean + default: true diff --git a/docs/api/store/components/schemas/tax_rate.yaml b/docs/api/store/components/schemas/tax_rate.yaml new file mode 100644 index 0000000000..29f7e0e0a9 --- /dev/null +++ b/docs/api/store/components/schemas/tax_rate.yaml @@ -0,0 +1,81 @@ +title: Tax Rate +description: >- + A Tax Rate can be used to associate a certain rate to charge on products + within a given Region +x-resourceId: line_item +required: + - name + - region_id +properties: + id: + type: string + description: The tax rate's ID + example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + rate: + description: The numeric rate to charge + type: number + example: 10 + code: + description: A code to identify the tax type by + type: string + example: tax01 + name: + description: A human friendly name for the tax + type: string + example: Tax Example + region_id: + type: string + description: The id of the Region that the rate belongs to + example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + region: + description: A region object. Available if the relation `region` is expanded. + type: object + products: + type: array + description: >- + The products that belong to this tax rate. Available if the relation + `products` is expanded. + items: + type: object + description: A product object. + product_types: + type: array + description: >- + The product types that belong to this tax rate. Available if the relation + `product_types` is expanded. + items: + type: object + description: A product type object. + shipping_options: + type: array + description: >- + The shipping options that belong to this tax rate. Available if the + relation `shipping_options` is expanded. + items: + type: object + description: A shipping option object. + product_count: + description: The count of products + type: integer + example: null + product_type_count: + description: The count of product types + type: integer + example: null + shipping_option_count: + description: The count of shipping options + type: integer + example: null + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/tracking_link.yaml b/docs/api/store/components/schemas/tracking_link.yaml new file mode 100644 index 0000000000..2a79689722 --- /dev/null +++ b/docs/api/store/components/schemas/tracking_link.yaml @@ -0,0 +1,55 @@ +title: Tracking Link +description: >- + Tracking Link holds information about tracking numbers for a Fulfillment. + Tracking Links can optionally contain a URL that can be visited to see the + status of the shipment. +x-resourceId: tracking_link +required: + - tracking_number + - fulfillment_id +properties: + id: + type: string + description: The tracking link's ID + example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 + url: + description: The URL at which the status of the shipment can be tracked. + type: string + format: uri + tracking_number: + description: The tracking number given by the shipping carrier. + type: string + format: RH370168054CN + fulfillment_id: + type: string + description: The id of the Fulfillment that the Tracking Link references. + example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + fulfillment: + description: Available if the relation `fulfillment` is expanded. + $ref: ./fulfillment.yaml + idempotency_key: + type: string + description: >- + Randomly generated key used to continue the completion of a process in + case of failure. + externalDocs: + url: >- + https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + description: Learn more how to use the idempotency key. + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/components/schemas/user.yaml b/docs/api/store/components/schemas/user.yaml new file mode 100644 index 0000000000..5083be44de --- /dev/null +++ b/docs/api/store/components/schemas/user.yaml @@ -0,0 +1,43 @@ +title: User +description: Represents a User who can manage store settings. +x-resourceId: user +required: + - email +properties: + id: + type: string + description: The user's ID + example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + email: + description: The email of the User + type: string + format: email + first_name: + description: The first name of the User + type: string + example: Levi + last_name: + description: The last name of the User + type: string + example: Bogan + api_token: + description: An API token associated with the user. + type: string + example: null + created_at: + type: string + description: The date with timezone at which the resource was created. + format: date-time + updated_at: + type: string + description: The date with timezone at which the resource was updated. + format: date-time + deleted_at: + type: string + description: The date with timezone at which the resource was deleted. + format: date-time + metadata: + type: object + description: An optional key-value map with additional details + example: + car: white diff --git a/docs/api/store/endpoints/carts.yaml b/docs/api/store/endpoints/carts.yaml deleted file mode 100644 index 60915a9b7e..0000000000 --- a/docs/api/store/endpoints/carts.yaml +++ /dev/null @@ -1,349 +0,0 @@ -title: Carts -domain: store -routes: - - method: GET - path: /carts/:id - - method: POST - path: /carts - - method: POST - path: /carts/:id - - method: POST - path: /carts/:id/complete-cart - - method: POST - path: /carts/:id/line-items - - method: POST - path: /carts/:id/line-items/:line_id - - method: POST - path: /carts/:id/payment-sessions - - method: POST - path: /carts/:id/payment-session/update - - method: POST - path: /carts/:id/payment-sessions/:provider_id/refresh - - method: POST - path: /carts/:id/payment-session - - method: POST - path: /carts/:id/shipping-methods - - method: DELETE - path: /carts/:id/payment-sessions/:provider_id - - method: DELETE - path: /carts/:id/line-items/:line_id - - method: DELETE - path: /carts/:id/discounts/:code -route: /carts -description: > - A Cart is the preliminary step to an Order. The Cart holds a collection of - items that the customer wishes to purchase, along with the customer's - preferred payment and shipping method. -endpoints: - - path: / - method: POST - title: Create a Cart - body: - - name: region_id - type: String - required: false - description: Id of the region to associate the cart with. - - name: items - type: List - required: false - description: List of objects with `variant_id` and `quantity`. - description: > - Creates a Cart within the given region and with the initial items. If no - `region_id` is provided the cart will be associated with the first Region - available. If no items are provided the cart will be empty after creation. - If a user is logged in the cart's customer id and email will be set. - - path: /:id - method: GET - title: Retrieve a Cart - description: > - Retrieves an existing cart. - - path: /:id - method: POST - title: Update a Cart - body: - - name: region_id - type: String - description: Id of a region. - - name: email - type: String - description: > - Customer's email where they will receive transactional emails etc. - - name: billing_address - type: Address - description: > - The billing address for the order. - - name: shipping_address - type: Address - description: > - The shipping address for the order. Will be sent to the fulfillment - provider when the items are ready to be shipped. - - name: discounts - type: List - description: > - A list of objects with `code` that represents a discount code to be - applied to the cart. - - name: customer_id - type: String - description: > - A list of objects with `code` that represents a discount code to be - applied to the cart. - description: > - Updates an existing cart with the provided data. Updating the `region_id` - will change the prices of the items in the cart to match the prices - defined for the region. You can apply multiple discounts at once by - calling the endpoint with an array of discounts. - - path: /:id/complete-cart - method: POST - title: Complete cart - description: > - Completes a cart. The following steps will be performed. Payment authorization - is attempted and if more work is required, we simply return the cart for further updates. - If payment is authorized and order is not yet created, we make sure to do so. - The completion of a cart can be performed idempotently with a provided header `Idempotency-Key`. - If not provided, we will generate one for the request. - - path: /:id/line-items - method: POST - title: Add line item - body: - - name: variant_id - type: String - required: true - description: The id of the variant that should be added to the cart. - - name: quantity - type: Integer - required: true - description: > - The quantity of the variant to add to the cart. Must be - greater than 0. - - name: metadata - type: Object - description: > - Optional metadata that may be needed for display purposes or other - functionality. - - path: /:id/line-items/:line_id - method: POST - title: Update line item - body: - - name: quantity - type: Integer - description: The desired quantity of the line item. - description: > - Updates the quantity of a line item. If the variant associated with the - line item is stock managed, the endpoint will respond with an error when - the inventory level cannot fulfill the desired quantity. - - path: /:id/line-items/:line_id - method: DELETE - title: Remove line item - description: > - Removes a the given line item from the cart. - - path: /:id/discounts/:code - method: DELETE - title: Remove discount code - description: Removes a discount code from the cart. - - path: /:id/payment-sessions - method: POST - title: Create payment sessions - description: > - Initializes the payment sessions that can be used to pay for the items of - the cart. This is usually called when a customer proceeds to checkout. - - path: /:id/payment-sessions/:provider_id - method: DELETE - title: Delete payment session - description: > - Deletes a payment session. Note that this will initialize a new payment - session with the provider. This is usually used if the payment session - reaches a state that cannot be recovered from. - - path: /:id/payment-session - method: POST - title: Set payment session on cart - params: - - name: provider_id - type: String - required: true - description: Id of the provider (e.g. stripe). - description: > - Adds or updates the payment method that will be used to pay for the items - in the cart. The payment is not processed until the payment provider's - authorization functionality is called. You should consult with your - installed payment plugins to find information about how to authorize a - payment. - - path: /:id/payment-session/update - method: POST - title: Update payment session on cart - params: - - name: session - type: Dictionary - required: true - description: > - The session object needs to have a `provider_id` (e.g. stripe) and `data`, that holds the update data for the session. - The data object can be anything that might be needed for the payment provider to process the - payment. The requirements of `data` will be different across payment - methods, and you should look at your installed payment providers to - find out what to send.. - description: > - Updates the payment session that will be used to pay for the items - in the cart. The payment is not processed until the payment provider's - authorization functionality is called. You should consult with your - installed payment plugins to find information about how to authorize a - payment. - - path: /:id/shipping-methods - method: POST - title: Add shipping method - body: - - name: option_id - type: String - required: true - description: The id of the shipping option to use. - - name: data - type: Dictionary - description: > - Used to hold any data that the shipping method may need to process the - fulfillment of the order. Look at the documentation for your installed - fulfillment providers to find out what to send. - description: > - Adds a shipping method to the cart. -response: | - { - "cart": { - "id": "cart_1234", - "email": null, - "billing_address_id": null, - "billing_address": null, - "shipping_address_id": "addr_1234", - "shipping_address": { - "id": "addr_1234", - "customer_id": null, - "company": null, - "first_name": null, - "last_name": null, - "address_1": null, - "address_2": null, - "city": null, - "country_code": "dk", - "province": null, - "postal_code": null, - "phone": null, - "created_at": "2021-02-04T15:40:54.691Z", - "updated_at": "2021-02-04T15:40:54.691Z", - "deleted_at": null, - "metadata": null - }, - "items": [{ - "id": "item_1234", - "cart_id": "cart_1234", - "order_id": null, - "swap_id": null, - "claim_order_id": null, - "title": "Terry Towel", - "description": "30x30", - "thumbnail": "", - "is_giftcard": false, - "should_merge": true, - "allow_discounts": true, - "has_shipping": false, - "unit_price": 6000, - "variant_id": "variant_1234", - "variant": { - "id": "variant_1234", - "title": "30x30", - "product_id": "prod_1234", - "sku": null, - "barcode": null, - "ean": null, - "upc": null, - "inventory_quantity": 9999, - "allow_backorder": false, - "manage_inventory": true, - "hs_code": null, - "origin_country": null, - "mid_code": null, - "material": null, - "weight": null, - "length": null, - "height": null, - "width": null, - "created_at": "2021-01-19T17:09:01.864Z", - "updated_at": "2021-02-02T02:43:17.718Z", - "deleted_at": null, - "metadata": null - }, - "quantity": 1, - "fulfilled_quantity": null, - "returned_quantity": null, - "shipped_quantity": null, - "created_at": "2021-02-04T15:42:12.514Z", - "updated_at": "2021-02-04T15:42:12.514Z", - "metadata": {} - }], - "region_id": "reg_1234", - "region": { - "id": "reg_1234", - "name": "Denmark", - "currency_code": "dkk", - "tax_rate": "25", - "tax_code": null, - "countries": [{ - "id": 60, - "iso_2": "dk", - "iso_3": "dnk", - "num_code": 208, - "name": "DENMARK", - "display_name": "Denmark", - "region_id": "reg_1234" - }], - "payment_providers": [{ - "id": "stripe", - "is_installed": true - }], - "fulfillment_providers": [{ - "id": "manual", - "is_installed": true - }], - "created_at": "2021-01-19T17:09:01.864Z", - "updated_at": "2021-01-21T15:44:05.492Z", - "deleted_at": null, - "metadata": null - }, - "discounts": [], - "gift_cards": [], - "customer_id": null, - "payment_sessions": [{ - "id": "ps_1234", - "cart_id": "cart_1234", - "provider_id": "stripe", - "is_selected": true, - "status": "pending", - "data": {}, - "created_at": "2021-02-08T11:37:17.906Z", - "updated_at": "2021-02-08T11:37:17.906Z", - "idempotency_key": null - }], - "payment_id": null, - "payment": null, - "shipping_methods": [], - "type": "default", - "completed_at": null, - "created_at": "2021-02-04T15:40:54.691Z", - "updated_at": "2021-02-04T15:40:54.691Z", - "deleted_at": null, - "metadata": null, - "idempotency_key": null, - "payment_session": { - "id": "ps_1234", - "cart_id": "cart_1234", - "provider_id": "stripe", - "is_selected": true, - "status": "pending", - "data": {}, - "created_at": "2021-02-08T11:37:17.906Z", - "updated_at": "2021-02-08T11:37:17.906Z", - "idempotency_key": null - }, - "shipping_total": 0, - "discount_total": 0, - "tax_total": 1500, - "gift_card_total": 0, - "subtotal": 6000, - "total": 7500 - } - } diff --git a/docs/api/store/endpoints/customers.yaml b/docs/api/store/endpoints/customers.yaml deleted file mode 100644 index d70f0034d5..0000000000 --- a/docs/api/store/endpoints/customers.yaml +++ /dev/null @@ -1,226 +0,0 @@ -title: Customers -domain: store -routes: - - method: POST - path: /customers - - method: GET - path: /customers/:id - - method: POST - path: /customers/:id - - method: POST - path: /customers/:id/addresses - - method: POST - path: /customers/:id/:address_id - - method: POST - path: /customers/:id/payment-methods - - method: POST - path: /customers/:id/reset-password - - method: POST - path: /customers/:id/reset-password-token -route: /customers -description: > - Customers can create a login to view order history and manage details. - Customers must have unique emails. -endpoints: - - path: / - method: POST - title: Create customer - body: - - name: email - type: String - required: true - description: The Customer's email; must be unique. - - name: first_name - type: String - required: true - description: The Customer's first name. - - name: last_name - type: String - required: true - description: The Customer's last name. - - name: password - type: String - required: true - description: The Customer's desired password. - - name: phone - type: String - description: The customer's phone number. - description: > - Creates a customer profile with the given details. If the email has been - used on previous orders the newly created Customer profile will be able to - view the order history associated with this email. - - path: /:id - method: GET - title: Retrieve customer - params: - - name: id - type: String - description: The id of the Customer to retrieve. - description: > - Retrieves the customer's details. The Customer identified by `id` must be - authenticated. - - - path: /:id - method: POST - title: Update customer - params: - - name: id - type: String - description: The id of the customer. - body: - - name: first_name - type: String - description: The Customer's first name. - - name: last_name - type: String - description: The Customer's last name. - - name: password - type: String - description: > - The Customer's password. Will create a hashed value for the database. - - name: phone - type: String - description: The Customer's phone number. - description: > - Updates the customer's details. The customer identified by `id` must be - authenticated in order to call this endpoint. - - path: /:id/addresses - method: POST - title: Create customer shipping address - params: - - name: id - type: String - description: The id of the Customer. - body: - - name: address - type: Address - description: The address to add. - description: > - Adds an address to the customer's saved addresses. The customer must be - authenticated prior to making this call. - - - path: /:id/addresses/:address_id - method: POST - title: Update customer shipping address - params: - - name: id - type: String - description: The id of the Customer. - - name: address_id - type: String - description: The id of the saved address to update. - body: - - name: address - type: Address - description: The address to update. - description: > - Updates a saved customer address. The customer must be authenticated prior - to making this call. - - - path: /:id/payment-methods - method: GET - title: Retrieve saved payment methods - params: - - name: id - type: String - description: The id of the customer. - description: > - Asks each payment provider for saved payment methods if any exist. This - will only return in methods in the case where the payment provider allows - payment methods to be saved. The customer must be authenticated in order - to call this endpoint. - - path: /password-reset - method: POST - title: Reset password - body: - - name: email - type: String - required: true - description: The email of the Customer. - - name: token - type: String - required: true - description: > - The token that will be used to reset the password. Should be generated - with a prior call to `/password-token`. - - name: password - type: String - required: true - description: > - The new password to authenticate the user with. - description: > - Resets a customer's password. The reset call requires a valid token - - - path: /password-token - method: POST - title: Generate password reset token - body: - - name: email - type: String - required: true - description: The email of the Customer profile to reset password for. - description: > - Generates a reset password token. The token should be sent to the customer - via an email provider. Note that this doesn't send any emails it only - generates the token and informs listeners to - `customer.password_token_generated` that the token was created. - -response: | - { - "customer": { - "id": "cus_4eThzYSuGv", - "email": "iron@man.com", - "first_name": "Tony", - "last_name": "Stark", - "billing_address": { - "id": "addr_WgNn0BSfIu", - "customer_id": "cus_4eThzYSuGv", - "company": "Stark Industries", - "first_name": "Tony", - "last_name": "Stark", - "address_1": "Hollywood Boulevard 1", - "address_2": null, - "city": "Los Angeles", - "country_code": "US", - "province": "CA", - "postal_code": "90046", - "phone": null, - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "deleted_at": null, - "metadata": null - }, - "shipping_addresses": [{ - "id": "addr_WgNn0BSfIu", - "customer_id": "cus_4eThzYSuGv", - "company": "Stark Industries", - "first_name": "Tony", - "last_name": "Stark", - "address_1": "Hollywood Boulevard 1", - "address_2": null, - "city": "Los Angeles", - "country_code": "US", - "province": "CA", - "postal_code": "90046", - "phone": null, - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "deleted_at": null, - "metadata": null - }], - "phone": "4242424242", - "has_account": false, - "orders": [{ - "id": "order_fi13oadpo2r3vc2g4592", - "status": "pending", - "fulfillment_status": "shipped", - "payment_status": "captured", - "display_id": 50433, - "total": 4004000, - "metadata": null - }], - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": {} - } - } diff --git a/docs/api/store/endpoints/orders.yaml b/docs/api/store/endpoints/orders.yaml deleted file mode 100644 index 29bb53634e..0000000000 --- a/docs/api/store/endpoints/orders.yaml +++ /dev/null @@ -1,137 +0,0 @@ -title: Orders -domain: store -routes: - - method: POST - path: /orders - - method: GET - path: /orders/:id -route: /orders -description: > - An Order represents a selection of items purchased and holds information about - how the items have been purchased and will be fulfilled. -endpoints: - - path: /:id - method: GET - title: Retrieve an Order - params: - - name: id - type: String - description: The id of the order. - description: > - Retrieves an order. - - path: / - method: POST - title: Creates an order - body: - - name: cart_id - type: String - required: true - description: Id of the cart from which the order should be created. - description: > - Creates an order from a cart. - -response: | - { - "order": { - "id": "order_fi13oadpo2r3vc2g4592", - "status": "pending", - "fulfillment_status": "shipped", - "payment_status": "captured", - "email": "iron@man.com", - "billing_address": { - "id": "addr_WgNn0BSfIu", - "customer_id": "cus_4eThzYSuGv", - "company": "Stark Industries", - "first_name": "Tony", - "last_name": "Stark", - "address_1": "Hollywood Boulevard 1", - "address_2": null, - "city": "Los Angeles", - "country_code": "US", - "province": "CA", - "postal_code": "90046", - "phone": null, - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "deleted_at": null, - "metadata": null - }, - "shipping_address": { - "id": "addr_WgNn0BSfIu", - "customer_id": "cus_4eThzYSuGv", - "company": "Stark Industries", - "first_name": "Tony", - "last_name": "Stark", - "address_1": "Hollywood Boulevard 1", - "address_2": null, - "city": "Los Angeles", - "country_code": "US", - "province": "CA", - "postal_code": "90046", - "phone": null, - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "deleted_at": null, - "metadata": null - }, - "items": [ - { - "id": "item_fn2uaQH95vG9ZMnhj2aU03xg", - "cart_id": null, - "order_id": "order_s9RojwCU2AM8RztcldM2Uof7", - "swap_id": null, - "title": "Ironman suit", - "description": "Awesome Ironman suit", - "thumbnail": null, - "is_giftcard": false, - "should_merge": false, - "allow_discounts": true, - "unit_price": 119600, - "variant_id": "variant_rdEH6PykBuH57giw", - "quantity": 1, - "fulfilled_quantity": 1, - "returned_quantity": 0, - "shipped_quantity": 0, - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": null - } - ], - "discounts": [ - { - "id": "disc_OpYQN4H8MOWHN2en", - "code": "CCC3C4LL88", - "is_dynamic": true, - "discount_rule_id": "dru_MDyr3lJLa00uxOsY", - "parent_discount_id": "disc_ubtdlkASI7bfUj81", - "metadata": null - } - ], - "customer_id": "cus_4eThzYSuGv", - "shipping_methods": [ - { - "id": "sm_77bEapbO8tkCqw3yo1NBuCUl", - "shipping_option_id": "so_nRvwHhEdZw", - "order_id": "order_s9RojwCU2AM8RztcldM2Uof7", - "cart_id": null, - "swap_id": null, - "return_id": null, - "price": 0, - "data": { - "id": "Parcel shop", - "city": "Los Angeles", - "postal": "90046" - } - } - ], - "metadata": null, - "display_id": 50433, - "currency_code": "dkk", - "region_id": "reg_HMnixPlOicAs7aBlXuchAGxd", - "shipping_total": 0, - "discount_total": 0, - "tax_total": 3850000, - "subtotal": 154000, - "total": 4004000 - } - } diff --git a/docs/api/store/endpoints/product-variants.yaml b/docs/api/store/endpoints/product-variants.yaml deleted file mode 100644 index 8a752120e6..0000000000 --- a/docs/api/store/endpoints/product-variants.yaml +++ /dev/null @@ -1,61 +0,0 @@ -title: Product variants -domain: store -routes: - - method: GET - path: /product-variants - - method: GET - path: /product-variants/:id -route: /product-variants -description: > - A product variant represents a specific type of product. E.g. a variant can differ from other variants based on size and color. A variant will always belong to a product. -endpoints: - - path: /:id - method: GET - title: Retrieve product variant - params: - - name: id - type: String - description: Id of the product variant. - description: > - Retrieves product variant - - path: / - method: GET - title: List product variants - params: - - name: ids - optional: true - type: String - description: String of product variant ids. Id's needs to be separated by comma. - description: > - Retrieves product variants. Specific variants can be retrieved using `ids` query param in the request. - -response: | - { - "region": { - "id": "reg_HMnixPlOicAs7aBlXuchAGxd", - "name": "Denmark", - "currency_code": "DKK", - "currency": "DKK", - "tax_rate": 0.25, - "tax_code": null, - "countries": [{ - "id": "1001", - "iso_2": "DK", - "iso_3": "DNK", - "num_code": "208", - "name": "denmark", - "display_name": "Denmark" - }], - "payment_providers": [{ - "id": "stripe", - "is_installed": true - }], - "fulfillment_providers": [{ - "id": "manual", - "is_installed": true - }], - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": null - } - } diff --git a/docs/api/store/endpoints/products.yaml b/docs/api/store/endpoints/products.yaml deleted file mode 100644 index 29251734b6..0000000000 --- a/docs/api/store/endpoints/products.yaml +++ /dev/null @@ -1,56 +0,0 @@ -title: Products -domain: store -routes: - - method: POST - path: /products - - method: GET - path: /products/:id -route: /products -description: > - A product represents the object, that are to be sold on the website. A product can have variants, that differ by e.g. size and color. -endpoints: - - path: /:id - method: GET - title: Retrieve product - params: - - name: id - type: String - description: Id of the product. - description: > - Retrieves a product - - path: / - method: GET - title: List products - description: > - Retrieves the products for the configured store. - -response: | - { - "region": { - "id": "reg_HMnixPlOicAs7aBlXuchAGxd", - "name": "Denmark", - "currency_code": "DKK", - "currency": "DKK", - "tax_rate": 0.25, - "tax_code": null, - "countries": [{ - "id": "1001", - "iso_2": "DK", - "iso_3": "DNK", - "num_code": "208", - "name": "denmark", - "display_name": "Denmark" - }], - "payment_providers": [{ - "id": "stripe", - "is_installed": true - }], - "fulfillment_providers": [{ - "id": "manual", - "is_installed": true - }], - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": null - } - } diff --git a/docs/api/store/endpoints/regions.yaml b/docs/api/store/endpoints/regions.yaml deleted file mode 100644 index e0a1e2d52e..0000000000 --- a/docs/api/store/endpoints/regions.yaml +++ /dev/null @@ -1,58 +0,0 @@ -title: Regions -domain: store -routes: - - method: POST - path: /regions - - method: GET - path: /regions/:id -route: /regions -description: > - A region represents a collection of countries that have common pricing - schemes, shipping options, tax schemes, etc. Carts must have a region - associated. -endpoints: - - path: /:id - method: GET - title: Retrieve region - params: - - name: id - type: String - description: Id of the region. - description: > - Retrieves a region - - path: / - method: GET - title: List regions - description: > - Retrieves the regions configured for the store. - -response: | - { - "region": { - "id": "reg_HMnixPlOicAs7aBlXuchAGxd", - "name": "Denmark", - "currency_code": "DKK", - "currency": "DKK", - "tax_rate": 0.25, - "tax_code": null, - "countries": [{ - "id": "1001", - "iso_2": "DK", - "iso_3": "DNK", - "num_code": "208", - "name": "denmark", - "display_name": "Denmark" - }], - "payment_providers": [{ - "id": "stripe", - "is_installed": true - }], - "fulfillment_providers": [{ - "id": "manual", - "is_installed": true - }], - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": null - } - } diff --git a/docs/api/store/endpoints/shipping-options.yaml b/docs/api/store/endpoints/shipping-options.yaml deleted file mode 100644 index 0b5b478701..0000000000 --- a/docs/api/store/endpoints/shipping-options.yaml +++ /dev/null @@ -1,53 +0,0 @@ -title: Shipping options -domain: store -routes: - - method: GET - path: /shipping-options -route: /shipping-options -description: > - A shipping option represents a delivery method for products and belongs to a region. -endpoints: - - path: / - method: GET - title: List shipping options - params: - - name: product_ids - optional: true - type: String - description: String of product ids. Id's needs to be separated by comma. - - name: region_id - type: String - description: Id of region - description: > - Retrieves shipping options in a given region. Shipping options for specific products can be retrieved using the `product_ids` query param. - -response: | - { - "region": { - "id": "reg_HMnixPlOicAs7aBlXuchAGxd", - "name": "Denmark", - "currency_code": "DKK", - "currency": "DKK", - "tax_rate": 0.25, - "tax_code": null, - "countries": [{ - "id": "1001", - "iso_2": "DK", - "iso_3": "DNK", - "num_code": "208", - "name": "denmark", - "display_name": "Denmark" - }], - "payment_providers": [{ - "id": "stripe", - "is_installed": true - }], - "fulfillment_providers": [{ - "id": "manual", - "is_installed": true - }], - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": null - } - } diff --git a/docs/api/store/endpoints/swaps.yaml b/docs/api/store/endpoints/swaps.yaml deleted file mode 100644 index 3588f28f6a..0000000000 --- a/docs/api/store/endpoints/swaps.yaml +++ /dev/null @@ -1,56 +0,0 @@ -title: Swaps -domain: store -routes: - - method: GET - path: /swaps/:cart_id - - method: POST - path: /swaps -route: /swaps -description: > - A swap represents an order, that are created in the process of swapping items in an existing order. In the context of the store, the swap can be retrieved in order to make the payment (if relevant). Furthermore, it is possible to create / complete a swap in the store. -endpoints: - - path: / - method: GET - title: Get swap by cart - params: - - name: cart_id - type: String - description: Id of cart to retrieve swap for. - description: > - Retrieves swap by cart id. - - path: / - method: POST - title: Create swap - description: > - Creates / completes a swap. - -response: | - { - "region": { - "id": "reg_HMnixPlOicAs7aBlXuchAGxd", - "name": "Denmark", - "currency_code": "DKK", - "currency": "DKK", - "tax_rate": 0.25, - "tax_code": null, - "countries": [{ - "id": "1001", - "iso_2": "DK", - "iso_3": "DNK", - "num_code": "208", - "name": "denmark", - "display_name": "Denmark" - }], - "payment_providers": [{ - "id": "stripe", - "is_installed": true - }], - "fulfillment_providers": [{ - "id": "manual", - "is_installed": true - }], - "created_at": "2020-12-11T17:03:54.458Z", - "updated_at": "2020-12-11T17:03:54.458Z", - "metadata": null - } - } diff --git a/docs/api/store/openapi.yaml b/docs/api/store/openapi.yaml new file mode 100644 index 0000000000..09e3890872 --- /dev/null +++ b/docs/api/store/openapi.yaml @@ -0,0 +1,138 @@ +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: + /auth: + $ref: paths/auth.yaml + /auth/{email}: + $ref: paths/auth_{email}.yaml + /collections/{id}: + $ref: paths/collections_{id}.yaml + /collections: + $ref: paths/collections.yaml + /gift-cards/{code}: + $ref: paths/gift-cards_{code}.yaml + /carts/{id}/shipping-methods: + $ref: paths/carts_{id}_shipping-methods.yaml + /carts/{id}/taxes: + $ref: paths/carts_{id}_taxes.yaml + /carts/{id}/complete: + $ref: paths/carts_{id}_complete.yaml + /carts: + $ref: paths/carts.yaml + /carts/{id}/line-items: + $ref: paths/carts_{id}_line-items.yaml + /carts/{id}/payment-sessions: + $ref: paths/carts_{id}_payment-sessions.yaml + /carts/{id}/discounts/{code}: + $ref: paths/carts_{id}_discounts_{code}.yaml + /carts/{id}/line-items/{line_id}: + $ref: paths/carts_{id}_line-items_{line_id}.yaml + /carts/{id}/payment-sessions/{provider_id}: + $ref: paths/carts_{id}_payment-sessions_{provider_id}.yaml + /carts/{id}: + $ref: paths/carts_{id}.yaml + /carts/{id}/payment-sessions/{provider_id}/refresh: + $ref: paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml + /carts/{id}/payment-session: + $ref: paths/carts_{id}_payment-session.yaml + /customers/me/addresses: + $ref: paths/customers_me_addresses.yaml + /customers: + $ref: paths/customers.yaml + /customers/me/addresses/{address_id}: + $ref: paths/customers_me_addresses_{address_id}.yaml + /customers/me: + $ref: paths/customers_me.yaml + /customers/me/payment-methods: + $ref: paths/customers_me_payment-methods.yaml + /customers/me/orders: + $ref: paths/customers_me_orders.yaml + /customers/password-token: + $ref: paths/customers_password-token.yaml + /customers/password-reset: + $ref: paths/customers_password-reset.yaml + /orders/cart/{cart_id}: + $ref: paths/orders_cart_{cart_id}.yaml + /orders/{id}: + $ref: paths/orders_{id}.yaml + /orders: + $ref: paths/orders.yaml + /products/{id}: + $ref: paths/products_{id}.yaml + /products: + $ref: paths/products.yaml + /products/search: + $ref: paths/products_search.yaml + /regions/{id}: + $ref: paths/regions_{id}.yaml + /regions: + $ref: paths/regions.yaml + /return-reasons/{id}: + $ref: paths/return-reasons_{id}.yaml + /return-reasons: + $ref: paths/return-reasons.yaml + /returns: + $ref: paths/returns.yaml + /shipping-options: + $ref: paths/shipping-options.yaml + /shipping-options/{cart_id}: + $ref: paths/shipping-options_{cart_id}.yaml + /swaps: + $ref: paths/swaps.yaml + /swaps/{cart_id}: + $ref: paths/swaps_{cart_id}.yaml + /variants/{variant_id}: + $ref: paths/variants_{variant_id}.yaml + /variants: + $ref: paths/variants.yaml diff --git a/docs/api/store/paths/auth.yaml b/docs/api/store/paths/auth.yaml new file mode 100644 index 0000000000..73909588ae --- /dev/null +++ b/docs/api/store/paths/auth.yaml @@ -0,0 +1,60 @@ +post: + operationId: PostAuth + summary: Authenticate Customer + description: >- + Logs a Customer in and authorizes them to view their details. Successful + authentication will set a session cookie in the Customer's browser. + parameters: [] + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + description: The Customer's email. + password: + type: string + description: The Customer's password. +delete: + operationId: DeleteAuth + summary: Log out + description: Destroys a Customer's authenticated session. + tags: + - Auth + responses: + '200': + description: OK +get: + operationId: GetAuth + summary: Get Session + description: Gets the currently logged in Customer. + x-authenticated: true + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml + '401': + description: Unauthorized diff --git a/docs/api/store/paths/auth_{email}.yaml b/docs/api/store/paths/auth_{email}.yaml new file mode 100644 index 0000000000..574126c113 --- /dev/null +++ b/docs/api/store/paths/auth_{email}.yaml @@ -0,0 +1,24 @@ +get: + operationId: GetAuthEmail + summary: Check if email has account + description: Checks if a Customer with the given email has signed up. + parameters: + - in: path + name: email + schema: + type: string + format: email + required: true + description: The email to check if exists. + tags: + - Auth + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + exists: + type: boolean + description: Whether email exists or not. diff --git a/docs/api/store/paths/carts.yaml b/docs/api/store/paths/carts.yaml new file mode 100644 index 0000000000..0c75e60b3b --- /dev/null +++ b/docs/api/store/paths/carts.yaml @@ -0,0 +1,65 @@ +post: + summary: Create a Cart + operationId: PostCart + description: >- + Creates a Cart within the given region and with the initial items. If no + `region_id` is provided the cart will be associated with the first Region + available. If no items are provided the cart will be empty after creation. + If a user is logged in the cart's customer id and email will be set. + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The ID of the Region to create the Cart in. + sales_channel_id: + type: string + description: >- + [EXPERIMENTAL] The ID of the Sales channel to create the Cart + in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + items: + description: >- + An optional array of `variant_id`, `quantity` pairs to generate + Line Items from. + type: array + items: + required: + - variant_id + - quantity + properties: + variant_id: + description: >- + The id of the Product Variant to generate a Line Item + from. + type: string + quantity: + description: The quantity of the Product Variant to add + type: integer + context: + description: >- + An optional object to provide context to the Cart. The `context` + field is automatically populated with `ip` and `user_agent` + type: object + example: + ip: '::1' + user_agent: Chrome + tags: + - Cart + responses: + '200': + description: Successfully created a new Cart + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml diff --git a/docs/api/store/paths/carts_{id}.yaml b/docs/api/store/paths/carts_{id}.yaml new file mode 100644 index 0000000000..469a20338c --- /dev/null +++ b/docs/api/store/paths/carts_{id}.yaml @@ -0,0 +1,109 @@ +get: + operationId: GetCartsCart + summary: Retrieve a Cart + description: Retrieves a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml +post: + operationId: PostCartsCart + summary: Update a Cart + description: Updates a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + region_id: + type: string + description: The id of the Region to create the Cart in. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + externalDocs: + url: >- + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + description: See a list of codes. + email: + type: string + description: An email to be used on the Cart. + format: email + sales_channel_id: + type: string + description: The ID of the Sales channel to update the Cart with. + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: ../components/schemas/address.yaml + description: A full billing address object. + - type: string + description: The billing address ID + shipping_address: + description: The Address to be used for shipping. + anyOf: + - $ref: ../components/schemas/address.yaml + description: A full shipping address object. + - type: string + description: The shipping address ID + gift_cards: + description: An array of Gift Card codes to add to the Cart. + type: array + items: + required: + - code + properties: + code: + description: The code that a Gift Card is identified by. + type: string + discounts: + description: An array of Discount codes to add to the Cart. + type: array + items: + required: + - code + properties: + code: + description: The code that a Discount is identifed by. + type: string + customer_id: + description: The ID of the Customer to associate the Cart with. + type: string + context: + description: An optional object to provide context to the Cart. + type: object + example: + ip: '::1' + user_agent: Chrome + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml diff --git a/docs/api/store/paths/carts_{id}_complete.yaml b/docs/api/store/paths/carts_{id}_complete.yaml new file mode 100644 index 0000000000..9814feb4ff --- /dev/null +++ b/docs/api/store/paths/carts_{id}_complete.yaml @@ -0,0 +1,64 @@ +post: + summary: Complete a Cart + operationId: PostCartsCartComplete + description: >- + Completes a cart. The following steps will be performed. Payment + authorization is attempted and if more work is required, we simply return + the cart for further updates. If payment is authorized and order is not yet + created, we make sure to do so. The completion of a cart can be performed + idempotently with a provided header `Idempotency-Key`. If not provided, we + will generate one for the request. + parameters: + - in: path + name: id + required: true + description: The Cart id. + schema: + type: string + tags: + - Cart + responses: + '200': + description: >- + If a cart was successfully authorized, but requires further action from + the user the response body will contain the cart with an updated payment + session. If the Cart was successfully completed the response body will + contain the newly created Order. + content: + application/json: + schema: + properties: + type: + type: string + description: The type of the data property. + enum: + - order + - cart + - swap + data: + type: object + description: >- + The data of the result object. Its type depends on the type + field. + oneOf: + - type: object + description: >- + Cart was successfully authorized and order was placed + successfully. + properties: + order: + $ref: ../components/schemas/order.yaml + - type: object + description: >- + Cart was successfully authorized but requires further + actions. + properties: + cart: + $ref: ../components/schemas/cart.yaml + - type: object + description: >- + When cart is used for a swap and it has been completed + successfully. + properties: + cart: + $ref: ../components/schemas/swap.yaml diff --git a/docs/api/store/paths/carts_{id}_discounts_{code}.yaml b/docs/api/store/paths/carts_{id}_discounts_{code}.yaml new file mode 100644 index 0000000000..cdb4c10fe1 --- /dev/null +++ b/docs/api/store/paths/carts_{id}_discounts_{code}.yaml @@ -0,0 +1,28 @@ +delete: + operationId: DeleteCartsCartDiscountsDiscount + description: Removes a Discount from a Cart. + summary: Remove Discount from Cart + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: code + required: true + description: The unique Discount code. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml diff --git a/docs/api/store/paths/carts_{id}_line-items.yaml b/docs/api/store/paths/carts_{id}_line-items.yaml new file mode 100644 index 0000000000..b7ac4f1a36 --- /dev/null +++ b/docs/api/store/paths/carts_{id}_line-items.yaml @@ -0,0 +1,42 @@ +post: + operationId: PostCartsCartLineItems + summary: Add a Line Item + description: Generates a Line Item with a given Product Variant and adds it to the Cart + parameters: + - in: path + name: id + required: true + description: The id of the Cart to add the Line Item to. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - variant_id + - quantity + properties: + variant_id: + type: string + description: The id of the Product Variant to generate the Line Item from. + quantity: + type: integer + description: The quantity of the Product Variant to add to the Line Item. + metadata: + type: object + description: >- + An optional key-value map with additional details about the Line + Item. diff --git a/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml b/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml new file mode 100644 index 0000000000..de972a6909 --- /dev/null +++ b/docs/api/store/paths/carts_{id}_line-items_{line_id}.yaml @@ -0,0 +1,67 @@ +delete: + operationId: DeleteCartsCartLineItemsItem + summary: Delete a Line Item + description: Removes a Line Item from a Cart. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: line_id + required: true + description: The id of the Line Item. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml +post: + operationId: PostCartsCartLineItemsItem + summary: Update a Line Item + description: Updates a Line Item if the desired quantity can be fulfilled. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: line_id + required: true + description: The id of the Line Item. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - quantity + properties: + quantity: + type: integer + description: The quantity to set the Line Item to. diff --git a/docs/api/store/paths/carts_{id}_payment-session.yaml b/docs/api/store/paths/carts_{id}_payment-session.yaml new file mode 100644 index 0000000000..8c545a6705 --- /dev/null +++ b/docs/api/store/paths/carts_{id}_payment-session.yaml @@ -0,0 +1,35 @@ +post: + operationId: PostCartsCartPaymentSession + summary: Select a Payment Session + description: >- + Selects a Payment Session as the session intended to be used towards the + completion of the Cart. + parameters: + - in: path + name: id + required: true + description: The ID of the Cart. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - provider_id + properties: + provider_id: + type: string + description: The ID of the Payment Provider. diff --git a/docs/api/store/paths/carts_{id}_payment-sessions.yaml b/docs/api/store/paths/carts_{id}_payment-sessions.yaml new file mode 100644 index 0000000000..e9c4b299a4 --- /dev/null +++ b/docs/api/store/paths/carts_{id}_payment-sessions.yaml @@ -0,0 +1,24 @@ +post: + operationId: PostCartsCartPaymentSessions + summary: Initialize Payment Sessions + description: >- + Creates Payment Sessions for each of the available Payment Providers in the + Cart's Region. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml diff --git a/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml new file mode 100644 index 0000000000..138acff81e --- /dev/null +++ b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}.yaml @@ -0,0 +1,69 @@ +delete: + operationId: DeleteCartsCartPaymentSessionsSession + summary: Delete a Payment Session + description: Deletes a Payment Session on a Cart. May be useful if a payment has failed. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: >- + The id of the Payment Provider used to create the Payment Session to be + deleted. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml +post: + operationId: PostCartsCartPaymentSessionUpdate + summary: Update a Payment Session + description: Updates a Payment Session with additional data. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: The id of the payment provider. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: object + description: The data to update the payment session with. diff --git a/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml new file mode 100644 index 0000000000..b5a7de6600 --- /dev/null +++ b/docs/api/store/paths/carts_{id}_payment-sessions_{provider_id}_refresh.yaml @@ -0,0 +1,32 @@ +post: + operationId: PostCartsCartPaymentSessionsSession + summary: Refresh a Payment Session + description: >- + Refreshes a Payment Session to ensure that it is in sync with the Cart - + this is usually not necessary. + parameters: + - in: path + name: id + required: true + description: The id of the Cart. + schema: + type: string + - in: path + name: provider_id + required: true + description: >- + The id of the Payment Provider that created the Payment Session to be + refreshed. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml diff --git a/docs/api/store/paths/carts_{id}_shipping-methods.yaml b/docs/api/store/paths/carts_{id}_shipping-methods.yaml new file mode 100644 index 0000000000..0ea9ae45fe --- /dev/null +++ b/docs/api/store/paths/carts_{id}_shipping-methods.yaml @@ -0,0 +1,40 @@ +post: + operationId: PostCartsCartShippingMethod + description: Adds a Shipping Method to the Cart. + summary: Add a Shipping Method + tags: + - Cart + parameters: + - in: path + name: id + required: true + description: The cart ID. + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml + requestBody: + content: + application/json: + schema: + type: object + required: + - option_id + properties: + option_id: + type: string + description: ID of the shipping option to create the method from + data: + type: object + description: >- + Used to hold any data that the shipping method may need to + process the fulfillment of the order. Look at the documentation + for your installed fulfillment providers to find out what to + send. diff --git a/docs/api/store/paths/carts_{id}_taxes.yaml b/docs/api/store/paths/carts_{id}_taxes.yaml new file mode 100644 index 0000000000..e85afe3fde --- /dev/null +++ b/docs/api/store/paths/carts_{id}_taxes.yaml @@ -0,0 +1,24 @@ +post: + summary: Calculate Cart Taxes + operationId: PostCartsCartTaxes + description: >- + Calculates taxes for a cart. Depending on the cart's region this may involve + making 3rd party API calls to a Tax Provider service. + parameters: + - in: path + name: id + required: true + description: The Cart ID. + schema: + type: string + tags: + - Cart + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: ../components/schemas/cart.yaml diff --git a/docs/api/store/paths/collections.yaml b/docs/api/store/paths/collections.yaml new file mode 100644 index 0000000000..7b877a2093 --- /dev/null +++ b/docs/api/store/paths/collections.yaml @@ -0,0 +1,85 @@ +get: + operationId: GetCollections + summary: List Product Collections + description: Retrieve a list of Product Collection. + parameters: + - in: query + name: offset + description: >- + The number of collections to skip before starting to collect the + collections set + schema: + type: integer + default: 0 + - in: query + name: limit + description: The number of collections to return + schema: + type: integer + default: 10 + - in: query + name: created_at + description: Date comparison for when resulting collections were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting collections were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collections: + type: array + items: + $ref: ../components/schemas/product_collection.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/store/paths/collections_{id}.yaml b/docs/api/store/paths/collections_{id}.yaml new file mode 100644 index 0000000000..94778954a4 --- /dev/null +++ b/docs/api/store/paths/collections_{id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetCollectionsCollection + summary: Retrieve a Product Collection + description: Retrieves a Product Collection. + parameters: + - in: path + name: id + required: true + description: The id of the Product Collection + schema: + type: string + tags: + - Collection + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: ../components/schemas/product_collection.yaml diff --git a/docs/api/store/paths/customers.yaml b/docs/api/store/paths/customers.yaml new file mode 100644 index 0000000000..82a4f6e32e --- /dev/null +++ b/docs/api/store/paths/customers.yaml @@ -0,0 +1,63 @@ +post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer account. + requestBody: + content: + application/json: + schema: + required: + - first_name + - last_name + - email + - password + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + phone: + description: The Customer's phone number. + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml + '422': + description: A customer with the same email exists + content: + application/json: + schema: + properties: + code: + type: string + description: The error code + type: + type: string + description: The type of error + message: + type: string + description: Human-readable message with details about the error + example: + code: invalid_request_error + type: duplicate_error + message: >- + A customer with the given email already has an account. Log in + instead diff --git a/docs/api/store/paths/customers_me.yaml b/docs/api/store/paths/customers_me.yaml new file mode 100644 index 0000000000..239dd92c9d --- /dev/null +++ b/docs/api/store/paths/customers_me.yaml @@ -0,0 +1,64 @@ +get: + operationId: GetCustomersCustomer + summary: Retrieves a Customer + description: >- + Retrieves a Customer - the Customer must be logged in to retrieve their + details. + x-authenticated: true + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml +post: + operationId: PostCustomersCustomer + summary: Update Customer details + description: Updates a Customer's saved details. + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: ../components/schemas/address.yaml + description: The full billing address object + - type: string + description: The ID of an existing billing address + password: + description: The Customer's password. + type: string + phone: + description: The Customer's phone number. + type: string + email: + description: The email of the customer. + type: string + metadata: + description: Metadata about the customer. + type: object + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml diff --git a/docs/api/store/paths/customers_me_addresses.yaml b/docs/api/store/paths/customers_me_addresses.yaml new file mode 100644 index 0000000000..852fa74b76 --- /dev/null +++ b/docs/api/store/paths/customers_me_addresses.yaml @@ -0,0 +1,27 @@ +post: + operationId: PostCustomersCustomerAddresses + summary: Add a Shipping Address + description: Adds a Shipping Address to a Customer's saved addresses. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - address + properties: + address: + description: The Address to add to the Customer. + anyOf: + - $ref: ../components/schemas/address.yaml + tags: + - Customer + responses: + '200': + description: A successful response + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml diff --git a/docs/api/store/paths/customers_me_addresses_{address_id}.yaml b/docs/api/store/paths/customers_me_addresses_{address_id}.yaml new file mode 100644 index 0000000000..e8c248228f --- /dev/null +++ b/docs/api/store/paths/customers_me_addresses_{address_id}.yaml @@ -0,0 +1,52 @@ +delete: + operationId: DeleteCustomersCustomerAddressesAddress + summary: Delete an Address + description: Removes an Address from the Customer's saved addresses. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to remove. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml +post: + operationId: PostCustomersCustomerAddressesAddress + summary: Update a Shipping Address + description: Updates a Customer's saved Shipping Address. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../components/schemas/address.yaml + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml diff --git a/docs/api/store/paths/customers_me_orders.yaml b/docs/api/store/paths/customers_me_orders.yaml new file mode 100644 index 0000000000..e1af64470b --- /dev/null +++ b/docs/api/store/paths/customers_me_orders.yaml @@ -0,0 +1,54 @@ +get: + operationId: GetCustomersCustomerOrders + summary: Retrieve Customer Orders + description: Retrieves a list of a Customer's Orders. + x-authenticated: true + parameters: + - in: query + name: limit + description: How many orders to return. + schema: + type: integer + default: 10 + - in: query + name: offset + description: The offset in the resulting orders. + schema: + type: integer + default: 0 + - in: query + name: fields + description: >- + (Comma separated string) Which fields should be included in the + resulting orders. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated string) Which relations should be expanded in the + resulting orders. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + orders: + type: array + items: + $ref: ../components/schemas/order.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/store/paths/customers_me_payment-methods.yaml b/docs/api/store/paths/customers_me_payment-methods.yaml new file mode 100644 index 0000000000..ed8fd4e188 --- /dev/null +++ b/docs/api/store/paths/customers_me_payment-methods.yaml @@ -0,0 +1,31 @@ +get: + operationId: GetCustomersCustomerPaymentMethods + summary: Retrieve saved payment methods + description: >- + Retrieves a list of a Customer's saved payment methods. Payment methods are + saved with Payment Providers and it is their responsibility to fetch saved + methods. + x-authenticated: true + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + payment_methods: + type: array + items: + properties: + provider_id: + type: string + description: >- + The id of the Payment Provider where the payment method + is saved. + data: + type: object + description: >- + The data needed for the Payment Provider to use the + saved payment method. diff --git a/docs/api/store/paths/customers_password-reset.yaml b/docs/api/store/paths/customers_password-reset.yaml new file mode 100644 index 0000000000..e882f146a2 --- /dev/null +++ b/docs/api/store/paths/customers_password-reset.yaml @@ -0,0 +1,37 @@ +post: + operationId: PostCustomersResetPassword + summary: Resets Customer password + description: >- + Resets a Customer's password using a password token created by a previous + /password-token request. + requestBody: + content: + application/json: + schema: + required: + - email + - password + - token + properties: + email: + description: The email of the customer. + type: string + format: email + password: + description: The Customer's password. + type: string + format: password + token: + description: The reset password token + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: ../components/schemas/customer.yaml diff --git a/docs/api/store/paths/customers_password-token.yaml b/docs/api/store/paths/customers_password-token.yaml new file mode 100644 index 0000000000..1b46ffaa2f --- /dev/null +++ b/docs/api/store/paths/customers_password-token.yaml @@ -0,0 +1,23 @@ +post: + operationId: PostCustomersCustomerPasswordToken + summary: Creates a reset password token + description: >- + Creates a reset password token to be used in a subsequent /reset-password + request. The password token should be sent out of band e.g. via email and + will not be returned. + requestBody: + content: + application/json: + schema: + required: + - email + properties: + email: + description: The email of the customer. + type: string + format: email + tags: + - Customer + responses: + '204': + description: OK diff --git a/docs/api/store/paths/gift-cards_{code}.yaml b/docs/api/store/paths/gift-cards_{code}.yaml new file mode 100644 index 0000000000..296239263e --- /dev/null +++ b/docs/api/store/paths/gift-cards_{code}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetGiftCardsCode + summary: Retrieve Gift Card by Code + description: Retrieves a Gift Card by its associated unqiue code. + parameters: + - in: path + name: code + required: true + description: The unique Gift Card code. + schema: + type: string + tags: + - Gift Card + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + gift_card: + $ref: ../components/schemas/gift_card.yaml diff --git a/docs/api/store/paths/orders.yaml b/docs/api/store/paths/orders.yaml new file mode 100644 index 0000000000..6922c2a3b8 --- /dev/null +++ b/docs/api/store/paths/orders.yaml @@ -0,0 +1,42 @@ +get: + operationId: GetOrders + summary: Look Up an Order + description: Look up an order using filters. + parameters: + - in: query + name: display_id + required: true + description: The display id given to the Order. + schema: + type: number + - in: query + name: email + style: form + explode: false + description: The email associated with this order. + required: true + schema: + type: string + format: email + - in: query + name: shipping_address + style: form + explode: false + description: The shipping address associated with this order. + schema: + type: object + properties: + postal_code: + type: string + description: The postal code of the shipping address + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/store/paths/orders_cart_{cart_id}.yaml b/docs/api/store/paths/orders_cart_{cart_id}.yaml new file mode 100644 index 0000000000..a5fb52acb1 --- /dev/null +++ b/docs/api/store/paths/orders_cart_{cart_id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetOrdersOrderCartId + summary: Retrieves Order by Cart id + description: Retrieves an Order by the id of the Cart that was used to create the Order. + parameters: + - in: path + name: cart_id + required: true + description: The ID of Cart. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/store/paths/orders_{id}.yaml b/docs/api/store/paths/orders_{id}.yaml new file mode 100644 index 0000000000..adb4dbe44b --- /dev/null +++ b/docs/api/store/paths/orders_{id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetOrdersOrder + summary: Retrieves an Order + description: Retrieves an Order + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + tags: + - Order + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + order: + $ref: ../components/schemas/order.yaml diff --git a/docs/api/store/paths/products.yaml b/docs/api/store/paths/products.yaml new file mode 100644 index 0000000000..008dc45eae --- /dev/null +++ b/docs/api/store/paths/products.yaml @@ -0,0 +1,158 @@ +get: + operationId: GetProducts + summary: List Products + description: Retrieves a list of Products. + parameters: + - in: query + name: q + description: >- + Query used for searching products by title, description, variant's + title, variant's sku, and collection's title + schema: + type: string + - in: query + name: id + style: form + explode: false + description: product IDs to search for. + schema: + oneOf: + - type: string + - type: array + items: + type: string + - in: query + name: collection_id + style: form + explode: false + description: Collection IDs to search for + schema: + type: array + items: + type: string + - in: query + name: tags + style: form + explode: false + description: Tag IDs to search for + schema: + type: array + items: + type: string + - in: query + name: title + description: title to search for. + schema: + type: string + - in: query + name: description + description: description to search for. + schema: + type: string + - in: query + name: handle + description: handle to search for. + schema: + type: string + - in: query + name: is_giftcard + description: Search for giftcards using is_giftcard=true. + schema: + type: boolean + - in: query + name: type + description: type to search for. + schema: + type: string + - in: query + name: created_at + description: Date comparison for when resulting products were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting products were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + default: 100 + - in: query + name: expand + description: >- + (Comma separated) Which fields should be expanded in each order of the + result. + schema: + type: string + - in: query + name: fields + description: >- + (Comma separated) Which fields should be included in each order of the + result. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + products: + type: array + items: + $ref: ../components/schemas/product.yaml + count: + type: integer + description: The total number of items available + offset: + type: integer + description: The number of items skipped before these items + limit: + type: integer + description: The number of items per page diff --git a/docs/api/store/paths/products_search.yaml b/docs/api/store/paths/products_search.yaml new file mode 100644 index 0000000000..614fdbc630 --- /dev/null +++ b/docs/api/store/paths/products_search.yaml @@ -0,0 +1,35 @@ +get: + operationId: GetProductsSearch + summary: Search Products + description: Run a search query on products using the search engine installed on Medusa + parameters: + - in: query + name: q + required: true + description: The query to run the search with. + schema: + type: string + - in: query + name: offset + description: How many products to skip in the result. + schema: + type: integer + - in: query + name: limit + description: Limit the number of products returned. + schema: + type: integer + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + hits: + type: array + description: >- + Array of results. The format of the items depends on the + search engine installed on the server. diff --git a/docs/api/store/paths/products_{id}.yaml b/docs/api/store/paths/products_{id}.yaml new file mode 100644 index 0000000000..4e376e3315 --- /dev/null +++ b/docs/api/store/paths/products_{id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetProductsProduct + summary: Retrieves a Product + description: Retrieves a Product. + parameters: + - in: path + name: id + required: true + description: The id of the Product. + schema: + type: string + tags: + - Product + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + product: + $ref: ../components/schemas/product.yaml diff --git a/docs/api/store/paths/regions.yaml b/docs/api/store/paths/regions.yaml new file mode 100644 index 0000000000..d70a5a3a70 --- /dev/null +++ b/docs/api/store/paths/regions.yaml @@ -0,0 +1,74 @@ +get: + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. + parameters: + - in: query + name: offset + description: How many regions to skip in the result. + schema: + type: integer + default: 0 + - in: query + name: limit + description: Limit the number of regions returned. + schema: + type: integer + default: 100 + - in: query + name: created_at + description: Date comparison for when resulting regions were created. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + - in: query + name: updated_at + description: Date comparison for when resulting regions were updated. + schema: + type: object + properties: + lt: + type: string + description: filter by dates less than this date + format: date + gt: + type: string + description: filter by dates greater than this date + format: date + lte: + type: string + description: filter by dates less than or equal to this date + format: date + gte: + type: string + description: filter by dates greater than or equal to this date + format: date + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + regions: + type: array + items: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/store/paths/regions_{id}.yaml b/docs/api/store/paths/regions_{id}.yaml new file mode 100644 index 0000000000..b2a7c48a89 --- /dev/null +++ b/docs/api/store/paths/regions_{id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetRegionsRegion + summary: Retrieves a Region + description: Retrieves a Region. + parameters: + - in: path + name: id + required: true + description: The id of the Region. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: ../components/schemas/region.yaml diff --git a/docs/api/store/paths/return-reasons.yaml b/docs/api/store/paths/return-reasons.yaml new file mode 100644 index 0000000000..dfbe03397a --- /dev/null +++ b/docs/api/store/paths/return-reasons.yaml @@ -0,0 +1,17 @@ +get: + operationId: GetReturnReasons + summary: List Return Reasons + description: Retrieves a list of Return Reasons. + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reasons: + type: array + items: + $ref: ../components/schemas/return_reason.yaml diff --git a/docs/api/store/paths/return-reasons_{id}.yaml b/docs/api/store/paths/return-reasons_{id}.yaml new file mode 100644 index 0000000000..431029a501 --- /dev/null +++ b/docs/api/store/paths/return-reasons_{id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetReturnReasonsReason + summary: Retrieve a Return Reason + description: Retrieves a Return Reason. + parameters: + - in: path + name: id + required: true + description: The id of the Return Reason. + schema: + type: string + tags: + - Return Reason + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return_reason: + $ref: ../components/schemas/return_reason.yaml diff --git a/docs/api/store/paths/returns.yaml b/docs/api/store/paths/returns.yaml new file mode 100644 index 0000000000..e30279072b --- /dev/null +++ b/docs/api/store/paths/returns.yaml @@ -0,0 +1,60 @@ +post: + operationId: PostReturns + summary: Create Return + description: Creates a Return for an Order. + requestBody: + content: + application/json: + schema: + required: + - order_id + - items + properties: + order_id: + type: string + description: The ID of the Order to create the Return from. + items: + description: The items to include in the Return. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item from the Order. + type: string + quantity: + description: The quantity to return. + type: integer + reason_id: + description: The ID of the return reason. + type: string + note: + description: A note to add to the item returned. + type: string + return_shipping: + description: >- + If the Return is to be handled by the store operator the + Customer can choose a Return Shipping Method. Alternatvely the + Customer can handle the Return themselves. + type: object + required: + - option_id + properties: + option_id: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return: + $ref: ../components/schemas/return.yaml diff --git a/docs/api/store/paths/shipping-options.yaml b/docs/api/store/paths/shipping-options.yaml new file mode 100644 index 0000000000..66ca720e0b --- /dev/null +++ b/docs/api/store/paths/shipping-options.yaml @@ -0,0 +1,35 @@ +get: + operationId: GetShippingOptions + summary: Retrieve Shipping Options + description: Retrieves a list of Shipping Options. + parameters: + - in: query + name: is_return + description: >- + Whether return Shipping Options should be included. By default all + Shipping Options are returned. + schema: + type: boolean + - in: query + name: product_ids + description: A comma separated list of Product ids to filter Shipping Options by. + schema: + type: string + - in: query + name: region_id + description: the Region to retrieve Shipping Options from. + schema: + type: string + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_options: + type: array + items: + $ref: ../components/schemas/shipping_option.yaml diff --git a/docs/api/store/paths/shipping-options_{cart_id}.yaml b/docs/api/store/paths/shipping-options_{cart_id}.yaml new file mode 100644 index 0000000000..61172ac00e --- /dev/null +++ b/docs/api/store/paths/shipping-options_{cart_id}.yaml @@ -0,0 +1,24 @@ +get: + operationId: GetShippingOptionsCartId + summary: Retrieve Shipping Options for Cart + description: Retrieves a list of Shipping Options available to a cart. + parameters: + - in: path + name: cart_id + required: true + description: The id of the Cart. + schema: + type: string + tags: + - Shipping Option + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + shipping_options: + type: array + items: + $ref: ../components/schemas/shipping_option.yaml diff --git a/docs/api/store/paths/swaps.yaml b/docs/api/store/paths/swaps.yaml new file mode 100644 index 0000000000..e45b4b9296 --- /dev/null +++ b/docs/api/store/paths/swaps.yaml @@ -0,0 +1,68 @@ +post: + operationId: PostSwaps + summary: Create a Swap + description: >- + Creates a Swap on an Order by providing some items to return along with some + items to send back + requestBody: + content: + application/json: + schema: + required: + - order_id + - return_items + - additional_items + properties: + order_id: + type: string + description: The ID of the Order to create the Swap for. + return_items: + description: The items to include in the Return. + type: array + items: + required: + - item_id + - quantity + properties: + item_id: + description: The ID of the Line Item from the Order. + type: string + quantity: + description: The quantity to swap. + type: integer + reason_id: + description: The ID of the reason of this return. + type: string + note: + description: The note to add to the item being swapped. + type: string + return_shipping_option: + type: string + description: >- + The ID of the Shipping Option to create the Shipping Method + from. + additional_items: + description: The items to exchange the returned items to. + type: array + items: + required: + - variant_id + - quantity + properties: + variant_id: + description: The ID of the Product Variant to send. + type: string + quantity: + description: The quantity to send of the variant. + type: integer + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swap: + $ref: ../components/schemas/swap.yaml diff --git a/docs/api/store/paths/swaps_{cart_id}.yaml b/docs/api/store/paths/swaps_{cart_id}.yaml new file mode 100644 index 0000000000..f09da0dd81 --- /dev/null +++ b/docs/api/store/paths/swaps_{cart_id}.yaml @@ -0,0 +1,22 @@ +get: + operationId: GetSwapsSwapCartId + summary: Retrieve Swap by Cart id + description: Retrieves a Swap by the id of the Cart used to confirm the Swap. + parameters: + - in: path + name: cart_id + required: true + description: The id of the Cart + schema: + type: string + tags: + - Swap + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + swap: + $ref: ../components/schemas/swap.yaml diff --git a/docs/api/store/paths/variants.yaml b/docs/api/store/paths/variants.yaml new file mode 100644 index 0000000000..5274287ccd --- /dev/null +++ b/docs/api/store/paths/variants.yaml @@ -0,0 +1,77 @@ +get: + operationId: GetVariants + summary: Retrieve Product Variants + description: Retrieves a list of Product Variants + parameters: + - in: query + name: ids + description: A comma separated list of Product Variant ids to filter by. + schema: + type: string + - in: query + name: expand + description: A comma separated list of Product Variant relations to load. + schema: + type: string + - in: query + name: offset + description: How many product variants to skip in the result. + schema: + type: number + default: '0' + - in: query + name: limit + description: Maximum number of Product Variants to return. + schema: + type: number + default: '100' + - in: query + name: title + style: form + explode: false + description: product variant title to search for. + schema: + oneOf: + - type: string + description: a single title to search by + - type: array + description: multiple titles to search by + items: + type: string + - in: query + name: inventory_quantity + description: Filter by available inventory quantity + schema: + oneOf: + - type: number + description: a specific number to search by. + - type: object + description: search using less and greater than comparisons. + properties: + lt: + type: number + description: filter by inventory quantity less than this number + gt: + type: number + description: filter by inventory quantity greater than this number + lte: + type: number + description: filter by inventory quantity less than or equal to this number + gte: + type: number + description: >- + filter by inventory quantity greater than or equal to this + number + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variants: + type: array + items: + $ref: ../components/schemas/product_variant.yaml diff --git a/docs/api/store/paths/variants_{variant_id}.yaml b/docs/api/store/paths/variants_{variant_id}.yaml new file mode 100644 index 0000000000..842293367f --- /dev/null +++ b/docs/api/store/paths/variants_{variant_id}.yaml @@ -0,0 +1,42 @@ +get: + operationId: GetVariantsVariant + summary: Retrieve a Product Variant + description: Retrieves a Product Variant by id + parameters: + - in: path + name: variant_id + required: true + description: The id of the Product Variant. + schema: + type: string + - in: query + name: cart_id + description: The id of the Cart to set prices based on. + schema: + type: string + - in: query + name: region_id + description: The id of the Region to set prices based on. + schema: + type: string + - in: query + name: currency_code + style: form + explode: false + description: The 3 character ISO currency code to set prices based on. + schema: + type: string + externalDocs: + url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + description: See a list of codes. + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variant: + $ref: ../components/schemas/product_variant.yaml diff --git a/package.json b/package.json index de6d1d82fc..2574de68f7 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@babel/preset-env": "^7.11.5", "@babel/register": "^7.11.5", "@babel/runtime": "^7.11.2", + "@redocly/cli": "latest", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", "axios": "^0.21.1", @@ -67,6 +68,7 @@ "test:integration:api": "jest --config=integration-tests/jest.config.js --projects=integration-tests/api", "test:integration:plugins": "jest --config=integration-tests/jest.config.js --projects=integration-tests/plugins", "test:fixtures": "jest --config=docs-util/jest.config.js --runInBand", + "openapi:generate": "node ./scripts/build-openapi.js", "generate:services": "typedoc --options typedoc.services.js", "generate:js-client": "typedoc --options typedoc.js-client.js", "release:snapshot": "changeset publish --no-git-tags --snapshot --tag snapshot" diff --git a/packages/medusa-plugin-restock-notification/src/models/restock-notification.ts b/packages/medusa-plugin-restock-notification/src/models/restock-notification.ts index 16a4707063..76a5cd0aae 100644 --- a/packages/medusa-plugin-restock-notification/src/models/restock-notification.ts +++ b/packages/medusa-plugin-restock-notification/src/models/restock-notification.ts @@ -41,8 +41,10 @@ export class RestockNotification { * type: string * description: "The id of the variant that customers have signed up to be notified about," * emails: - * type: string[] * description: "The emails of customers who wish to be notified about restocks." + * type: array + * items: + * type: string * created_at: * type: string * format: date-time diff --git a/packages/medusa/src/api/routes/admin/apps/authorize-app.ts b/packages/medusa/src/api/routes/admin/apps/authorize-app.ts index e3d7f8974b..38634e9109 100644 --- a/packages/medusa/src/api/routes/admin/apps/authorize-app.ts +++ b/packages/medusa/src/api/routes/admin/apps/authorize-app.ts @@ -1,8 +1,10 @@ import { IsNotEmpty, IsString } from "class-validator" + import { OauthService } from "../../../../services" import { validator } from "../../../../utils/validator" + /** - * @oas [post] /apps + * @oas [post] /apps/authorizations * operationId: "PostApps" * summary: "Generates a token for an application." * description: "Generates a token for an application." @@ -26,7 +28,7 @@ import { validator } from "../../../../utils/validator" * type: string * description: The code for the generated token. * tags: - * - Apps + * - App * responses: * "200": * description: OK diff --git a/packages/medusa/src/api/routes/admin/apps/list.ts b/packages/medusa/src/api/routes/admin/apps/list.ts index 5e70595935..ab452a5f09 100644 --- a/packages/medusa/src/api/routes/admin/apps/list.ts +++ b/packages/medusa/src/api/routes/admin/apps/list.ts @@ -7,7 +7,7 @@ import { OauthService } from "../../../../services" * description: "Retrieve a list of applications." * x-authenticated: true * tags: - * - Apps + * - App * responses: * "200": * description: OK @@ -15,8 +15,10 @@ import { OauthService } from "../../../../services" * application/json: * schema: * properties: - * collection: - * $ref: "#/components/schemas/OAuth" + * apps: + * type: array + * items: + * $ref: "#/components/schemas/OAuth" */ export default async (req, res) => { const oauthService: OauthService = req.scope.resolve("oauthService") diff --git a/packages/medusa/src/api/routes/admin/auth/create-session.ts b/packages/medusa/src/api/routes/admin/auth/create-session.ts index 84911a684c..11fe81f142 100644 --- a/packages/medusa/src/api/routes/admin/auth/create-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/create-session.ts @@ -1,10 +1,11 @@ +import { IsEmail, IsNotEmpty, IsString } from "class-validator" + +import AuthService from "../../../../services/auth" +import { EntityManager } from "typeorm"; +import { MedusaError } from "medusa-core-utils" import _ from "lodash" import jwt from "jsonwebtoken" import { validator } from "../../../../utils/validator" -import { IsEmail, IsNotEmpty, IsString } from "class-validator" -import AuthService from "../../../../services/auth" -import { MedusaError } from "medusa-core-utils" -import { EntityManager } from "typeorm"; /** * @oas [post] /auth @@ -15,6 +16,22 @@ import { EntityManager } from "typeorm"; * parameters: * - (body) email=* {string} The User's email. * - (body) password=* {string} The User's password. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - email + * - password + * properties: + * email: + * type: string + * description: The User's email. + * format: email + * password: + * type: string + * description: The User's password. + * format: password * tags: * - Auth * responses: @@ -26,6 +43,8 @@ import { EntityManager } from "typeorm"; * properties: * user: * $ref: "#/components/schemas/user" + * "401": + * description: The user doesn't exist or the credentials are incorrect. */ export default async (req, res) => { const { projectConfig: { jwt_secret } } = req.scope.resolve('configModule') diff --git a/packages/medusa/src/api/routes/admin/auth/delete-session.ts b/packages/medusa/src/api/routes/admin/auth/delete-session.ts index 7988eab6af..8760fe1d3c 100644 --- a/packages/medusa/src/api/routes/admin/auth/delete-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/delete-session.ts @@ -1,5 +1,5 @@ /** - * @oas [get] /auth + * @oas [delete] /auth * operationId: "DeleteAuth" * summary: "Delete Session" * x-authenticated: true diff --git a/packages/medusa/src/api/routes/admin/auth/get-session.ts b/packages/medusa/src/api/routes/admin/auth/get-session.ts index ae024485ae..a694525fa0 100644 --- a/packages/medusa/src/api/routes/admin/auth/get-session.ts +++ b/packages/medusa/src/api/routes/admin/auth/get-session.ts @@ -1,5 +1,5 @@ -import _ from "lodash" import UserService from "../../../../services/user" +import _ from "lodash" /** * @oas [get] /auth @@ -18,6 +18,8 @@ import UserService from "../../../../services/user" * properties: * user: * $ref: "#/components/schemas/user" + * "400": + * description: An error occurred. */ export default async (req, res) => { try { diff --git a/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts index d42da29e5b..af582be151 100644 --- a/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/cancel-batch-job.ts @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Marks a batch job as canceled" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the batch job. + * - (path) id=* {string} The ID of the batch job. * tags: * - Batch Job * responses: diff --git a/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts index 8352327e1c..7601b105c6 100644 --- a/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/confirm-batch-job.ts @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Confirms that a previously requested batch job should be executed." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the batch job. + * - (path) id=* {string} The ID of the batch job. * tags: * - Batch Job * responses: @@ -17,11 +17,10 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * properties:x + * properties: * batch_job: * $ref: "#/components/schemas/batch_job" */ - export default async (req, res) => { let batch_job = req.batch_job diff --git a/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts index 81c70c2936..6eff9eb59e 100644 --- a/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/create-batch-job.ts @@ -1,8 +1,9 @@ import { IsBoolean, IsObject, IsOptional, IsString } from "class-validator" -import BatchJobService from "../../../../services/batch-job" -import { validator } from "../../../../utils/validator" + import { BatchJob } from "../../../../models" +import BatchJobService from "../../../../services/batch-job" import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" /** * @oas [post] /batch-jobs @@ -10,12 +11,43 @@ import { EntityManager } from "typeorm" * summary: "Create a Batch Job" * description: "Creates a Batch Job." * x-authenticated: true - * parameters: - * - (body) type=* {string} The type of batch job to start. - * - (body) context=* {string} Additional infomration regarding the batch to be used for processing. - * - (body) dry_run=* {boolean} Set a batch job in dry_run mode to get some information on what will be done without applying any modifications. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - type + * - context + * properties: + * type: + * type: string + * description: The type of batch job to start. + * example: product-export + * context: + * type: object + * description: Additional infomration regarding the batch to be used for processing. + * example: + * shape: + * prices: + * - region: null + * currency_code: "eur" + * dynamicImageColumnCount: 4 + * dynamicOptionColumnCount: 2 + * list_config: + * skip: 0 + * take: 50 + * order: + * created_at: "DESC" + * relations: + * - variants + * - variant.prices + * - images + * dry_run: + * type: boolean + * description: Set a batch job in dry_run mode to get some information on what will be done without applying any modifications. + * default: false * tags: - * - Customer + * - Batch Job * responses: * 201: * description: OK diff --git a/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts b/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts index 4bef63e026..2c16bccba9 100644 --- a/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts +++ b/packages/medusa/src/api/routes/admin/batch/get-batch-job.ts @@ -5,7 +5,7 @@ * description: "Retrieves a Batch Job." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Batch Job + * - (path) id=* {string} The ID of the Batch Job * tags: * - Batch Job * responses: diff --git a/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts b/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts index 48a138b8a1..d8a863dffb 100644 --- a/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts +++ b/packages/medusa/src/api/routes/admin/batch/list-batch-jobs.ts @@ -1,15 +1,11 @@ +import { IsArray, IsNumber, IsOptional, IsString } from "class-validator" import { Transform, Type } from "class-transformer" -import { - IsArray, - IsNumber, - IsOptional, - IsString, -} from "class-validator" -import { pickBy } from "lodash" + import BatchJobService from "../../../../services/batch-job" import { DateComparisonOperator } from "../../../../types/common" import { IsType } from "../../../../utils/validators/is-type" import { Request } from "express" +import { pickBy } from "lodash" /** * @oas [get] /batch-jobs @@ -18,20 +14,201 @@ import { Request } from "express" * description: "Retrieve a list of Batch Jobs." * x-authenticated: true * parameters: - * - (query) limit {string} The number of collections to return. - * - (query) offset {string} The offset of collections to return. - * - (query) type {string | string[]} Filter by the batch type - * - (query) confirmed_at {DateComparisonOperator | null} Date comparison for when resulting collections was confirmed, i.e. less than, greater than etc. - * - (query) pre_processed_at {DateComparisonOperator | null} Date comparison for when resulting collections was pre processed, i.e. less than, greater than etc. - * - (query) completed_at {DateComparisonOperator | null} Date comparison for when resulting collections was completed, i.e. less than, greater than etc. - * - (query) failed_at {DateComparisonOperator | null} Date comparison for when resulting collections was failed, i.e. less than, greater than etc. - * - (query) canceled_at {DateComparisonOperator | null} Date comparison for when resulting collections was canceled, i.e. less than, greater than etc. - * - (query) order {string} Order used when retrieving batch jobs - * - (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) deleted_at {DateComparisonOperator | null} Date comparison for when resulting collections was deleted, i.e. less than, greater than etc. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting collections was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting collections was updated, i.e. less than, greater than etc. + * - (query) limit=10 {integer} The number of batch jobs to return. + * - (query) offset=0 {integer} The number of batch jobs to skip before results. + * - in: query + * name: id + * style: form + * explode: false + * description: Filter by the batch ID + * schema: + * oneOf: + * - type: string + * description: batch job ID + * - type: array + * description: multiple batch job IDs + * items: + * type: string + * - in: query + * name: type + * style: form + * explode: false + * description: Filter by the batch type + * schema: + * type: array + * items: + * type: string + * - in: query + * name: confirmed_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was confirmed, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: pre_processed_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was pre processed, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: completed_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was completed, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: failed_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was failed, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: canceled_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was canceled, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - (query) order {string} Field used to order retrieved batch jobs + * - (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. + * - in: query + * name: created_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was created, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * style: form + * explode: false + * description: Date comparison for when resulting collections was updated, i.e. less than, greater than etc. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: * - Batch Job * responses: @@ -41,8 +218,19 @@ import { Request } from "express" * application/json: * schema: * properties: - * batch_job: - * $ref: "#/components/schemas/batch_job" + * batch_jobs: + * type: array + * items: + * $ref: "#/components/schemas/batch_job" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res) => { const batchService: BatchJobService = req.scope.resolve("batchJobService") diff --git a/packages/medusa/src/api/routes/admin/collections/add-products.ts b/packages/medusa/src/api/routes/admin/collections/add-products.ts index 4b883081c3..a7a859ef25 100644 --- a/packages/medusa/src/api/routes/admin/collections/add-products.ts +++ b/packages/medusa/src/api/routes/admin/collections/add-products.ts @@ -1,8 +1,9 @@ import { ArrayNotEmpty, IsString } from "class-validator" -import ProductCollectionService from "../../../../services/product-collection" import { Request, Response } from "express" import { EntityManager } from "typeorm"; +import ProductCollectionService from "../../../../services/product-collection" + /** * @oas [post] /collections/{id}/products/batch * operationId: "PostProductsToCollection" @@ -10,25 +11,31 @@ import { EntityManager } from "typeorm"; * description: "Updates products associated with a Product Collection" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Collection. + * - (path) id=* {string} The ID of the Collection. * requestBody: * content: * application/json: * schema: + * required: + * - product_ids * properties: * product_ids: * description: "An array of Product IDs to add to the Product Collection." * type: array * items: - * properties: - * id: - * description: "The ID of a Product to add to the Product Collection." - * type: string + * description: "The ID of a Product to add to the Product Collection." + * type: string * tags: * - Collection * responses: * "200": * description: OK + * content: + * application/json: + * schema: + * properties: + * collection: + * $ref: "#/components/schemas/product_collection" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/delete-collection.ts b/packages/medusa/src/api/routes/admin/collections/delete-collection.ts index 101466b29b..e31a668871 100644 --- a/packages/medusa/src/api/routes/admin/collections/delete-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/delete-collection.ts @@ -1,6 +1,7 @@ -import ProductCollectionService from "../../../../services/product-collection" import { Request, Response } from "express" + import { EntityManager } from "typeorm"; +import ProductCollectionService from "../../../../services/product-collection" /** * @oas [delete] /collections/{id} @@ -9,7 +10,7 @@ import { EntityManager } from "typeorm"; * description: "Deletes a Product Collection." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Collection. + * - (path) id=* {string} The ID of the Collection. * tags: * - Collection * responses: @@ -21,12 +22,15 @@ import { EntityManager } from "typeorm"; * properties: * id: * type: string - * description: The id of the deleted Collection + * description: The ID of the deleted Collection * object: * type: string * description: The type of the object that was deleted. + * default: product-collection * deleted: * type: boolean + * description: Whether the collection was deleted successfully or not. + * default: true */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/get-collection.ts b/packages/medusa/src/api/routes/admin/collections/get-collection.ts index 2b7c298808..76d47cac74 100644 --- a/packages/medusa/src/api/routes/admin/collections/get-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/get-collection.ts @@ -1,6 +1,7 @@ -import { defaultAdminCollectionsRelations } from "." -import ProductCollectionService from "../../../../services/product-collection" import { Request, Response } from "express" + +import ProductCollectionService from "../../../../services/product-collection" +import { defaultAdminCollectionsRelations } from "." /** * @oas [get] /collections/{id} * operationId: "GetCollectionsCollection" @@ -8,7 +9,7 @@ import { Request, Response } from "express" * description: "Retrieves a Product Collection." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product Collection + * - (path) id=* {string} The ID of the Product Collection * tags: * - Collection * responses: diff --git a/packages/medusa/src/api/routes/admin/collections/list-collections.ts b/packages/medusa/src/api/routes/admin/collections/list-collections.ts index 67550b2527..a25b1ec741 100644 --- a/packages/medusa/src/api/routes/admin/collections/list-collections.ts +++ b/packages/medusa/src/api/routes/admin/collections/list-collections.ts @@ -1,9 +1,10 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString, ValidateNested } from "class-validator" -import _, { identity } from "lodash" -import ProductCollectionService from "../../../../services/product-collection" -import { DateComparisonOperator } from "../../../../types/common" import { Request, Response } from "express" +import _, { identity } from "lodash" + +import { DateComparisonOperator } from "../../../../types/common" +import ProductCollectionService from "../../../../services/product-collection" +import { Type } from "class-transformer" /** * @oas [get] /collections @@ -12,13 +13,77 @@ import { Request, Response } from "express" * description: "Retrieve a list of Product Collection." * x-authenticated: true * parameters: - * - (query) limit {string} The number of collections to return. - * - (query) offset {string} The offset of collections to return. + * - (query) limit=10 {integer} The number of collections to return. + * - (query) offset=0 {integer} The number of collections to skip before the results. * - (query) title {string} The title of collections to return. * - (query) handle {string} The handle of collections to return. - * - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting collections was deleted, i.e. less than, greater than etc. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting collections was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting collections was updated, i.e. less than, greater than etc. + * - (query) q {string} a search term to search titles and handles. + * - in: query + * name: created_at + * description: Date comparison for when resulting collections were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting collections were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: deleted_at + * description: Date comparison for when resulting collections were deleted. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: * - Collection * responses: @@ -28,8 +93,19 @@ import { Request, Response } from "express" * application/json: * schema: * properties: - * collection: - * $ref: "#/components/schemas/product_collection" + * collections: + * type: array + * items: + * $ref: "#/components/schemas/product_collection" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res: Response) => { const productCollectionService: ProductCollectionService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/collections/remove-products.ts b/packages/medusa/src/api/routes/admin/collections/remove-products.ts index 79fe62c1b4..a2b155d541 100644 --- a/packages/medusa/src/api/routes/admin/collections/remove-products.ts +++ b/packages/medusa/src/api/routes/admin/collections/remove-products.ts @@ -1,8 +1,9 @@ import { ArrayNotEmpty, IsString } from "class-validator" -import ProductCollectionService from "../../../../services/product-collection" import { Request, Response } from "express" import { EntityManager } from "typeorm"; +import ProductCollectionService from "../../../../services/product-collection" + /** * @oas [delete] /collections/{id}/products/batch * operationId: "DeleteProductsFromCollection" @@ -10,25 +11,42 @@ import { EntityManager } from "typeorm"; * description: "Removes products associated with a Product Collection" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Collection. + * - (path) id=* {string} The ID of the Collection. * requestBody: * content: * application/json: * schema: + * required: + * - product_ids * properties: * product_ids: * description: "An array of Product IDs to remove from the Product Collection." * type: array * items: - * properties: - * id: - * description: "The ID of a Product to remove from the Product Collection." - * type: string + * description: "The ID of a Product to add to the Product Collection." + * type: string * tags: * - Collection * responses: * "200": * description: OK + * content: + * application/json: + * schema: + * properties: + * id: + * type: string + * description: "The ID of the collection" + * object: + * type: string + * description: "The type of object the removal was executed on" + * default: product-collection + * removed_products: + * description: "The IDs of the products removed from the collection" + * type: array + * items: + * description: "The ID of a Product to add to the Product Collection." + * type: string */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/collections/update-collection.ts b/packages/medusa/src/api/routes/admin/collections/update-collection.ts index 95fd59f9a7..84a3c020d1 100644 --- a/packages/medusa/src/api/routes/admin/collections/update-collection.ts +++ b/packages/medusa/src/api/routes/admin/collections/update-collection.ts @@ -1,7 +1,9 @@ import { IsObject, IsOptional, IsString } from "class-validator" -import ProductCollectionService from "../../../../services/product-collection" import { Request, Response } from "express" + import { EntityManager } from "typeorm"; +import ProductCollectionService from "../../../../services/product-collection" + /** * @oas [post] /collections/{id} * operationId: "PostCollectionsCollection" @@ -9,7 +11,7 @@ import { EntityManager } from "typeorm"; * description: "Updates a Product Collection." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Collection. + * - (path) id=* {string} The ID of the Collection. * requestBody: * content: * application/json: diff --git a/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts b/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts index dcdf5a0090..4727317073 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts @@ -1,10 +1,11 @@ -import { Type } from "class-transformer" -import { ValidateNested } from "class-validator" +import { Request, Response } from "express" + import { CustomerGroupService } from "../../../../services" import { CustomerGroupsBatchCustomer } from "../../../../types/customer-groups" -import { validator } from "../../../../utils/validator" -import { Request, Response } from "express" import { EntityManager } from "typeorm" +import { Type } from "class-transformer" +import { ValidateNested } from "class-validator" +import { validator } from "../../../../utils/validator" /** * @oas [post] /customer-groups/{id}/customers/batch @@ -13,10 +14,26 @@ import { EntityManager } from "typeorm" * description: "Adds a list of customers, represented by id's, to a customer group." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the customer group. - * - (body) customers=* {{id: string }[]} ids of the customers to add + * - (path) id=* {string} The ID of the customer group. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - customer_ids + * properties: + * customer_ids: + * description: "The ids of the customers to add" + * type: array + * items: + * required: + * - id + * properties: + * id: + * description: ID of the customer + * type: string * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK @@ -24,8 +41,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * customerGroup: - * $ref: "#/components/schemas/customergroup" + * customer_group: + * $ref: "#/components/schemas/customer_group" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts index 6d0b9b292c..bec19a5376 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/create-customer-group.ts @@ -1,8 +1,9 @@ import { IsObject, IsOptional, IsString } from "class-validator" -import { CustomerGroupService } from "../../../../services" -import { validator } from "../../../../utils/validator" import { Request, Response } from "express" + +import { CustomerGroupService } from "../../../../services" import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" /** * @oas [post] /customer-groups @@ -14,7 +15,7 @@ import { EntityManager } from "typeorm" * - (body) name=* {string} Name of the customer group * - (body) metadata {object} Metadata for the customer. * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts index 05015b984b..495f2edb70 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/delete-customer-group.ts @@ -1,5 +1,6 @@ -import { CustomerGroupService } from "../../../../services" import { Request, Response } from "express" + +import { CustomerGroupService } from "../../../../services" import { EntityManager } from "typeorm" /** @@ -9,9 +10,9 @@ import { EntityManager } from "typeorm" * description: "Deletes a CustomerGroup." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Customer Group + * - (path) id=* {string} The ID of the Customer Group * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK @@ -21,12 +22,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted customer group. + * description: The ID of the deleted customer group. * object: * type: string * description: The type of the object that was deleted. + * default: customer_group * deleted: * type: boolean + * description: Whether the customer group was deleted successfully or not. + * default: true */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts b/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts index 658518bb78..edfcf63327 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/delete-customers-batch.ts @@ -1,10 +1,11 @@ -import { Type } from "class-transformer" -import { ValidateNested } from "class-validator" +import { Request, Response } from "express" + import { CustomerGroupService } from "../../../../services" import { CustomerGroupsBatchCustomer } from "../../../../types/customer-groups" -import { validator } from "../../../../utils/validator" -import { Request, Response } from "express" import { EntityManager } from "typeorm" +import { Type } from "class-transformer" +import { ValidateNested } from "class-validator" +import { validator } from "../../../../utils/validator" /** * @oas [delete] /customer-groups/{id}/customers/batch @@ -13,10 +14,26 @@ import { EntityManager } from "typeorm" * description: "Removes a list of customers, represented by id's, from a customer group." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the customer group. - * - (body) customers=* {{id: string }[]} ids of the customers to remove + * - (path) id=* {string} The ID of the customer group. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - customer_ids + * properties: + * customer_ids: + * description: "The ids of the customers to remove" + * type: array + * items: + * required: + * - id + * properties: + * id: + * description: ID of the customer + * type: string * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK @@ -24,8 +41,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * customerGroup: - * $ref: "#/components/schemas/customergroup" + * customer_group: + * $ref: "#/components/schemas/customer_group" */ export default async (req: Request, res: Response) => { diff --git a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts index 265a81f490..43ea70b869 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts @@ -1,14 +1,17 @@ -import CustomerController from "../../../../controllers/customers" import { Request, Response } from "express" +import CustomerController from "../../../../controllers/customers" + /** * @oas [get] /customer-groups/{id}/customers * operationId: "GetCustomerGroupsGroupCustomers" * summary: "List Customers" - * description: "Retrieves a list of Customers." + * description: "Retrieves a list of customers in a customer group" * x-authenticated: true + * parameters: + * - (path) id=* {string} The ID of the customer group. * tags: - * - Customer + * - Customer Group * responses: * 200: * description: OK @@ -16,8 +19,19 @@ import { Request, Response } from "express" * application/json: * schema: * properties: - * customer: - * $ref: "#/components/schemas/customer" + * customers: + * type: array + * items: + * $ref: "#/components/schemas/customer" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts index 764b9b752b..ef355ad106 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/get-customer-group.ts @@ -1,6 +1,7 @@ +import { Request, Response } from "express" + import { CustomerGroupService } from "../../../../services" import { FindParams } from "../../../../types/common" -import { Request, Response } from "express" /** * @oas [get] /customer-groups/{id} @@ -9,9 +10,11 @@ import { Request, Response } from "express" * description: "Retrieves a Customer Group." * x-authenticated: true * parameters: - * - (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) fields {string} (Comma separated) Which fields should be included in the customer group. * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts b/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts index 130460524e..b0ce19e49e 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/list-customer-groups.ts @@ -1,8 +1,9 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString } from "class-validator" +import { Request, Response } from "express" + import { CustomerGroupService } from "../../../../services" import { FilterableCustomerGroupProps } from "../../../../types/customer-groups" -import { Request, Response } from "express" +import { Type } from "class-transformer" /** * @oas [get] /customer-groups @@ -11,18 +12,96 @@ import { Request, Response } from "express" * description: "Retrieve a list of customer groups." * x-authenticated: true * parameters: - * - (query) q {string} Query used for searching user group names. - * - (query) offset {string} How many groups to skip in the result. - * - (query) id {string} Ids of the groups to search for. - * - (query) order {string} to retrieve customer groups in. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting customer group was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting ustomer group was updated, i.e. less than, greater than etc. - * - (query) offset {string} How many customer groups to skip in the result. - * - (query) limit {string} Limit the number of customer groups returned. + * - (query) q {string} Query used for searching customer group names. + * - (query) offset=0 {integer} How many groups to skip in the result. + * - (query) order {string} the field used to order the customer groups. + * - in: query + * name: id + * style: form + * explode: false + * description: Filter by the customer group ID + * schema: + * oneOf: + * - type: string + * description: customer group ID + * - type: array + * description: multiple customer group IDs + * items: + * type: string + * - type: object + * properties: + * lt: + * type: string + * description: filter by IDs less than this ID + * gt: + * type: string + * description: filter by IDs greater than this ID + * lte: + * type: string + * description: filter by IDs less than or equal to this ID + * gte: + * type: string + * description: filter by IDs greater than or equal to this ID + * - in: query + * name: name + * style: form + * explode: false + * description: Filter by the customer group name + * schema: + * type: array + * description: multiple customer group names + * items: + * type: string + * description: customer group name + * - in: query + * name: created_at + * description: Date comparison for when resulting customer groups were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting customer groups were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - (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. * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK @@ -30,8 +109,19 @@ import { Request, Response } from "express" * application/json: * schema: * properties: - * customerGroup: - * $ref: "#/components/schemas/customer_group" + * customer_groups: + * type: array + * items: + * $ref: "#/components/schemas/customer_group" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res: Response) => { const customerGroupService: CustomerGroupService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts b/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts index d985389be4..54313279ff 100644 --- a/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts +++ b/packages/medusa/src/api/routes/admin/customer-groups/update-customer-group.ts @@ -1,11 +1,11 @@ import { IsObject, IsOptional, IsString } from "class-validator" -import { defaultAdminCustomerGroupsRelations } from "." +import { Request, Response } from "express" import { CustomerGroupService } from "../../../../services" -import { FindParams } from "../../../../types/common" -import { validator } from "../../../../utils/validator" -import { Request, Response } from "express" import { EntityManager } from "typeorm" +import { FindParams } from "../../../../types/common" +import { defaultAdminCustomerGroupsRelations } from "." +import { validator } from "../../../../utils/validator" /** * @oas [post] /customer-groups/{id} @@ -14,11 +14,20 @@ import { EntityManager } from "typeorm" * description: "Update a CustomerGroup." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the customer group. - * - (body) name=* {string} Name of the customer group - * - (body) metadata {object} Metadata for the customer. + * - (path) id=* {string} The ID of the customer group. + * requestBody: + * content: + * application/json: + * schema: + * properties: + * name: + * description: "Name of the customer group" + * type: string + * metadata: + * description: "Metadata for the customer." + * type: object * tags: - * - CustomerGroup + * - Customer Group * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/customers/create-customer.ts b/packages/medusa/src/api/routes/admin/customers/create-customer.ts index 3ffe0d8adf..e26d2a6117 100644 --- a/packages/medusa/src/api/routes/admin/customers/create-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/create-customer.ts @@ -1,4 +1,5 @@ import { IsEmail, IsObject, IsOptional, IsString } from "class-validator" + import { CustomerService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -9,16 +10,40 @@ import { EntityManager } from "typeorm" * summary: "Create a Customer" * description: "Creates a Customer." * x-authenticated: true - * parameters: - * - (body) email=* {string} The Customer's email address. - * - (body) first_name=* {string} The Customer's first name. - * - (body) last_name=* {string} The Customer's last name. - * - (body) phone {string} The Customer's phone number. - * - (body) metadata {object} Metadata for the customer. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - email + * - first_name + * - last_name + * - password + * properties: + * email: + * type: string + * description: The customer's email. + * format: email + * first_name: + * type: string + * description: The customer's first name. + * last_name: + * type: string + * description: The customer's last name. + * password: + * type: string + * description: The customer's password. + * format: password + * phone: + * type: string + * description: The customer's phone number. + * metadata: + * description: An optional set of key-value pairs to hold additional information. + * type: object * tags: * - Customer * responses: - * 200: + * 201: * description: OK * content: * application/json: diff --git a/packages/medusa/src/api/routes/admin/customers/get-customer.ts b/packages/medusa/src/api/routes/admin/customers/get-customer.ts index fe6eb0c085..d388b1a884 100644 --- a/packages/medusa/src/api/routes/admin/customers/get-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/get-customer.ts @@ -1,6 +1,6 @@ -import { defaultAdminCustomersRelations } from "." import CustomerService from "../../../../services/customer" import { FindParams } from "../../../../types/common" +import { defaultAdminCustomersRelations } from "." import { validator } from "../../../../utils/validator" /** @@ -10,7 +10,9 @@ import { validator } from "../../../../utils/validator" * description: "Retrieves a Customer." * x-authenticated: true * parameters: - * - (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) fields {string} (Comma separated) Which fields should be included in the customer. * tags: * - Customer * responses: diff --git a/packages/medusa/src/api/routes/admin/customers/list-customers.ts b/packages/medusa/src/api/routes/admin/customers/list-customers.ts index 663912d7f0..896b6a1932 100644 --- a/packages/medusa/src/api/routes/admin/customers/list-customers.ts +++ b/packages/medusa/src/api/routes/admin/customers/list-customers.ts @@ -1,13 +1,21 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString } from "class-validator" -import customerController from "../../../../controllers/customers" + import { AdminListCustomerSelector } from "../../../../types/customers" +import { Type } from "class-transformer" +import customerController from "../../../../controllers/customers" + /** * @oas [get] /customers * operationId: "GetCustomers" * summary: "List Customers" * description: "Retrieves a list of Customers." * x-authenticated: true + * parameters: + * - (query) limit=50 {integer} The number of items to return. + * - (query) offset=0 {integer} The items to skip before result. + * - (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) groups[] {string} group IDs to search customers by. * tags: * - Customer * responses: @@ -17,8 +25,19 @@ import { AdminListCustomerSelector } from "../../../../types/customers" * application/json: * schema: * properties: - * customer: - * $ref: "#/components/schemas/customer" + * customers: + * type: array + * items: + * $ref: "#/components/schemas/customer" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const result = await customerController.listAndCount( diff --git a/packages/medusa/src/api/routes/admin/customers/update-customer.ts b/packages/medusa/src/api/routes/admin/customers/update-customer.ts index 369fec61c8..975d6e93f2 100644 --- a/packages/medusa/src/api/routes/admin/customers/update-customer.ts +++ b/packages/medusa/src/api/routes/admin/customers/update-customer.ts @@ -6,13 +6,14 @@ import { IsString, ValidateNested, } from "class-validator" -import { MedusaError } from "medusa-core-utils" + import CustomerService from "../../../../services/customer" -import { validator } from "../../../../utils/validator" -import { defaultAdminCustomersRelations } from "." -import { Type } from "class-transformer" -import { FindParams } from "../../../../types/common" import { EntityManager } from "typeorm" +import { FindParams } from "../../../../types/common" +import { MedusaError } from "medusa-core-utils" +import { Type } from "class-transformer" +import { defaultAdminCustomersRelations } from "." +import { validator } from "../../../../utils/validator" /** * @oas [post] /customers/{id} @@ -21,7 +22,9 @@ import { EntityManager } from "typeorm" * description: "Updates a Customer." * x-authenticated: true * parameters: - * - (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 each customer. + * - (query) fields {string} (Comma separated) Which fields should be retrieved in each customer. * requestBody: * content: * application/json: @@ -29,7 +32,8 @@ import { EntityManager } from "typeorm" * properties: * email: * type: string - * description: The Customer's email. Only providable if user not registered. + * description: The Customer's email. + * format: email * first_name: * type: string * description: The Customer's first name. @@ -42,19 +46,20 @@ import { EntityManager } from "typeorm" * password: * type: string * description: The Customer's password. + * format: password * groups: * type: array - * description: A list of customer groups to which the customer belongs. * items: * required: * - id * properties: * id: - * description: The id of a customer group + * description: The ID of a customer group * type: string + * description: A list of customer groups to which the customer belongs. * metadata: + * description: An optional set of key-value pairs to hold additional information. * type: object - * description: Metadata for the customer. * tags: * - Customer * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/add-region.ts b/packages/medusa/src/api/routes/admin/discounts/add-region.ts index 0e89eba395..226f35e95e 100644 --- a/packages/medusa/src/api/routes/admin/discounts/add-region.ts +++ b/packages/medusa/src/api/routes/admin/discounts/add-region.ts @@ -1,7 +1,9 @@ import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + import { Discount } from "../../../.." import DiscountService from "../../../../services/discount" import { EntityManager } from "typeorm" + /** * @oas [post] /discounts/{id}/regions/{region_id} * operationId: "PostDiscountsDiscountRegionsRegion" @@ -9,8 +11,8 @@ import { EntityManager } from "typeorm" * description: "Adds a Region to the list of Regions that a Discount can be used in." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount. - * - (path) region_id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Discount. + * - (path) region_id=* {string} The ID of the Region. * tags: * - Discount * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/create-condition.ts b/packages/medusa/src/api/routes/admin/discounts/create-condition.ts index 7ca4018c16..f906e47882 100644 --- a/packages/medusa/src/api/routes/admin/discounts/create-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/create-condition.ts @@ -1,19 +1,21 @@ +import { Discount, DiscountConditionOperator } from "../../../../models" import { IsOptional, IsString } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." -import { Discount, DiscountConditionOperator } from "../../../../models" -import { DiscountService } from "../../../../services" -import DiscountConditionService from "../../../../services/discount-condition" + import { AdminUpsertConditionsReq } from "../../../../types/discount" +import DiscountConditionService from "../../../../services/discount-condition" +import { DiscountService } from "../../../../services" +import { EntityManager } from "typeorm" import { getRetrieveConfig } from "../../../../utils/get-query-config" import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" + /** * @oas [post] /discounts/{discount_id}/conditions * operationId: "PostDiscountsDiscountConditions" - * summary: "Creates a DiscountCondition" + * summary: "Creates a DiscountCondition. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided." * x-authenticated: true * parameters: - * - (path) discount_id=* {string} The id of the Product. + * - (path) discount_id=* {string} The ID of the Product. * - (query) expand {string} (Comma separated) Which fields should be expanded in each product of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each product of the result. * description: "Creates a DiscountCondition" @@ -21,29 +23,41 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: + * required: + * - operator * properties: * operator: * description: Operator of the condition * type: string - * items: - * properties: - * products: - * type: array - * description: list of products - * product_types: - * type: array - * description: list of product types - * product_collections: - * type: array - * description: list of product collections - * product_tags: - * type: array - * description: list of product tags - * customer_groups: - * type: array - * description: list of customer_groups + * enum: [in, not_in] + * products: + * type: array + * description: list of product IDs if the condition is applied on products. + * items: + * type: string + * product_types: + * type: array + * description: list of product type IDs if the condition is applied on product types. + * items: + * type: string + * product_collections: + * type: array + * description: list of product collection IDs if the condition is applied on product collections. + * items: + * type: string + * product_tags: + * type: array + * description: list of product tag IDs if the condition is applied on product tags. + * items: + * type: string + * customer_groups: + * type: array + * description: list of customer group IDs if the condition is applied on customer groups. + * items: + * type: string + * tags: - * - Discount + * - Discount Condition * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/discounts/create-discount.ts b/packages/medusa/src/api/routes/admin/discounts/create-discount.ts index dc37984ff2..bbf84f8305 100644 --- a/packages/medusa/src/api/routes/admin/discounts/create-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/create-discount.ts @@ -1,4 +1,9 @@ -import { Type } from "class-transformer" +import { + AllocationType, + Discount, + DiscountConditionOperator, + DiscountRuleType, +} from "../../../../models" import { IsArray, IsBoolean, @@ -13,47 +18,104 @@ import { ValidateNested, } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." -import { - AllocationType, - DiscountRuleType, - Discount, - DiscountConditionOperator, -} from "../../../../models" -import DiscountService from "../../../../services/discount" + +import { AdminPostDiscountsDiscountParams } from "./update-discount" import { AdminUpsertConditionsReq } from "../../../../types/discount" -import { getRetrieveConfig } from "../../../../utils/get-query-config" -import { validator } from "../../../../utils/validator" +import DiscountService from "../../../../services/discount" +import { EntityManager } from "typeorm" import { IsGreaterThan } from "../../../../utils/validators/greater-than" import { IsISO8601Duration } from "../../../../utils/validators/iso8601-duration" -import { AdminPostDiscountsDiscountParams } from "./update-discount" -import { EntityManager } from "typeorm" +import { Type } from "class-transformer" +import { getRetrieveConfig } from "../../../../utils/get-query-config" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /discounts * operationId: "PostDiscounts" * summary: "Creates a Discount" * x-authenticated: true * description: "Creates a Discount with a given set of rules that define how the Discount behaves." + * parameters: + * - (query) expand {string} (Comma separated) Which fields should be expanded in each customer. + * - (query) fields {string} (Comma separated) Which fields should be retrieved in each customer. * requestBody: * content: * application/json: - * required: - * - code - * - rule * schema: + * required: + * - code + * - rule * properties: * code: * type: string * description: A unique code that will be used to redeem the Discount * is_dynamic: - * type: string + * type: boolean * description: Whether the Discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated codes that all have to follow a common set of rules. + * default: false * rule: * description: The Discount Rule that defines how Discounts are calculated - * oneOf: - * - $ref: "#/components/schemas/discount_rule" + * type: object + * required: + * - type + * - value + * - allocation + * properties: + * description: + * type: string + * description: "A short description of the discount" + * type: + * type: string + * description: "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers." + * enum: [fixed, percentage, free_shipping] + * value: + * type: number + * description: "The value that the discount represents; this will depend on the type of the discount" + * allocation: + * type: string + * description: "The scope that the discount should apply to." + * enum: [total, item] + * conditions: + * type: array + * description: "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided." + * items: + * type: object + * required: + * - operator + * properties: + * operator: + * type: string + * description: Operator of the condition + * enum: [in, not_in] + * products: + * type: array + * description: list of product IDs if the condition is applied on products. + * items: + * type: string + * product_types: + * type: array + * description: list of product type IDs if the condition is applied on product types. + * items: + * type: string + * product_collections: + * type: array + * description: list of product collection IDs if the condition is applied on product collections. + * items: + * type: string + * product_tags: + * type: array + * description: list of product tag IDs if the condition is applied on product tags. + * items: + * type: string + * customer_groups: + * type: array + * description: list of customer group IDs if the condition is applied on customer groups. + * items: + * type: string * is_disabled: * type: boolean * description: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. + * default: false * starts_at: * type: string * format: date-time @@ -62,6 +124,10 @@ import { EntityManager } from "typeorm" * type: string * format: date-time * description: The time at which the Discount should no longer be available. + * valid_duration: + * type: string + * description: Duration the discount runs between + * example: P3Y6M4DT12H30M5S * regions: * description: A list of Region ids representing the Regions in which the Discount can be used. * type: array diff --git a/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts b/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts index 042b0df4b0..5dabee0b00 100644 --- a/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts +++ b/packages/medusa/src/api/routes/admin/discounts/create-dynamic-code.ts @@ -6,9 +6,11 @@ import { IsString, } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + import DiscountService from "../../../../services/discount" -import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /discounts/{id}/dynamic-codes * operationId: "PostDiscountsDiscountDynamicCodes" @@ -16,9 +18,9 @@ import { EntityManager } from "typeorm" * description: "Creates a unique code that can map to a parent Discount. This is useful if you want to automatically generate codes with the same behaviour." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount to create the dynamic code from." + * - (path) id=* {string} The ID of the Discount to create the dynamic code from." * - (body) code=* {string} The unique code that will be used to redeem the Discount. - * - (body) usage_limit=* {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. * tags: * - Discount diff --git a/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts b/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts index 34e92e03cd..bc0a119dd4 100644 --- a/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/delete-condition.ts @@ -1,12 +1,13 @@ import { IsOptional, IsString } from "class-validator" -import { MedusaError } from "medusa-core-utils" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + import { Discount } from "../../../../models" -import { DiscountService } from "../../../../services" import DiscountConditionService from "../../../../services/discount-condition" +import { DiscountService } from "../../../../services" +import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" import { getRetrieveConfig } from "../../../../utils/get-query-config" import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" /** * @oas [delete] /discounts/{discount_id}/conditions/{condition_id} @@ -15,10 +16,12 @@ import { EntityManager } from "typeorm" * description: "Deletes a DiscountCondition" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount - * - (path) condition_id=* {string} The id of the DiscountCondition + * - (path) discount_id=* {string} The ID of the Discount + * - (path) condition_id=* {string} The ID of the DiscountCondition + * - (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. * tags: - * - Discount + * - Discount Condition * responses: * 200: * description: OK @@ -28,15 +31,18 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted DiscountCondition + * description: The ID of the deleted DiscountCondition * object: * type: string * description: The type of the object that was deleted. + * default: discount-condition * deleted: * type: boolean + * description: Whether the discount condition was deleted successfully or not. + * default: true * discount: - * type: object * description: The Discount to which the condition used to belong + * $ref: "#/components/schemas/discount" */ export default async (req, res) => { const { discount_id, condition_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts b/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts index c3fd605d4e..04100d530b 100644 --- a/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/delete-discount.ts @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Discount." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount + * - (path) id=* {string} The ID of the Discount * tags: * - Discount * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Discount + * description: The ID of the deleted Discount * object: * type: string * description: The type of the object that was deleted. + * default: discount * deleted: * type: boolean + * description: Whether the discount was deleted successfully or not. + * default: true */ export default async (req, res) => { const { discount_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts b/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts index 1f0ecc8ce4..8e4b62e7b6 100644 --- a/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts +++ b/packages/medusa/src/api/routes/admin/discounts/delete-dynamic-code.ts @@ -1,4 +1,5 @@ import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + import DiscountService from "../../../../services/discount" import { EntityManager } from "typeorm" @@ -9,8 +10,8 @@ import { EntityManager } from "typeorm" * description: "Deletes a dynamic code from a Discount." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount - * - (path) code=* {string} The id of the Discount + * - (path) id=* {string} The ID of the Discount + * - (path) code=* {string} The ID of the Discount * tags: * - Discount * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/get-condition.ts b/packages/medusa/src/api/routes/admin/discounts/get-condition.ts index 3946da6abb..687a42bcea 100644 --- a/packages/medusa/src/api/routes/admin/discounts/get-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/get-condition.ts @@ -1,29 +1,30 @@ import { IsOptional, IsString } from "class-validator" -import { MedusaError } from "medusa-core-utils" import { defaultAdminDiscountConditionFields, defaultAdminDiscountConditionRelations, } from "." + import { DiscountCondition } from "../../../../models" -import { DiscountService } from "../../../../services" import DiscountConditionService from "../../../../services/discount-condition" +import { DiscountService } from "../../../../services" +import { MedusaError } from "medusa-core-utils" import { getRetrieveConfig } from "../../../../utils/get-query-config" import { validator } from "../../../../utils/validator" + /** * @oas [get] /discounts/{discount_id}/conditions/{condition_id} * operationId: "GetDiscountsDiscountConditionsCondition" * summary: "Gets a DiscountCondition" * x-authenticated: true * parameters: - * - (path) discount_id=* {string} The id of the Discount. - * - (path) condition_id=* {string} The id of the DiscountCondition. - * query: - * - (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. + * - (path) discount_id=* {string} The ID of the Discount. + * - (path) condition_id=* {string} The ID of the DiscountCondition. + * - (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. * description: "Gets a DiscountCondition" * tags: - * - DiscountCondition + * - Discount Condition * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts b/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts index 98a9894077..160479a6c9 100644 --- a/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts +++ b/packages/medusa/src/api/routes/admin/discounts/get-discount-by-code.ts @@ -1,5 +1,6 @@ import { IsOptional, IsString } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + import { Discount } from "../../../../models" import DiscountService from "../../../../services/discount" import { getRetrieveConfig } from "../../../../utils/get-query-config" @@ -12,6 +13,8 @@ import { validator } from "../../../../utils/validator" * x-authenticated: true * parameters: * - (path) code=* {string} The code of the Discount + * - (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. * tags: * - Discount * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/get-discount.ts b/packages/medusa/src/api/routes/admin/discounts/get-discount.ts index 2bcca52cb6..a410999366 100644 --- a/packages/medusa/src/api/routes/admin/discounts/get-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/get-discount.ts @@ -1,5 +1,6 @@ import { IsOptional, IsString } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + import { Discount } from "../../../.." import DiscountService from "../../../../services/discount" import { getRetrieveConfig } from "../../../../utils/get-query-config" @@ -11,10 +12,9 @@ import { validator } from "../../../../utils/validator" * description: "Retrieves a Discount" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount - * query: - * - (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. + * - (path) id=* {string} The ID of the Discount + * - (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. * tags: * - Discount * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts b/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts index 3c46eb8fc9..9fc7a351ce 100644 --- a/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts +++ b/packages/medusa/src/api/routes/admin/discounts/list-discounts.ts @@ -1,4 +1,3 @@ -import { Transform, Type } from "class-transformer" import { IsBoolean, IsInt, @@ -6,13 +5,16 @@ import { IsString, ValidateNested, } from "class-validator" +import { Transform, Type } from "class-transformer" import _, { pickBy } from "lodash" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + +import { AdminGetDiscountsDiscountRuleParams } from "../../../../types/discount" import { Discount } from "../../../.." import DiscountService from "../../../../services/discount" import { FindConfig } from "../../../../types/common" -import { AdminGetDiscountsDiscountRuleParams } from "../../../../types/discount" import { validator } from "../../../../utils/validator" + /** * @oas [get] /discounts * operationId: "GetDiscounts" @@ -20,11 +22,25 @@ import { validator } from "../../../../utils/validator" * x-authenticated: true * description: "Retrieves a list of Discounts" * parameters: - * - (query) q {string} Search query applied on results. + * - (query) q {string} Search query applied on the code field. + * - in: query + * name: rule + * description: Discount Rules filters to apply on the search + * schema: + * type: object + * properties: + * type: + * type: string + * enum: [fixed, percentage, free_shipping] + * description: "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers." + * allocation: + * type: string + * enum: [total, item] + * description: "The value that the discount represents; this will depend on the type of the discount" * - (query) is_dynamic {boolean} Return only dynamic discounts. * - (query) is_disabled {boolean} Return only disabled discounts. - * - (query) limit {number} The number of items in the response - * - (query) offset {number} The offset of items in response + * - (query) limit=20 {number} The number of items in the response + * - (query) offset=0 {number} The offset of items in response * - (query) expand {string} Comma separated list of relations to include in the results. * tags: * - Discount @@ -35,8 +51,19 @@ import { validator } from "../../../../utils/validator" * application/json: * schema: * properties: - * discount: - * $ref: "#/components/schemas/discount" + * discounts: + * type: array + * items: + * $ref: "#/components/schemas/discount" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(AdminGetDiscountsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/discounts/remove-region.ts b/packages/medusa/src/api/routes/admin/discounts/remove-region.ts index a4baaea2de..a273fdc1c2 100644 --- a/packages/medusa/src/api/routes/admin/discounts/remove-region.ts +++ b/packages/medusa/src/api/routes/admin/discounts/remove-region.ts @@ -1,6 +1,8 @@ -import DiscountService from "../../../../services/discount" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." + +import DiscountService from "../../../../services/discount" import { EntityManager } from "typeorm" + /** * @oas [delete] /discounts/{id}/regions/{region_id} * operationId: "DeleteDiscountsDiscountRegionsRegion" @@ -8,8 +10,8 @@ import { EntityManager } from "typeorm" * x-authenticated: true * description: "Removes a Region from the list of Regions that a Discount can be used in." * parameters: - * - (path) id=* {string} The id of the Discount. - * - (path) region_id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Discount. + * - (path) region_id=* {string} The ID of the Region. * tags: * - Discount * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/update-condition.ts b/packages/medusa/src/api/routes/admin/discounts/update-condition.ts index 5b1c88851b..9b8d218e57 100644 --- a/packages/medusa/src/api/routes/admin/discounts/update-condition.ts +++ b/packages/medusa/src/api/routes/admin/discounts/update-condition.ts @@ -1,46 +1,55 @@ import { IsOptional, IsString } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." -import { Discount } from "../../../../models" -import { DiscountService } from "../../../../services" -import DiscountConditionService from "../../../../services/discount-condition" + import { AdminUpsertConditionsReq } from "../../../../types/discount" +import { Discount } from "../../../../models" +import DiscountConditionService from "../../../../services/discount-condition" +import { DiscountService } from "../../../../services" +import { EntityManager } from "typeorm" import { getRetrieveConfig } from "../../../../utils/get-query-config" import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" + /** * @oas [post] /discounts/{discount_id}/conditions/{condition_id} * operationId: "PostDiscountsDiscountConditionsCondition" - * summary: "Updates a DiscountCondition" + * summary: "Updates a DiscountCondition. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided." * x-authenticated: true * parameters: - * - (path) discount_id=* {string} The id of the Product. - * - (query) expand {string} (Comma separated) Which fields should be expanded in each product of the result. - * - (query) fields {string} (Comma separated) Which fields should be included in each product of the result. + * - (path) discount_id=* {string} The ID of the Product. + * - (path) condition_id=* {string} The ID of the DiscountCondition. + * - (query) expand {string} (Comma separated) Which fields should be expanded in each item of the result. + * - (query) fields {string} (Comma separated) Which fields should be included in each item of the result. * description: "Updates a DiscountCondition" * requestBody: * content: * application/json: - * required: - * - id * schema: * properties: - * items: - * properties: - * products: - * type: array - * description: list of products - * product_types: - * type: array - * description: list of product types - * product_collections: - * type: array - * description: list of product collections - * product_tags: - * type: array - * description: list of product tags - * customer_groups: - * type: array - * description: list of customer_groups + * products: + * type: array + * description: list of product IDs if the condition is applied on products. + * items: + * type: string + * product_types: + * type: array + * description: list of product type IDs if the condition is applied on product types. + * items: + * type: string + * product_collections: + * type: array + * description: list of product collection IDs if the condition is applied on product collections. + * items: + * type: string + * product_tags: + * type: array + * description: list of product tag IDs if the condition is applied on product tags. + * items: + * type: string + * customer_groups: + * type: array + * description: list of customer group IDs if the condition is applied on customer groups. + * items: + * type: string * tags: * - Discount * responses: diff --git a/packages/medusa/src/api/routes/admin/discounts/update-discount.ts b/packages/medusa/src/api/routes/admin/discounts/update-discount.ts index 97a0b01caa..3d465e4f75 100644 --- a/packages/medusa/src/api/routes/admin/discounts/update-discount.ts +++ b/packages/medusa/src/api/routes/admin/discounts/update-discount.ts @@ -1,4 +1,4 @@ -import { Type } from "class-transformer" +import { Discount, DiscountConditionOperator } from "../../../../models" import { IsArray, IsBoolean, @@ -13,15 +13,16 @@ import { ValidateNested, } from "class-validator" import { defaultAdminDiscountsFields, defaultAdminDiscountsRelations } from "." -import { AllocationType } from "../../../../models" -import { Discount, DiscountConditionOperator } from "../../../../models" -import DiscountService from "../../../../services/discount" + import { AdminUpsertConditionsReq } from "../../../../types/discount" -import { getRetrieveConfig } from "../../../../utils/get-query-config" -import { validator } from "../../../../utils/validator" +import { AllocationType } from "../../../../models" +import DiscountService from "../../../../services/discount" +import { EntityManager } from "typeorm" import { IsGreaterThan } from "../../../../utils/validators/greater-than" import { IsISO8601Duration } from "../../../../utils/validators/iso8601-duration" -import { EntityManager } from "typeorm" +import { Type } from "class-transformer" +import { getRetrieveConfig } from "../../../../utils/get-query-config" +import { validator } from "../../../../utils/validator" /** * @oas [post] /discounts/{id} @@ -30,7 +31,9 @@ import { EntityManager } from "typeorm" * description: "Updates a Discount with a given set of rules that define how the Discount behaves." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Discount. + * - (path) id=* {string} The ID of the Discount. + * - (query) expand {string} (Comma separated) Which fields should be expanded in each item of the result. + * - (query) fields {string} (Comma separated) Which fields should be included in each item of the result. * requestBody: * content: * application/json: @@ -41,23 +44,87 @@ import { EntityManager } from "typeorm" * description: A unique code that will be used to redeem the Discount * rule: * description: The Discount Rule that defines how Discounts are calculated - * oneOf: - * - $ref: "#/components/schemas/discount_rule" + * type: object + * required: + * - id + * properties: + * id: + * type: string + * description: "The ID of the Rule" + * description: + * type: string + * description: "A short description of the discount" + * value: + * type: number + * description: "The value that the discount represents; this will depend on the type of the discount" + * allocation: + * type: string + * description: "The scope that the discount should apply to." + * enum: [total, item] + * conditions: + * type: array + * description: "A set of conditions that can be used to limit when the discount can be used. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided." + * items: + * type: object + * required: + * - operator + * properties: + * id: + * type: string + * description: "The ID of the Rule" + * operator: + * type: string + * description: Operator of the condition + * enum: [in, not_in] + * products: + * type: array + * description: list of product IDs if the condition is applied on products. + * items: + * type: string + * product_types: + * type: array + * description: list of product type IDs if the condition is applied on product types. + * items: + * type: string + * product_collections: + * type: array + * description: list of product collection IDs if the condition is applied on product collections. + * items: + * type: string + * product_tags: + * type: array + * description: list of product tag IDs if the condition is applied on product tags. + * items: + * type: string + * customer_groups: + * type: array + * description: list of customer group IDs if the condition is applied on customer groups. + * items: + * type: string * is_disabled: * type: boolean * description: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. * starts_at: - * type: Date + * type: string + * format: date-time * description: The time at which the Discount should be available. * ends_at: - * type: Date + * type: string + * format: date-time * description: The time at which the Discount should no longer be available. + * valid_duration: + * type: string + * description: Duration the discount runs between + * example: P3Y6M4DT12H30M5S + * usage_limit: + * type: number + * description: Maximum times the discount can be used * regions: * description: A list of Region ids representing the Regions in which the Discount can be used. * type: array * items: * type: string - * metadata: + * metadata: * description: An object containing metadata of the discount * type: object * tags: diff --git a/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts index d3efcea291..259850f190 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/create-draft-order.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, @@ -11,16 +10,19 @@ import { IsString, ValidateNested, } from "class-validator" -import { transformIdableFields } from "medusa-core-utils" import { defaultAdminDraftOrdersFields, defaultAdminDraftOrdersRelations, } from "." + +import { AddressPayload } from "../../../../types/common" import { DraftOrder } from "../../../.." import { DraftOrderService } from "../../../../services" -import { AddressPayload } from "../../../../types/common" -import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" +import { Type } from "class-transformer" +import { transformIdableFields } from "medusa-core-utils" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /draft-orders * operationId: "PostDraftOrders" @@ -40,24 +42,27 @@ import { EntityManager } from "typeorm" * status: * description: "The status of the draft order" * type: string + * enum: [open, completed] * email: * description: "The email of the customer of the draft order" * type: string + * format: email * billing_address: * description: "The Address to be used for billing purposes." - * anyOf: - * - $ref: "#/components/schemas/address" + * $ref: "#/components/schemas/address" * shipping_address: * description: "The Address to be used for shipping." - * anyOf: - * - $ref: "#/components/schemas/address" + * $ref: "#/components/schemas/address" * items: * description: The Line Items that have been received. * type: array * items: + * type: object + * required: + * - quantity * properties: * variant_id: - * description: The id of the Product Variant to generate the Line Item from. + * description: The ID of the Product Variant to generate the Line Item from. * type: string * unit_price: * description: The potential custom price of the item. @@ -72,18 +77,21 @@ import { EntityManager } from "typeorm" * description: The optional key-value map with additional details about the Line Item. * type: object * region_id: - * description: The id of the region for the draft order + * description: The ID of the region for the draft order * type: string * discounts: * description: The discounts to add on the draft order * type: array * items: + * type: object + * required: + * - code * properties: * code: * description: The code of the discount to apply * type: string * customer_id: - * description: The id of the customer to add on the draft order + * description: The ID of the customer to add on the draft order * type: string * no_notification_order: * description: An optional flag passed to the resulting order to determine use of notifications. @@ -92,9 +100,12 @@ import { EntityManager } from "typeorm" * description: The shipping methods for the draft order * type: array * items: + * type: object + * required: + * - option_id * properties: * option_id: - * description: The id of the shipping option in use + * description: The ID of the shipping option in use * type: string * data: * description: The optional additional data needed for the shipping method diff --git a/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts b/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts index e4db2f3e35..e44168070d 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/create-line-item.ts @@ -1,3 +1,8 @@ +import { + CartService, + DraftOrderService, + LineItemService, +} from "../../../../services" import { IsBoolean, IsInt, @@ -5,35 +10,34 @@ import { IsOptional, IsString, } from "class-validator" -import { MedusaError } from "medusa-core-utils" -import { EntityManager } from "typeorm" import { defaultAdminDraftOrdersCartFields, defaultAdminDraftOrdersCartRelations, defaultAdminDraftOrdersFields, } from "." -import { - CartService, - DraftOrderService, - LineItemService, -} from "../../../../services" -import { validator } from "../../../../utils/validator" + +import { EntityManager } from "typeorm" import { FlagRouter } from "../../../../utils/flag-router" +import { MedusaError } from "medusa-core-utils" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /draft-orders/{id}/line-items * operationId: "PostDraftOrdersDraftOrderLineItems" * summary: "Create a Line Item for Draft Order" * description: "Creates a Line Item for the Draft Order" * x-authenticated: true + * parameters: + * - (path) id=* {string} The ID of the Draft Order. * requestBody: * content: * application/json: - * required: - * - quantity * schema: + * required: + * - quantity * properties: * variant_id: - * description: The id of the Product Variant to generate the Line Item from. + * description: The ID of the Product Variant to generate the Line Item from. * type: string * unit_price: * description: The potential custom price of the item. @@ -41,6 +45,7 @@ import { FlagRouter } from "../../../../utils/flag-router" * title: * description: The potential custom title of the item. * type: string + * default: "Custom item" * quantity: * description: The quantity of the Line Item. * type: integer diff --git a/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts index 5a4f1e2290..bf5ec150e0 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/delete-draft-order.ts @@ -7,7 +7,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Draft Order" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Draft Order. + * - (path) id=* {string} The ID of the Draft Order. * tags: * - Draft Order * responses: @@ -19,12 +19,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Draft Order. + * description: The ID of the deleted Draft Order. * object: * type: string * description: The type of the object that was deleted. + * default: draft-order * deleted: * type: boolean + * description: Whether the draft order was deleted successfully or not. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts b/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts index 1cddca5a27..fc5308fb22 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/delete-line-item.ts @@ -1,12 +1,14 @@ -import { MedusaError } from "medusa-core-utils" -import { EntityManager } from "typeorm" +import { CartService, DraftOrderService } from "../../../../services" import { defaultAdminDraftOrdersCartFields, defaultAdminDraftOrdersCartRelations, defaultAdminDraftOrdersFields, } from "." + import { DraftOrder } from "../../../.." -import { CartService, DraftOrderService } from "../../../../services" +import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" + /** * @oas [delete] /draft-orders/{id}/line-items/{line_id} * operationId: DeleteDraftOrdersDraftOrderLineItemsItem @@ -14,8 +16,8 @@ import { CartService, DraftOrderService } from "../../../../services" * description: "Removes a Line Item from a Draft Order." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Draft Order. - * - (path) line_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. * tags: * - Draft Order * responses: diff --git a/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts index ab8667516d..279de073c2 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/get-draft-order.ts @@ -1,11 +1,12 @@ -import { - defaultAdminDraftOrdersRelations, - defaultAdminDraftOrdersFields, - defaultAdminDraftOrdersCartRelations, - defaultAdminDraftOrdersCartFields, -} from "." -import { DraftOrder } from "../../../.." import { CartService, DraftOrderService } from "../../../../services" +import { + defaultAdminDraftOrdersCartFields, + defaultAdminDraftOrdersCartRelations, + defaultAdminDraftOrdersFields, + defaultAdminDraftOrdersRelations, +} from "." + +import { DraftOrder } from "../../../.." /** * @oas [get] /draft-orders/{id} @@ -14,7 +15,7 @@ import { CartService, DraftOrderService } from "../../../../services" * description: "Retrieves a Draft Order." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Draft Order. + * - (path) id=* {string} The ID of the Draft Order. * tags: * - Draft Order * responses: diff --git a/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts b/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts index 0981168086..9762118051 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/list-draft-orders.ts @@ -1,20 +1,26 @@ +import { IsNumber, IsOptional, IsString } from "class-validator" import { defaultAdminDraftOrdersFields, defaultAdminDraftOrdersRelations, } from "." -import { DraftOrderService } from "../../../../services" -import { IsNumber, IsOptional, IsString } from "class-validator" -import { validator } from "../../../../utils/validator" -import { Type } from "class-transformer" -import { DraftOrderListSelector } from "../../../../types/draft-orders" -import { FindConfig } from "../../../../types/common" + import { DraftOrder } from "../../../../models" +import { DraftOrderListSelector } from "../../../../types/draft-orders" +import { DraftOrderService } from "../../../../services" +import { FindConfig } from "../../../../types/common" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" + /** * @oas [get] /draft-orders * operationId: "GetDraftOrders" * summary: "List Draft Orders" * description: "Retrieves an list of Draft Orders" * x-authenticated: true + * parameters: + * - (query) offset=0 {number} The number of items to skip before the results. + * - (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 * tags: * - Draft Order * responses: @@ -24,8 +30,19 @@ import { DraftOrder } from "../../../../models" * application/json: * schema: * properties: - * draft_order: - * $ref: "#/components/schemas/draft-order" + * draft_orders: + * type: array + * items: + * $ref: "#/components/schemas/draft-order" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts b/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts index 7f960f12d4..702af23ff1 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/register-payment.ts @@ -1,4 +1,3 @@ -import { EntityManager } from "typeorm" import { CartService, DraftOrderService, @@ -10,8 +9,10 @@ import { defaultAdminOrdersRelations as defaultOrderRelations, } from "../orders/index" +import { EntityManager } from "typeorm" + /** - * @oas [post] /draft-orders/{id}/register-payment + * @oas [post] /draft-orders/{id}/pay * summary: "Registers a payment for a Draft Order" * operationId: "PostDraftOrdersDraftOrderRegisterPayment" * description: "Registers a payment for a Draft Order." @@ -27,7 +28,7 @@ import { * application/json: * schema: * properties: - * draft_order: + * order: * $ref: "#/components/schemas/draft-order" */ diff --git a/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts b/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts index 971e649fea..a80f826440 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/update-draft-order.ts @@ -1,8 +1,4 @@ -import { MedusaError } from "medusa-core-utils" -import { - defaultAdminDraftOrdersCartFields, - defaultAdminDraftOrdersCartRelations, -} from "." +import { CartService, DraftOrderService } from "../../../../services" import { IsArray, IsBoolean, @@ -11,12 +7,17 @@ import { IsString, ValidateNested, } from "class-validator" -import { CartService, DraftOrderService } from "../../../../services" -import { Type } from "class-transformer" +import { + defaultAdminDraftOrdersCartFields, + defaultAdminDraftOrdersCartRelations, +} from "." + import { AddressPayload } from "../../../../types/common" -import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" import { DraftOrderStatus } from "../../../../models" +import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [post] /admin/draft-orders/{id} @@ -25,7 +26,7 @@ import { DraftOrderStatus } from "../../../../models" * description: "Updates a Draft Order." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Draft Order. + * - (path) id=* {string} The ID of the Draft Order. * requestBody: * content: * application/json: @@ -33,22 +34,30 @@ import { DraftOrderStatus } from "../../../../models" * properties: * region_id: * type: string - * description: The id of the Region to create the Draft Order in. + * description: The ID of the Region to create the Draft Order in. + * country_code: + * type: string + * description: "The 2 character ISO code for the Country." + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * description: See a list of codes. * email: * type: string * description: "An email to be used on the Draft Order." + * format: email * billing_address: * description: "The Address to be used for billing purposes." - * anyOf: - * - $ref: "#/components/schemas/address" + * $ref: "#/components/schemas/address" * shipping_address: * description: "The Address to be used for shipping." - * anyOf: - * - $ref: "#/components/schemas/address" + * $ref: "#/components/schemas/address" * discounts: * description: "An array of Discount codes to add to the Draft Order." * type: array * items: + * type: object + * required: + * - code * properties: * code: * description: "The code that a Discount is identifed by." @@ -57,7 +66,7 @@ import { DraftOrderStatus } from "../../../../models" * description: "An optional flag passed to the resulting order to determine use of notifications." * type: boolean * customer_id: - * description: "The id of the Customer to associate the Draft Order with." + * description: "The ID of the Customer to associate the Draft Order with." * type: string * tags: * - Draft Order diff --git a/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts b/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts index 9fa0e5f948..7ccb96cb62 100644 --- a/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts +++ b/packages/medusa/src/api/routes/admin/draft-orders/update-line-item.ts @@ -1,21 +1,26 @@ +import { CartService, DraftOrderService } from "../../../../services" import { IsInt, IsObject, IsOptional, IsString } from "class-validator" -import { MedusaError } from "medusa-core-utils" -import { EntityManager } from "typeorm" import { defaultAdminDraftOrdersCartFields, defaultAdminDraftOrdersCartRelations, defaultAdminDraftOrdersFields, } from "." + import { DraftOrder } from "../../../.." +import { EntityManager } from "typeorm" import { LineItemUpdate } from "../../../../types/cart" -import { CartService, DraftOrderService } from "../../../../services" +import { MedusaError } from "medusa-core-utils" import { validator } from "../../../../utils/validator" + /** * @oas [post] /draft-orders/{id}/line-items/{line_id} * operationId: "PostDraftOrdersDraftOrderLineItemsItem" * summary: "Update a Line Item for a Draft Order" * description: "Updates a Line Item for a Draft Order" * x-authenticated: true + * parameters: + * - (path) id=* {string} The ID of the Draft Order. + * - (path) line_id=* {string} The ID of the Line Item. * requestBody: * content: * application/json: diff --git a/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts index 757f249368..bc3733357f 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/create-gift-card.ts @@ -1,7 +1,8 @@ -import { Type } from "class-transformer" import { IsBoolean, IsDate, IsInt, IsOptional, IsString } from "class-validator" import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "." + import { GiftCardService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -15,6 +16,8 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: + * required: + * - region_id * properties: * value: * type: integer @@ -27,10 +30,8 @@ import { EntityManager } from "typeorm" * format: date-time * description: The time at which the Gift Card should no longer be available. * region_id: - * description: The id of the Region in which the Gift Card can be used. - * type: array - * items: - * type: string + * description: The ID of the Region in which the Gift Card can be used. + * type: string * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object diff --git a/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts index 8e76de76c1..9bd27d7582 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/delete-gift-card.ts @@ -7,7 +7,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Gift Card" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Gift Card to delete. + * - (path) id=* {string} The ID of the Gift Card to delete. * tags: * - Gift Card * responses: @@ -19,12 +19,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Gift Card + * description: The ID of the deleted Gift Card * object: * type: string * description: The type of the object that was deleted. + * default: gift-card * deleted: * type: boolean + * description: Whether the gift card was deleted successfully or not. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts index 8cd2cc96c4..aed27a2b0d 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/get-gift-card.ts @@ -7,7 +7,7 @@ import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "./" * description: "Retrieves a Gift Card." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Gift Card. + * - (path) id=* {string} The ID of the Gift Card. * tags: * - Gift Card * responses: diff --git a/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts b/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts index 9aa990cd56..897732cd82 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/list-gift-cards.ts @@ -1,7 +1,8 @@ -import { Type } from "class-transformer" import { IsInt, IsOptional, IsString } from "class-validator" -import { pickBy } from "lodash" + import { GiftCardService } from "../../../../services" +import { Type } from "class-transformer" +import { pickBy } from "lodash" import { validator } from "../../../../utils/validator" /** @@ -10,6 +11,10 @@ import { validator } from "../../../../utils/validator" * summary: "List Gift Cards" * description: "Retrieves a list of Gift Cards." * x-authenticated: true + * parameters: + * - (query) offset=0 {number} The number of items to skip before the results. + * - (query) limit=50 {number} Limit the number of items returned. + * - (query) q {string} a search term to search by code or display ID * tags: * - Gift Card * responses: @@ -23,6 +28,15 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/gift_card" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(AdminGetGiftCardsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts b/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts index 2992ae785d..f702dca67f 100644 --- a/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts +++ b/packages/medusa/src/api/routes/admin/gift-cards/update-gift-card.ts @@ -1,7 +1,8 @@ -import { Type } from "class-transformer" import { IsBoolean, IsDate, IsInt, IsOptional, IsString } from "class-validator" import { defaultAdminGiftCardFields, defaultAdminGiftCardRelations } from "." + import { GiftCardService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -12,7 +13,7 @@ import { EntityManager } from "typeorm" * description: "Creates a Gift Card that can redeemed by its unique code. The Gift Card is only valid within 1 region." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Gift Card. + * - (path) id=* {string} The ID of the Gift Card. * requestBody: * content: * application/json: @@ -29,10 +30,8 @@ import { EntityManager } from "typeorm" * format: date-time * description: The time at which the Gift Card should no longer be available. * region_id: - * description: The id of the Region in which the Gift Card can be used. - * type: array - * items: - * type: string + * description: The ID of the Region in which the Gift Card can be used. + * type: string * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object diff --git a/packages/medusa/src/api/routes/admin/invites/accept-invite.ts b/packages/medusa/src/api/routes/admin/invites/accept-invite.ts index 8b39901fe4..6f21d6d3ed 100644 --- a/packages/medusa/src/api/routes/admin/invites/accept-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/accept-invite.ts @@ -1,6 +1,7 @@ -import { Type } from "class-transformer" import { IsNotEmpty, IsString, ValidateNested } from "class-validator" + import InviteService from "../../../../services/invite" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -37,8 +38,9 @@ import { EntityManager } from "typeorm" * password: * description: The desired password for the User * type: string + * format: password * tags: - * - Invites + * - Invite * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/invites/create-invite.ts b/packages/medusa/src/api/routes/admin/invites/create-invite.ts index 71d281005e..6343f4e293 100644 --- a/packages/medusa/src/api/routes/admin/invites/create-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/create-invite.ts @@ -1,6 +1,7 @@ import { IsEmail, IsEnum } from "class-validator" -import { UserRoles } from "../../../../models/user" + import InviteService from "../../../../services/invite" +import { UserRoles } from "../../../../models/user" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -21,11 +22,13 @@ import { EntityManager } from "typeorm" * user: * description: "The email for the user to be created." * type: string + * format: email * role: * description: "The role of the user to be created." * type: string + * enum: [admin, member, developer] * tags: - * - Invites + * - Invite * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/invites/delete-invite.ts b/packages/medusa/src/api/routes/admin/invites/delete-invite.ts index f6a3153e41..17e527a998 100644 --- a/packages/medusa/src/api/routes/admin/invites/delete-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/delete-invite.ts @@ -1,5 +1,5 @@ -import InviteService from "../../../../services/invite" import { EntityManager } from "typeorm" +import InviteService from "../../../../services/invite" /** * @oas [delete] /invites/{invite_id} @@ -8,12 +8,27 @@ import { EntityManager } from "typeorm" * description: "Creates an Invite and triggers an 'invite' created event" * x-authenticated: true * parameters: - * - (path) invite_id=* {string} The id of the Invite + * - (path) invite_id=* {string} The ID of the Invite * tags: - * - Invites + * - Invite * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * properties: + * id: + * type: string + * description: The ID of the deleted Invite. + * object: + * type: string + * description: The type of the object that was deleted. + * format: invite + * deleted: + * type: boolean + * description: Whether or not the Invite was deleted. + * default: true */ export default async (req, res) => { const { invite_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/invites/list-invites.ts b/packages/medusa/src/api/routes/admin/invites/list-invites.ts index 2a49c73a74..2d9182219a 100644 --- a/packages/medusa/src/api/routes/admin/invites/list-invites.ts +++ b/packages/medusa/src/api/routes/admin/invites/list-invites.ts @@ -7,7 +7,7 @@ import InviteService from "../../../../services/invite" * description: "Lists all Invites" * x-authenticated: true * tags: - * - Invites + * - Invite * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/invites/resend-invite.ts b/packages/medusa/src/api/routes/admin/invites/resend-invite.ts index 539cabb378..0dd0798008 100644 --- a/packages/medusa/src/api/routes/admin/invites/resend-invite.ts +++ b/packages/medusa/src/api/routes/admin/invites/resend-invite.ts @@ -8,9 +8,9 @@ import { EntityManager } from "typeorm" * description: "Resends an Invite by triggering the 'invite' created event again" * x-authenticated: true * parameters: - * - (path) invite_id=* {string} The id of the Invite + * - (path) invite_id=* {string} The ID of the Invite * tags: - * - Invites + * - Invite * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/notes/create-note.ts b/packages/medusa/src/api/routes/admin/notes/create-note.ts index d50904ffff..df9f8dad4b 100644 --- a/packages/medusa/src/api/routes/admin/notes/create-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/create-note.ts @@ -1,4 +1,5 @@ import { IsNotEmpty, IsString } from "class-validator" + import NoteService from "../../../../services/note" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -13,10 +14,14 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: + * required: + * - resource_id + * - resource_type + * - value * properties: * resource_id: * type: string - * description: The id of the resource which the Note relates to. + * description: The ID of the resource which the Note relates to. * resource_type: * type: string * description: The type of resource which the Note relates to. diff --git a/packages/medusa/src/api/routes/admin/notes/delete-note.ts b/packages/medusa/src/api/routes/admin/notes/delete-note.ts index cb344d0d70..26db70f0d3 100644 --- a/packages/medusa/src/api/routes/admin/notes/delete-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/delete-note.ts @@ -1,5 +1,5 @@ -import NoteService from "../../../../services/note" import { EntityManager } from "typeorm" +import NoteService from "../../../../services/note" /** * @oas [delete] /notes/{id} @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Note." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Note to delete. + * - (path) id=* {string} The ID of the Note to delete. * tags: * - Note * responses: @@ -20,10 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Note. + * description: The ID of the deleted Note. + * object: + * type: string + * description: The type of the object that was deleted. + * default: note * deleted: * type: boolean * description: Whether or not the Note was deleted. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/notes/get-note.ts b/packages/medusa/src/api/routes/admin/notes/get-note.ts index 8b4c302b9f..bbdc610411 100644 --- a/packages/medusa/src/api/routes/admin/notes/get-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/get-note.ts @@ -7,7 +7,7 @@ import NoteService from "../../../../services/note" * description: "Retrieves a single note using its id" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the note to retrieve. + * - (path) id=* {string} The ID of the note to retrieve. * tags: * - Note * responses: diff --git a/packages/medusa/src/api/routes/admin/notes/list-notes.ts b/packages/medusa/src/api/routes/admin/notes/list-notes.ts index 89d84e71f2..24990453be 100644 --- a/packages/medusa/src/api/routes/admin/notes/list-notes.ts +++ b/packages/medusa/src/api/routes/admin/notes/list-notes.ts @@ -1,18 +1,20 @@ import { IsNumber, IsOptional, IsString } from "class-validator" + import NoteService from "../../../../services/note" -import { validator } from "../../../../utils/validator" -import { selector } from "../../../../types/note" import { Type } from "class-transformer" +import { selector } from "../../../../types/note" +import { validator } from "../../../../utils/validator" + /** * @oas [get] /notes * operationId: "GetNotes" * summary: "List Notes" * x-authenticated: true * description: "Retrieves a list of notes" - * * parameters: - * - (path) limit= {number} The number of notes to get - * - (path) offset= {number} The offset at which to get notes - * - (path) resource_id= {string} The id which the notes belongs to + * parameters: + * - (query) limit=50 {number} The number of notes to get + * - (query) offset=0 {number} The offset at which to get notes + * - (query) resource_id {string} The ID which the notes belongs to * tags: * - Note * responses: @@ -26,6 +28,15 @@ import { Type } from "class-transformer" * type: array * items: * $ref: "#/components/schemas/note" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(AdminGetNotesParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/notes/update-note.ts b/packages/medusa/src/api/routes/admin/notes/update-note.ts index 291b608a14..c3f33379c0 100644 --- a/packages/medusa/src/api/routes/admin/notes/update-note.ts +++ b/packages/medusa/src/api/routes/admin/notes/update-note.ts @@ -10,7 +10,7 @@ import { EntityManager } from "typeorm" * x-authenticated: true * description: "Updates a Note associated with some resource" * parameters: - * - (path) id=* {string} The id of the Note to update + * - (path) id=* {string} The ID of the Note to update * requestBody: * content: * application/json: diff --git a/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts b/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts index 8a08c06130..c03cc3e378 100644 --- a/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts +++ b/packages/medusa/src/api/routes/admin/notifications/list-notifications.ts @@ -1,8 +1,4 @@ -import { Type } from "class-transformer" import { IsBooleanString, IsInt, IsOptional, IsString } from "class-validator" -import { pick } from "lodash" -import { NotificationService } from "../../../../services" -import { validator } from "../../../../utils/validator" import { defaultAdminNotificationsFields, defaultAdminNotificationsRelations, @@ -10,6 +6,11 @@ import { import { Notification } from "../../../../models" import { FindConfig } from "../../../../types/common" +import { NotificationService } from "../../../../services" +import { Type } from "class-transformer" +import { pick } from "lodash" +import { validator } from "../../../../utils/validator" + /** * @oas [get] /notifications * operationId: "GetNotifications" @@ -19,13 +20,13 @@ import { FindConfig } from "../../../../types/common" * parameters: * - (query) offset=0 {integer} The number of notifications to skip before starting to collect the notifications set * - (query) limit=50 {integer} The number of notifications to return - * - (query) fields {string} The fields to include in the result set - * - (query) expand {string} The fields to populate - * - (query) event_name {string} - * - (query) resource_type {string} - * - (query) resource_id {string} - * - (query) to {string} - * - (query) include_resends {boolean} Whether the result set should include resent notifications or not + * - (query) fields {string} Comma separated fields to include in the result set + * - (query) expand {string} Comma separated fields to populate + * - (query) event_name {string} The name of the event that the notification was sent for. + * - (query) resource_type {string} The type of 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) include_resends {string} A boolean indicating whether the result set should include resent notifications or not * tags: * - Notification * responses: diff --git a/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts b/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts index b8c6e4d297..6cc8cf9f87 100644 --- a/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts +++ b/packages/medusa/src/api/routes/admin/notifications/resend-notification.ts @@ -1,13 +1,14 @@ -import { IsString } from "class-validator" -import { IsOptional } from "class-validator" import { defaultAdminNotificationsFields, defaultAdminNotificationsRelations, } from "." -import { validator } from "../../../../utils/validator" -import { NotificationService } from "../../../../services" -import { Notification } from "../../../../models" + import { EntityManager } from "typeorm" +import { IsOptional } from "class-validator" +import { IsString } from "class-validator" +import { Notification } from "../../../../models" +import { NotificationService } from "../../../../services" +import { validator } from "../../../../utils/validator" /** * @oas [post] /notifications/{id}/resend @@ -16,14 +17,14 @@ import { EntityManager } from "typeorm" * description: "Resends a previously sent notifications, with the same data but optionally to a different address" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Notification + * - (path) id=* {string} The ID of the Notification * requestBody: * content: * application/json: * schema: * properties: * to: - * description: "The address or user identifier that the Notification was sent to" + * description: "A new address or user identifier that the Notification should be sent to" * type: string * tags: * - Notification diff --git a/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts b/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts index e930d37583..e73da51d8f 100644 --- a/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts +++ b/packages/medusa/src/api/routes/admin/orders/add-shipping-method.ts @@ -6,6 +6,7 @@ import { IsString, } from "class-validator" import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { OrderService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -17,10 +18,10 @@ import { EntityManager } from "typeorm" * description: "Adds a Shipping Method to an Order. If another Shipping Method exists with the same Shipping Profile, the previous Shipping Method will be replaced." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * - (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) data=* {object} The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider. + * - (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. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/admin/orders/archive-order.ts b/packages/medusa/src/api/routes/admin/orders/archive-order.ts index 61bbf45fa7..021e574bce 100644 --- a/packages/medusa/src/api/routes/admin/orders/archive-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/archive-order.ts @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Archives the order with the given id." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts b/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts index e11241a425..87f6d278de 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-claim.ts @@ -1,7 +1,8 @@ -import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { ClaimService, OrderService } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" /** * @oas [post] /orders/{id}/claims/{claim_id}/cancel @@ -10,8 +11,8 @@ import { EntityManager } from "typeorm" * description: "Cancels a Claim" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) claim_id=* {string} The id of the Claim. + * - (path) id=* {string} The ID of the Order. + * - (path) claim_id=* {string} The ID of the Claim. * tags: * - Claim * responses: @@ -22,7 +23,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * order: - * $ref: "#/components/schemas/claim_order" + * $ref: "#/components/schemas/order" */ export default async (req, res) => { const { id, claim_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts index fd030c4932..437710121f 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-claim.ts @@ -1,11 +1,12 @@ -import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { ClaimService, FulfillmentService, OrderService, } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" /** * @oas [post] /orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel @@ -14,9 +15,9 @@ import { EntityManager } from "typeorm" * description: "Registers a Fulfillment as canceled." * x-authenticated: true * parameters: - * - (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) fulfillment_id=* {string} The id of the Fulfillment. + * - (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) fulfillment_id=* {string} The ID of the Fulfillment. * tags: * - Fulfillment * responses: @@ -26,8 +27,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * fulfillment: - * $ref: "#/components/schemas/fulfillment" + * order: + * $ref: "#/components/schemas/order" */ export default async (req, res) => { const { id, claim_id, fulfillment_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts index bbf688d276..2b975a9d06 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment-swap.ts @@ -1,11 +1,12 @@ -import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { FulfillmentService, OrderService, SwapService, } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" /** * @oas [post] /orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel @@ -14,9 +15,9 @@ import { EntityManager } from "typeorm" * description: "Registers a Fulfillment as canceled." * x-authenticated: true * parameters: - * - (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) fulfillment_id=* {string} The id of the Fulfillment. + * - (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) fulfillment_id=* {string} The ID of the Fulfillment. * tags: * - Fulfillment * responses: @@ -26,8 +27,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * fulfillment: - * $ref: "#/components/schemas/fulfillment" + * order: + * $ref: "#/components/schemas/order" */ export default async (req, res) => { const { id, swap_id, fulfillment_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts index 0f2c1da749..5e1e26e334 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-fulfillment.ts @@ -1,7 +1,8 @@ -import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { FulfillmentService, OrderService } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" /** * @oas [post] /orders/{id}/fulfillments/{fulfillment_id}/cancel @@ -10,8 +11,8 @@ import { EntityManager } from "typeorm" * description: "Registers a Fulfillment as canceled." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order which the Fulfillment relates to. - * - (path) fulfillment_id=* {string} The id of the Fulfillment + * - (path) id=* {string} The ID of the Order which the Fulfillment relates to. + * - (path) fulfillment_id=* {string} The ID of the Fulfillment * tags: * - Fulfillment * responses: @@ -21,8 +22,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * fulfillment: - * $ref: "#/components/schemas/fulfillment" + * order: + * $ref: "#/components/schemas/order" */ export default async (req, res) => { const { id, fulfillment_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-order.ts b/packages/medusa/src/api/routes/admin/orders/cancel-order.ts index 8d8d45e3cc..8f64ffda99 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-order.ts @@ -1,4 +1,5 @@ import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { OrderService } from "../../../../services" import { EntityManager } from "typeorm" @@ -9,7 +10,7 @@ import { EntityManager } from "typeorm" * description: "Registers an Order as canceled. This triggers a flow that will cancel any created Fulfillments and Payments, may fail if the Payment or Fulfillment Provider is unable to cancel the Payment/Fulfillment." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts b/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts index d000129b3a..97c1061313 100644 --- a/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/cancel-swap.ts @@ -1,7 +1,8 @@ -import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { OrderService, SwapService } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" /** * @oas [post] /orders/{id}/swaps/{swap_id}/cancel @@ -10,8 +11,8 @@ import { EntityManager } from "typeorm" * description: "Cancels a Swap" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) swap_id=* {string} The id of the Swap. + * - (path) id=* {string} The ID of the Order. + * - (path) swap_id=* {string} The ID of the Swap. * tags: * - Swap * responses: @@ -22,7 +23,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * order: - * $ref: "#/components/schemas/swap" + * $ref: "#/components/schemas/order" */ export default async (req, res) => { const { id, swap_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/orders/capture-payment.ts b/packages/medusa/src/api/routes/admin/orders/capture-payment.ts index 0fc77f387a..ed4cf6d838 100644 --- a/packages/medusa/src/api/routes/admin/orders/capture-payment.ts +++ b/packages/medusa/src/api/routes/admin/orders/capture-payment.ts @@ -1,4 +1,5 @@ -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { OrderService } from "../../../../services" import { EntityManager } from "typeorm" @@ -9,7 +10,7 @@ import { EntityManager } from "typeorm" * description: "Captures all the Payments associated with an Order." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/admin/orders/complete-order.ts b/packages/medusa/src/api/routes/admin/orders/complete-order.ts index 59ae4c9aec..6e1fdb7555 100644 --- a/packages/medusa/src/api/routes/admin/orders/complete-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/complete-order.ts @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Completes an Order" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts b/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts index 27fd915e4e..17901305fa 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-claim-shipment.ts @@ -1,6 +1,7 @@ +import { ClaimService, OrderService } from "../../../../services" import { IsArray, IsNotEmpty, IsOptional, IsString } from "class-validator" import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." -import { ClaimService, OrderService } from "../../../../services" + import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -11,8 +12,8 @@ import { EntityManager } from "typeorm" * description: "Registers a Claim Fulfillment as shipped." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) claim_id=* {string} The id of the Claim. + * - (path) id=* {string} The ID of the Order. + * - (path) claim_id=* {string} The ID of the Claim. * requestBody: * content: * application/json: @@ -21,7 +22,7 @@ import { EntityManager } from "typeorm" * - fulfillment_id * properties: * fulfillment_id: - * description: The id of the Fulfillment. + * description: The ID of the Fulfillment. * type: string * tracking_numbers: * description: The tracking numbers for the shipment. @@ -29,7 +30,7 @@ import { EntityManager } from "typeorm" * items: * type: string * tags: - * - Order + * - Claim * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/create-claim.ts b/packages/medusa/src/api/routes/admin/orders/create-claim.ts index bc7211861d..08e8c66bc8 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-claim.ts @@ -1,4 +1,4 @@ -import { Type } from "class-transformer" +import { ClaimReason, ClaimType } from "../../../../models" import { IsArray, IsBoolean, @@ -10,13 +10,14 @@ import { IsString, ValidateNested, } from "class-validator" -import { MedusaError } from "medusa-core-utils" import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { AddressPayload } from "../../../../types/common" -import { validator } from "../../../../utils/validator" import { ClaimTypeValue } from "../../../../types/claim" -import { ClaimType, ClaimReason } from "../../../../models" import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [post] /order/{id}/claims @@ -25,7 +26,7 @@ import { EntityManager } from "typeorm" * description: "Creates a Claim." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -44,9 +45,12 @@ import { EntityManager } from "typeorm" * description: The Claim Items that the Claim will consist of. * type: array * items: + * required: + * - item_id + * - quantity * properties: * item_id: - * description: The id of the Line Item that will be claimed. + * description: The ID of the Line Item that will be claimed. * type: string * quantity: * description: The number of items that will be returned @@ -71,55 +75,59 @@ import { EntityManager } from "typeorm" * description: A list of image URL's that will be associated with the Claim * items: * type: string - * return_shipping: + * return_shipping: * description: Optional details for the Return Shipping Method, if the items are to be sent back. * type: object * properties: * option_id: * type: string - * description: The id of the Shipping Option to create the Shipping Method from. + * description: The ID of the Shipping Option to create the Shipping Method from. * price: * type: integer * description: The price to charge for the Shipping Method. - * additional_items: + * additional_items: * description: The new items to send to the Customer when the Claim type is Replace. * type: array * items: + * required: + * - variant_id + * - quantity * properties: * variant_id: - * description: The id of the Product Variant to ship. + * description: The ID of the Product Variant to ship. * type: string * quantity: * description: The quantity of the Product Variant to ship. * type: integer - * shipping_methods: + * shipping_methods: * description: The Shipping Methods to send the additional Line Items with. * type: array * items: * properties: * id: - * description: The id of an existing Shipping Method + * description: The ID of an existing Shipping Method * type: string * option_id: - * description: The id of the Shipping Option to create a Shipping Method from + * description: The ID of the Shipping Option to create a Shipping Method from * type: string * price: * description: The price to charge for the Shipping Method * type: integer - * shipping_address: + * shipping_address: * type: object * description: "An optional shipping address to send the claim to. Defaults to the parent order's shipping address" - * refund_amount: + * $ref: "#/components/schemas/address" + * refund_amount: * description: The amount to refund the Customer when the Claim type is `refund`. * type: integer - * no_notification: + * no_notification: * description: If set to true no notification will be send related to this Claim. * type: boolean - * metadata: + * metadata: * description: An optional set of key-value pairs to hold additional information. * type: object * tags: - * - Order + * - Claim * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts b/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts index 194f0eac91..354be55bbc 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts @@ -1,4 +1,3 @@ -import { Transform, Type } from "class-transformer" import { IsArray, IsBoolean, @@ -9,18 +8,21 @@ import { IsString, ValidateNested, } from "class-validator" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." +import { Transform, Type } from "class-transformer" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + +import { EntityManager } from "typeorm" import { OrderService } from "../../../../services" import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" + /** - * @oas [post] /orders/{id}/fulfillments + * @oas [post] /orders/{id}/fulfillment * operationId: "PostOrdersOrderFulfillments" * summary: "Create a Fulfillment" * description: "Creates a Fulfillment of an Order - will notify Fulfillment Providers to prepare a shipment." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -32,9 +34,12 @@ import { EntityManager } from "typeorm" * description: The Line Items to include in the Fulfillment. * type: array * items: + * required: + * - item_id + * - quantity * properties: * item_id: - * description: The id of Line Item to fulfill. + * description: The ID of Line Item to fulfill. * type: string * quantity: * description: The quantity of the Line Item to fulfill. @@ -46,7 +51,7 @@ import { EntityManager } from "typeorm" * description: An optional set of key-value pairs to hold additional information. * type: object * tags: - * - Order + * - Fulfillment * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/create-shipment.ts b/packages/medusa/src/api/routes/admin/orders/create-shipment.ts index cb90c90f0f..156ea81e0c 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-shipment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-shipment.ts @@ -5,11 +5,13 @@ import { IsOptional, IsString, } from "class-validator" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." -import { OrderService } from "../../../../services" -import { validator } from "../../../../utils/validator" -import { TrackingLink } from "../../../../models" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { OrderService } from "../../../../services" +import { TrackingLink } from "../../../../models" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /orders/{id}/shipment * operationId: "PostOrdersOrderShipment" @@ -17,7 +19,7 @@ import { EntityManager } from "typeorm" * description: "Registers a Fulfillment as shipped." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -26,7 +28,7 @@ import { EntityManager } from "typeorm" * - fulfillment_id * properties: * fulfillment_id: - * description: The id of the Fulfillment. + * description: The ID of the Fulfillment. * type: string * tracking_numbers: * description: The tracking numbers for the shipment. diff --git a/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts b/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts index 7a48640b94..44da0e50e3 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-swap-shipment.ts @@ -5,10 +5,12 @@ import { IsOptional, IsString, } from "class-validator" -import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." import { OrderService, SwapService } from "../../../../services" -import { validator } from "../../../../utils/validator" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /orders/{id}/swaps/{swap_id}/shipments * operationId: "PostOrdersOrderSwapsSwapShipments" @@ -16,8 +18,8 @@ import { EntityManager } from "typeorm" * description: "Registers a Swap Fulfillment as shipped." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) swap_id=* {string} The id of the Swap. + * - (path) id=* {string} The ID of the Order. + * - (path) swap_id=* {string} The ID of the Swap. * requestBody: * content: * application/json: @@ -26,7 +28,7 @@ import { EntityManager } from "typeorm" * - fulfillment_id * properties: * fulfillment_id: - * description: The id of the Fulfillment. + * description: The ID of the Fulfillment. * type: string * tracking_numbers: * description: The tracking numbers for the shipment. @@ -37,7 +39,7 @@ import { EntityManager } from "typeorm" * description: If set to true no notification will be send related to this Claim. * type: boolean * tags: - * - Order + * - Swap * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/create-swap.ts b/packages/medusa/src/api/routes/admin/orders/create-swap.ts index a91a88acd5..10fd88e34f 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-swap.ts @@ -1,26 +1,27 @@ -import { Type } from "class-transformer" -import { - Min, - IsOptional, - IsArray, - IsString, - IsBoolean, - IsObject, - IsInt, - IsNotEmpty, - IsNumber, - ValidateNested, -} from "class-validator" -import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." import { IdempotencyKeyService, OrderService, ReturnService, SwapService, } from "../../../../services" -import { validator } from "../../../../utils/validator" +import { + IsArray, + IsBoolean, + IsInt, + IsNotEmpty, + IsNumber, + IsObject, + IsOptional, + IsString, + Min, + ValidateNested, +} from "class-validator" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { EntityManager } from "typeorm" +import { MedusaError } from "medusa-core-utils" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [post] /order/{id}/swaps @@ -29,7 +30,7 @@ import { EntityManager } from "typeorm" * description: "Creates a Swap. Swaps are used to handle Return of previously purchased goods and Fulfillment of replacements simultaneously." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -46,18 +47,26 @@ import { EntityManager } from "typeorm" * - quantity * properties: * item_id: - * description: The id of the Line Item that will be claimed. + * description: The ID of the Line Item that will be claimed. * type: string * quantity: * description: The number of items that will be returned * type: integer + * reason_id: + * description: The ID of the Return Reason to use. + * type: string + * note: + * description: An optional note with information about the Return. + * type: string * return_shipping: * description: How the Swap will be returned. * type: object + * required: + * - option_id * properties: * option_id: * type: string - * description: The id of the Shipping Option to create the Shipping Method from. + * description: The ID of the Shipping Option to create the Shipping Method from. * price: * type: integer * description: The price to charge for the Shipping Method. @@ -70,7 +79,7 @@ import { EntityManager } from "typeorm" * - quantity * properties: * variant_id: - * description: The id of the Product Variant to ship. + * description: The ID of the Product Variant to ship. * type: string * quantity: * description: The quantity of the Product Variant to ship. @@ -84,7 +93,7 @@ import { EntityManager } from "typeorm" * - price * properties: * option_id: - * description: The id of the Shipping Option to override with a custom price. + * description: The ID of the Shipping Option to override with a custom price. * type: string * price: * description: The custom price of the Shipping Option. @@ -95,8 +104,9 @@ import { EntityManager } from "typeorm" * allow_backorder: * description: If true, swaps can be completed with items out of stock * type: boolean + * default: true * tags: - * - Order + * - Swap * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts b/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts index ad413f2f27..9dbf5346bc 100644 --- a/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/fulfill-claim.ts @@ -1,8 +1,10 @@ -import { IsBoolean, IsObject, IsOptional } from "class-validator" -import { EntityManager } from "typeorm" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { ClaimService, OrderService } from "../../../../services" +import { IsBoolean, IsObject, IsOptional } from "class-validator" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + +import { EntityManager } from "typeorm" import { validator } from "../../../../utils/validator" + /** * @oas [post] /orders/{id}/claims/{claim_id}/fulfillments * operationId: "PostOrdersOrderClaimsClaimFulfillments" @@ -10,8 +12,8 @@ import { validator } from "../../../../utils/validator" * description: "Creates a Fulfillment for a Claim." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) claim_id=* {string} The id of the Claim. + * - (path) id=* {string} The ID of the Order. + * - (path) claim_id=* {string} The ID of the Claim. * requestBody: * content: * application/json: @@ -24,7 +26,7 @@ import { validator } from "../../../../utils/validator" * description: If set to true no notification will be send related to this Claim. * type: boolean * tags: - * - Order + * - Fulfillment * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts b/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts index c4c53ed949..fcdb03f6ac 100644 --- a/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts +++ b/packages/medusa/src/api/routes/admin/orders/fulfill-swap.ts @@ -1,8 +1,10 @@ import { IsBoolean, IsObject, IsOptional } from "class-validator" -import { EntityManager } from "typeorm" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." import { OrderService, SwapService } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + +import { EntityManager } from "typeorm" import { validator } from "../../../../utils/validator" + /** * @oas [post] /orders/{id}/swaps/{swap_id}/fulfillments * operationId: "PostOrdersOrderSwapsSwapFulfillments" @@ -10,8 +12,8 @@ import { validator } from "../../../../utils/validator" * description: "Creates a Fulfillment for a Swap." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) swap_id=* {string} The id of the Swap. + * - (path) id=* {string} The ID of the Order. + * - (path) swap_id=* {string} The ID of the Swap. * requestBody: * content: * application/json: @@ -24,7 +26,7 @@ import { validator } from "../../../../utils/validator" * description: If set to true no notification will be send related to this Claim. * type: boolean * tags: - * - Order + * - Fulfillment * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/get-order.ts b/packages/medusa/src/api/routes/admin/orders/get-order.ts index 9400ad489a..9e88eb96d3 100644 --- a/packages/medusa/src/api/routes/admin/orders/get-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/get-order.ts @@ -7,7 +7,7 @@ import { OrderService } from "../../../../services" * description: "Retrieves an Order" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/admin/orders/list-orders.ts b/packages/medusa/src/api/routes/admin/orders/list-orders.ts index a9582607cd..1be15dd8bd 100644 --- a/packages/medusa/src/api/routes/admin/orders/list-orders.ts +++ b/packages/medusa/src/api/routes/admin/orders/list-orders.ts @@ -1,9 +1,10 @@ import { IsNumber, IsOptional, IsString } from "class-validator" -import { pick } from "lodash" -import { OrderService } from "../../../../services" + import { AdminListOrdersSelector } from "../../../../types/orders" -import { Type } from "class-transformer" import { Order } from "../../../../models" +import { OrderService } from "../../../../services" +import { Type } from "class-transformer" +import { pick } from "lodash" /** * @oas [get] /orders @@ -12,24 +13,144 @@ import { Order } from "../../../../models" * description: "Retrieves a list of Orders" * x-authenticated: true * parameters: - * - (query) q {string} Query used for searching orders. - * - (query) id {string} Id of the order to search for. - * - (query) status {string[]} Status to search for. - * - (query) fulfillment_status {string[]} Fulfillment status to search for. - * - (query) payment_status {string[]} Payment status to search for. - * - (query) display_id {string} Display id to search for. + * - (query) q {string} Query used for searching orders by shipping address first name, orders' email, and orders' display ID + * - (query) id {string} ID of the order to search for. + * - in: query + * name: status + * style: form + * explode: false + * description: Status to search for + * schema: + * type: array + * items: + * type: string + * enum: [pending, completed, archived, canceled, requires_action] + * - in: query + * name: fulfillment_status + * style: form + * explode: false + * description: Fulfillment status to search for. + * schema: + * type: array + * items: + * type: string + * enum: [not_fulfilled, fulfilled, partially_fulfilled, shipped, partially_shipped, canceled, returned, partially_returned, requires_action] + * - in: query + * name: payment_status + * style: form + * explode: false + * description: Payment status to search for. + * schema: + * type: array + * items: + * type: string + * enum: [captured, awaiting, not_paid, refunded, partially_refunded, canceled, requires_action] + * - (query) display_id {string} Display ID to search for. * - (query) cart_id {string} to search for. * - (query) customer_id {string} to search for. * - (query) email {string} to search for. - * - (query) region_id {string} to search for. - * - (query) currency_code {string} to search for. + * - in: query + * name: region_id + * style: form + * explode: false + * description: Regions to search orders by + * schema: + * oneOf: + * - type: string + * description: ID of a Region. + * - type: array + * items: + * type: string + * description: ID of a Region. + * - in: query + * name: currency_code + * style: form + * explode: false + * description: Currency code to search for + * schema: + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * - (query) tax_rate {string} to search for. - * - (query) sales_chanel_id {string[]} to retrieve products in. - * - (query) cancelled_at {DateComparisonOperator} Date comparison for when resulting orders was cancelled, i.e. less than, greater than etc. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting orders was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting orders was updated, i.e. less than, greater than etc. - * - (query) offset {string} How many orders to skip in the result. - * - (query) limit {string} Limit the number of orders returned. + * - in: query + * name: created_at + * description: Date comparison for when resulting orders were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting orders were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: canceled_at + * description: Date comparison for when resulting orders were canceled. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: sales_channel_id + * style: form + * explode: false + * description: Filter by Sales Channels + * schema: + * type: array + * items: + * type: string + * description: The ID of a Sales Channel + * - (query) offset=0 {integer} How many orders to skip before the results. + * - (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) fields {string} (Comma separated) Which fields should be included in each order of the result. * tags: @@ -45,6 +166,15 @@ import { Order } from "../../../../models" * type: array * items: * $ref: "#/components/schemas/order" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const orderService: OrderService = req.scope.resolve("orderService") diff --git a/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts b/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts index 8d62c71229..d50a3c507d 100644 --- a/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts +++ b/packages/medusa/src/api/routes/admin/orders/process-swap-payment.ts @@ -1,6 +1,7 @@ -import { EntityManager } from "typeorm" -import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." import { OrderService, SwapService } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + +import { EntityManager } from "typeorm" /** * @oas [post] /orders/{id}/swaps/{swap_id}/process-payment @@ -9,10 +10,10 @@ import { OrderService, SwapService } from "../../../../services" * description: "When there are differences between the returned and shipped Products in a Swap, the difference must be processed. Either a Refund will be issued or a Payment will be captured." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) swap_id=* {string} The id of the Swap. + * - (path) id=* {string} The ID of the Order. + * - (path) swap_id=* {string} The ID of the Swap. * tags: - * - Order + * - Swap * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/refund-payment.ts b/packages/medusa/src/api/routes/admin/orders/refund-payment.ts index c950a6d196..2faa47ef85 100644 --- a/packages/medusa/src/api/routes/admin/orders/refund-payment.ts +++ b/packages/medusa/src/api/routes/admin/orders/refund-payment.ts @@ -5,19 +5,20 @@ import { IsOptional, IsString, } from "class-validator" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { OrderService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" /** - * @oas [post] /orders/{id}/refunds + * @oas [post] /orders/{id}/refund * operationId: "PostOrdersOrderRefunds" * summary: "Create a Refund" * description: "Issues a Refund." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -33,7 +34,7 @@ import { EntityManager } from "typeorm" * description: The reason for the Refund. * type: string * note: - * description: A not with additional details about the Refund. + * description: A note with additional details about the Refund. * type: string * no_notification: * description: If set to true no notification will be send related to this Refund. diff --git a/packages/medusa/src/api/routes/admin/orders/request-return.ts b/packages/medusa/src/api/routes/admin/orders/request-return.ts index 26641cfdf3..a79d5fc7c0 100644 --- a/packages/medusa/src/api/routes/admin/orders/request-return.ts +++ b/packages/medusa/src/api/routes/admin/orders/request-return.ts @@ -1,4 +1,8 @@ -import { Type } from "class-transformer" +import { + EventBusService, + OrderService, + ReturnService, +} from "../../../../services" import { IsArray, IsBoolean, @@ -7,25 +11,22 @@ import { IsString, ValidateNested, } from "class-validator" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + import { MedusaError } from "medusa-core-utils" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." -import { - EventBusService, - OrderService, - ReturnService, -} from "../../../../services" import { OrdersReturnItem } from "../../../../types/orders" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" /** - * @oas [post] /orders/{id}/returns + * @oas [post] /orders/{id}/return * operationId: "PostOrdersOrderReturns" * summary: "Request a Return" * description: "Requests a Return. If applicable a return label will be created and other plugins notified." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -37,12 +38,15 @@ import { EntityManager } from "typeorm" * description: The Line Items that will be returned. * type: array * items: + * required: + * - item_id + * - quantity * properties: * item_id: - * description: The id of the Line Item. + * description: The ID of the Line Item. * type: string * reason_id: - * description: The id of the Return Reason to use. + * description: The ID of the Return Reason to use. * type: string * note: * description: An optional note with information about the Return. @@ -56,13 +60,17 @@ import { EntityManager } from "typeorm" * properties: * option_id: * type: string - * description: The id of the Shipping Option to create the Shipping Method from. + * description: The ID of the Shipping Option to create the Shipping Method from. * price: * type: integer * description: The price to charge for the Shipping Method. + * note: + * description: An optional note with information about the Return. + * type: string * receive_now: * description: A flag to indicate if the Return should be registerd as received immediately. * type: boolean + * default: false * no_notification: * description: A flag to indicate if no notifications should be emitted related to the requested Return. * type: boolean @@ -70,6 +78,7 @@ import { EntityManager } from "typeorm" * description: The amount to refund. * type: integer * tags: + * - Return * - Order * responses: * 200: diff --git a/packages/medusa/src/api/routes/admin/orders/update-claim.ts b/packages/medusa/src/api/routes/admin/orders/update-claim.ts index 01fb6ada49..cb176b095f 100644 --- a/packages/medusa/src/api/routes/admin/orders/update-claim.ts +++ b/packages/medusa/src/api/routes/admin/orders/update-claim.ts @@ -1,16 +1,17 @@ -import { Type } from "class-transformer" +import { ClaimService, OrderService } from "../../../../services" import { IsArray, - ValidateNested, - IsOptional, - IsString, IsBoolean, IsInt, IsNotEmpty, IsObject, + IsOptional, + IsString, + ValidateNested, } from "class-validator" -import { defaultAdminOrdersRelations, defaultAdminOrdersFields } from "." -import { ClaimService, OrderService } from "../../../../services" +import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." + +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -21,8 +22,8 @@ import { EntityManager } from "typeorm" * description: "Updates a Claim." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. - * - (path) claim_id=* {string} The id of the Claim. + * - (path) id=* {string} The ID of the Order. + * - (path) claim_id=* {string} The ID of the Claim. * requestBody: * content: * application/json: @@ -32,12 +33,16 @@ import { EntityManager } from "typeorm" * description: The Claim Items that the Claim will consist of. * type: array * items: + * required: + * - id + * - images + * - tags * properties: * id: - * description: The id of the Claim Item. + * description: The ID of the Claim Item. * type: string * item_id: - * description: The id of the Line Item that will be claimed. + * description: The ID of the Line Item that will be claimed. * type: string * quantity: * description: The number of items that will be returned @@ -57,21 +62,39 @@ import { EntityManager } from "typeorm" * description: A list o tags to add to the Claim Item * type: array * items: - * type: string + * type: object + * properties: + * id: + * type: string + * description: Tag ID + * value: + * type: string + * description: Tag value * images: * description: A list of image URL's that will be associated with the Claim + * type: array * items: - * type: string + * type: object + * properties: + * id: + * type: string + * description: Image ID + * url: + * type: string + * description: Image URL + * metadata: + * description: An optional set of key-value pairs to hold additional information. + * type: object * shipping_methods: * description: The Shipping Methods to send the additional Line Items with. * type: array * items: * properties: * id: - * description: The id of an existing Shipping Method + * description: The ID of an existing Shipping Method * type: string * option_id: - * description: The id of the Shipping Option to create a Shipping Method from + * description: The ID of the Shipping Option to create a Shipping Method from * type: string * price: * description: The price to charge for the Shipping Method @@ -83,7 +106,7 @@ import { EntityManager } from "typeorm" * description: An optional set of key-value pairs to hold additional information. * type: object * tags: - * - Order + * - Claim * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/orders/update-order.ts b/packages/medusa/src/api/routes/admin/orders/update-order.ts index 8b985a7f5d..287e528043 100644 --- a/packages/medusa/src/api/routes/admin/orders/update-order.ts +++ b/packages/medusa/src/api/routes/admin/orders/update-order.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, @@ -10,10 +9,12 @@ import { ValidateNested, } from "class-validator" import { defaultAdminOrdersFields, defaultAdminOrdersRelations } from "." -import { OrderService } from "../../../../services" + import { AddressPayload } from "../../../../types/common" -import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" +import { OrderService } from "../../../../services" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [post] /orders/{id} @@ -22,7 +23,7 @@ import { EntityManager } from "typeorm" * description: "Updates and order" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Order. + * - (path) id=* {string} The ID of the Order. * requestBody: * content: * application/json: @@ -34,51 +35,57 @@ import { EntityManager } from "typeorm" * billing_address: * description: Billing address * anyOf: - * - $ref: "#/components/schemas/address + * - $ref: "#/components/schemas/address" * shipping_address: * description: Shipping address * anyOf: - * - $ref: "#/components/schemas/address + * - $ref: "#/components/schemas/address" * items: * description: The Line Items for the order * type: array + * items: + * $ref: "#/components/schemas/line_item" * region: - * description: Region where the order belongs + * description: ID of the region where the order belongs * type: string * discounts: * description: Discounts applied to the order * type: array + * items: + * $ref: "#/components/schemas/discount" * customer_id: - * description: id of the customer + * description: ID of the customer * type: string * payment_method: - * description: - * type: Record + * description: payment method chosen for the order + * type: object * properties: * provider_id: * type: string - * description: id of the payment provider + * description: ID of the payment provider * data: * description: Data relevant for the given payment method - * type: Record + * type: object * shipping_method: * description: The Shipping Method used for shipping the order. - * type: Record + * type: object * properties: * provider_id: * type: string - * description: The id of the shipping provider. + * description: The ID of the shipping provider. * profile_id: * type: string - * description: The id of the shipping profile. + * description: The ID of the shipping profile. * price: * type: integer * description: The price of the shipping. * data: - * type: Record + * type: object * description: Data relevant to the specific shipping method. * items: * type: array + * items: + * $ref: "#/components/schemas/line_item" * description: Items to ship * no_notification: * description: A flag to indicate if no notifications should be emitted related to the updated order. diff --git a/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts index 0b869c6992..43b17b8a4b 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/add-prices-batch.ts @@ -1,9 +1,10 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, IsOptional, ValidateNested } from "class-validator" import { defaultAdminPriceListFields, defaultAdminPriceListRelations } from "." + +import { AdminPriceListPricesUpdateReq } from "../../../../types/price-list" import { PriceList } from "../../../.." import PriceListService from "../../../../services/price-list" -import { AdminPriceListPricesUpdateReq } from "../../../../types/price-list" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -14,44 +15,47 @@ import { EntityManager } from "typeorm" * description: "Batch update prices for a Price List" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List to update prices for. + * - (path) id=* {string} The ID of the Price List to update prices for. * requestBody: * content: - * application/json: - * schema: - * properties: - * prices: - * description: The prices to update or add. - * type: array - * items: - * properties: - * id: - * description: The id of the price. - * type: string - * status: - * description: The status of the Price List. - * type: string - * enum: - * - active - * - draft - * region_id: - * description: The id of the Region for which the price is used. - * type: string - * currency_code: - * description: The 3 character ISO currency code for which the price will be used. - * type: string - * amount: - * description: The amount of the price. - * type: number - * min_quantity: - * description: The minimum quantity for which the price will be used. - * type: number - * max_quantity: - * description: The maximum quantity for which the price will be used. - * type: number - * override: - * description: "If true the prices will replace all existing prices associated with the Price List." - * type: boolean + * application/json: + * schema: + * properties: + * prices: + * description: The prices to update or add. + * type: array + * items: + * required: + * - amount + * - variant_id + * properties: + * id: + * description: The ID of the price. + * type: string + * region_id: + * description: The ID of the Region for which the price is used. Only required if currecny_code is not provided. + * type: string + * currency_code: + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * variant_id: + * description: The ID of the Variant for which the price is used. + * type: string + * amount: + * description: The amount to charge for the Product Variant. + * type: integer + * min_quantity: + * description: The minimum quantity for which the price will be used. + * type: integer + * max_quantity: + * description: The maximum quantity for which the price will be used. + * type: integer + * override: + * description: "If true the prices will replace all existing prices associated with the Price List." + * type: boolean * tags: * - Price List * responses: @@ -61,14 +65,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * id: - * type: string - * description: The id of the deleted Price List. - * object: - * type: string - * description: The type of the object that was deleted. - * deleted: - * type: boolean + * price_list: + * $ref: "#/components/schemas/price_list" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts index 4d6a6f4ef9..cca93408a9 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/create-price-list.ts @@ -1,4 +1,9 @@ -import { Type } from "class-transformer" +import { + AdminPriceListPricesCreateReq, + CreatePriceListInput, + PriceListStatus, + PriceListType, +} from "../../../../types/price-list" import { IsArray, IsEnum, @@ -6,18 +11,14 @@ import { IsString, ValidateNested, } from "class-validator" -import PriceListService from "../../../../services/price-list" -import { - AdminPriceListPricesCreateReq, - CreatePriceListInput, - PriceListStatus, - PriceListType, -} from "../../../../types/price-list" -import { Request } from "express" + import { EntityManager } from "typeorm" +import PriceListService from "../../../../services/price-list" +import { Request } from "express" +import { Type } from "class-transformer" /** - * @oas [post] /price_lists + * @oas [post] /price-lists * operationId: "PostPriceListsPriceList" * summary: "Creates a Price List" * description: "Creates a Price List" @@ -26,6 +27,11 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: + * required: + * - name + * - description + * - type + * - prices * properties: * name: * description: "The name of the Price List" @@ -33,47 +39,64 @@ import { EntityManager } from "typeorm" * description: * description: "A description of the Price List." * type: string + * starts_at: + * description: "The date with timezone that the Price List starts being valid." + * type: string + * format: date + * ends_at: + * description: "The date with timezone that the Price List ends being valid." + * type: string + * format: date * type: * description: The type of the Price List. * type: string * enum: * - sale * - override - * status: - * description: The status of the Price List. - * type: string - * enum: - * - active - * - draft - * prices: - * description: The prices of the Price List. - * type: array - * items: - * properties: - * region_id: - * description: The id of the Region for which the price is used. - * type: string - * currency_code: - * description: The 3 character ISO currency code for which the price will be used. - * type: string - * amount: - * description: The amount to charge for the Product Variant. - * type: integer - * min_quantity: - * description: The minimum quantity for which the price will be used. - * type: integer - * max_quantity: - * description: The maximum quantity for which the price will be used. - * type: integer - * customer_groups: - * type: array + * status: + * description: The status of the Price List. + * type: string + * enum: + * - active + * - draft + * prices: + * description: The prices of the Price List. + * type: array + * items: + * required: + * - amount + * - variant_id + * properties: + * region_id: + * description: The ID of the Region for which the price is used. Only required if currecny_code is not provided. + * type: string + * currency_code: + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * amount: + * description: The amount to charge for the Product Variant. + * type: integer + * variant_id: + * description: The ID of the Variant for which the price is used. + * type: string + * min_quantity: + * description: The minimum quantity for which the price will be used. + * type: integer + * max_quantity: + * description: The maximum quantity for which the price will be used. + * type: integer + * customer_groups: + * type: array * description: A list of customer groups that the Price List applies to. * items: * required: * - id * properties: * id: - * description: The id of a customer group + * description: The ID of a customer group * type: string * tags: * - Price List @@ -84,7 +107,7 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * product: + * price_list: * $ref: "#/components/schemas/price_list" */ export default async (req: Request, res) => { diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts index 3f1f8c9f5b..9862c36d1f 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-price-list.ts @@ -1,5 +1,5 @@ -import PriceListService from "../../../../services/price-list" import { EntityManager } from "typeorm" +import PriceListService from "../../../../services/price-list" /** * @oas [delete] /price-lists/{id} @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Price List" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List to delete. + * - (path) id=* {string} The ID of the Price List to delete. * tags: * - Price List * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Price List. + * description: The ID of the deleted Price List. * object: * type: string * description: The type of the object that was deleted. + * default: price-list * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts index 69cd571ec6..94dcc05ba4 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-prices-batch.ts @@ -1,26 +1,27 @@ import { ArrayNotEmpty, IsString } from "class-validator" + +import { EntityManager } from "typeorm" import PriceListService from "../../../../services/price-list" import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" /** * @oas [delete] /price-lists/{id}/prices/batch * operationId: "DeletePriceListsPriceListPricesBatch" - * summary: "Batch delete prices that belongs to a Price List" - * description: "Batch delete prices that belongs to a Price List" + * summary: "Batch delete prices that belong to a Price List" + * description: "Batch delete prices that belong to a Price List" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List that the Money Amounts that will be deleted belongs to. + * - (path) id=* {string} The ID of the Price List that the Money Amounts (Prices) that will be deleted belongs to. * requestBody: - * content: - * application/json: - * schema: - * properties: - * price_ids: - * description: The price id's of the Money Amounts to delete. - * type: array - * items: - * type: string + * content: + * application/json: + * schema: + * properties: + * price_ids: + * description: The price id's of the Money Amounts to delete. + * type: array + * items: + * type: string * tags: * - Price List * responses: @@ -34,12 +35,15 @@ import { EntityManager } from "typeorm" * type: array * items: * type: string - * description: The id of the deleted Money Amount. + * description: The IDs of the deleted Money Amounts (Prices). * object: * type: string * description: The type of the object that was deleted. + * default: money-amount * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts index a02578c589..fe52565131 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-product-prices.ts @@ -1,5 +1,5 @@ -import PriceListService from "../../../../services/price-list" import { EntityManager } from "typeorm" +import PriceListService from "../../../../services/price-list" /** * @oas [delete] /price-lists/{id}/products/{product_id}/prices @@ -8,8 +8,8 @@ import { EntityManager } from "typeorm" * description: "Delete all the prices related to a specific product in a price list" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List that the Money Amounts that will be deleted belongs to. - * - (path) product_id=* {string} The id of the product from which the money amount will be deleted. + * - (path) id=* {string} The ID of the Price List that the Money Amounts that will be deleted belongs to. + * - (path) product_id=* {string} The ID of the product from which the money amount will be deleted. * tags: * - Price List * responses: @@ -20,16 +20,18 @@ import { EntityManager } from "typeorm" * schema: * properties: * ids: - * type: number + * type: array * description: The price ids that have been deleted. - * count: - * type: number - * description: The number of prices that have been deleted. - * object: - * type: string - * description: The type of the object that was deleted. - * deleted: - * type: boolean + * items: + * type: string + * object: + * type: string + * description: The type of the object that was deleted. + * default: money-amount + * deleted: + * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id, product_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts b/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts index 544ad7479f..f38457851e 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/delete-variant-prices.ts @@ -1,5 +1,5 @@ -import PriceListService from "../../../../services/price-list" import { EntityManager } from "typeorm" +import PriceListService from "../../../../services/price-list" /** * @oas [delete] /price-lists/{id}/variants/{variant_id}/prices @@ -8,8 +8,8 @@ import { EntityManager } from "typeorm" * description: "Delete all the prices related to a specific variant in a price list" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List that the Money Amounts that will be deleted belongs to. - * - (path) variant_id=* {string} The id of the variant from which the money amount will be deleted. + * - (path) id=* {string} The ID of the Price List that the Money Amounts that will be deleted belongs to. + * - (path) variant_id=* {string} The ID of the variant from which the money amount will be deleted. * tags: * - Price List * responses: @@ -20,16 +20,18 @@ import { EntityManager } from "typeorm" * schema: * properties: * ids: - * type: number + * type: array * description: The price ids that have been deleted. - * count: - * type: number - * description: The number of prices that have been deleted. - * object: - * type: string - * description: The type of the object that was deleted. - * deleted: - * type: boolean + * items: + * type: string + * object: + * type: string + * description: The type of the object that was deleted. + * default: money-amount + * deleted: + * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id, variant_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts index 68571c9cc5..13fc214ca4 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/get-price-list.ts @@ -1,4 +1,5 @@ import { defaultAdminPriceListFields, defaultAdminPriceListRelations } from "." + import { PriceList } from "../../../.." import PriceListService from "../../../../services/price-list" @@ -9,7 +10,7 @@ import PriceListService from "../../../../services/price-list" * description: "Retrieves a Price List." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List. + * - (path) id=* {string} The ID of the Price List. * tags: * - Price List * responses: diff --git a/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts b/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts index b8db448e5c..02d326f7ca 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/list-price-list-products.ts @@ -1,5 +1,7 @@ -import { Type } from "class-transformer" -import { pickBy } from "lodash" +import { + DateComparisonOperator, + extendedFindParamsMixin, +} from "../../../../types/common" import { IsArray, IsBoolean, @@ -8,14 +10,13 @@ import { IsString, ValidateNested, } from "class-validator" -import { ProductStatus } from "../../../../models" -import { - DateComparisonOperator, - extendedFindParamsMixin, -} from "../../../../types/common" + import { FilterableProductProps } from "../../../../types/product" import PriceListService from "../../../../services/price-list" +import { ProductStatus } from "../../../../models" import { Request } from "express" +import { Type } from "class-transformer" +import { pickBy } from "lodash" /** * @oas [get] /price-lists/:id/products @@ -24,22 +25,110 @@ import { Request } from "express" * description: "Retrieves a list of Product that are part of a Price List" * x-authenticated: true * parameters: - * - (query) q {string} Query used for searching products. - * - (query) id {string} Id of the product to search for. - * - (query) status {string[]} Status to search for. - * - (query) collection_id {string[]} Collection ids to search for. - * - (query) tags {string[]} Tags to search for. - * - (query) title {string} to search for. - * - (query) description {string} to search for. - * - (query) handle {string} to search for. + * - (query) q {string} Query used for searching product title and description, variant title and sku, and collection title. + * - (query) id {string} ID of the product to search for. + * - in: query + * name: status + * description: Product status to search for + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * enum: [draft, proposed, published, rejected] + * - in: query + * name: collection_id + * description: Collection IDs to search for + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: tags + * description: Tag IDs to search for + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - (query) title {string} product title to search for. + * - (query) description {string} product description to search for. + * - (query) handle {string} product handle to search for. * - (query) is_giftcard {string} Search for giftcards using is_giftcard=true. * - (query) type {string} to search for. - * - (query) order {string} to retrieve products in. - * - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting products was deleted, i.e. less than, greater than etc. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting products was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting products was updated, i.e. less than, greater than etc. - * - (query) offset {string} How many products to skip in the result. - * - (query) limit {string} Limit the number of products returned. + * - (query) order {string} field to sort results by. + * - in: query + * name: created_at + * description: Date comparison for when resulting products were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting products were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: deleted_at + * description: Date comparison for when resulting products were deleted. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - (query) offset=0 {integer} How many products to skip in the result. + * - (query) limit=50 {integer} Limit the number of products returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each product of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each product of the result. * tags: @@ -51,19 +140,19 @@ import { Request } from "express" * application/json: * schema: * properties: - * count: - * description: The number of Products. - * type: integer - * offset: - * description: The offset of the Product query. - * type: integer - * limit: - * description: The limit of the Product query. - * type: integer * products: * type: array * items: * $ref: "#/components/schemas/product" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts b/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts index c45804f689..6653e086fd 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/list-price-lists.ts @@ -1,14 +1,119 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString } from "class-validator" -import PriceListService from "../../../../services/price-list" + import { FilterablePriceListProps } from "../../../../types/price-list" +import PriceListService from "../../../../services/price-list" import { Request } from "express" +import { Type } from "class-transformer" + /** * @oas [get] /price-lists * operationId: "GetPriceLists" * summary: "List Price Lists" * description: "Retrieves a list of Price Lists." * x-authenticated: true + * parameters: + * - (query) limit=10 {number} The number of items to get + * - (query) offset=0 {number} The offset at which to get items + * - (query) expand {string} (Comma separated) Which fields should be expanded in each item of the result. + * - (query) order {string} field to order results by. + * - (query) id {string} ID to search for. + * - (query) q {string} query to search in price list description, price list name, and customer group name fields. + * - in: query + * name: status + * style: form + * explode: false + * description: Status to search for. + * schema: + * type: array + * items: + * type: string + * enum: [active, draft] + * - (query) name {string} price list name to search for. + * - in: query + * name: customer_groups + * style: form + * explode: false + * description: Customer Group IDs to search for. + * schema: + * type: array + * items: + * type: string + * - in: query + * name: type + * style: form + * explode: false + * description: Type to search for. + * schema: + * type: array + * items: + * type: string + * enum: [sale, override] + * - in: query + * name: created_at + * description: Date comparison for when resulting price lists were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting price lists were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: deleted_at + * description: Date comparison for when resulting price lists were deleted. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: * - Price List * responses: @@ -23,14 +128,14 @@ import { Request } from "express" * items: * $ref: "#/components/schemas/price_list" * count: - * description: The number of Price Lists. * type: integer + * description: The total number of items available * offset: - * description: The offset of the Price List query. * type: integer + * description: The number of items skipped before these items * limit: - * description: The limit of the Price List query. * type: integer + * description: The number of items per page */ export default async (req: Request, res) => { const validated = req.validatedQuery diff --git a/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts b/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts index 887abac188..6b53148151 100644 --- a/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts +++ b/packages/medusa/src/api/routes/admin/price-lists/update-price-list.ts @@ -1,4 +1,8 @@ -import { Type } from "class-transformer" +import { + AdminPriceListPricesUpdateReq, + PriceListStatus, + PriceListType, +} from "../../../../types/price-list" import { IsArray, IsEnum, @@ -7,24 +11,21 @@ import { ValidateNested, } from "class-validator" import { defaultAdminPriceListFields, defaultAdminPriceListRelations } from "." + import { PriceList } from "../../../.." import PriceListService from "../../../../services/price-list" -import { - AdminPriceListPricesUpdateReq, - PriceListStatus, - PriceListType, -} from "../../../../types/price-list" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" /** - * @oas [post] /price_lists/{id} + * @oas [post] /price-lists/{id} * operationId: "PostPriceListsPriceListPriceList" * summary: "Update a Price List" * description: "Updates a Price List" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Price List. + * - (path) id=* {string} The ID of the Price List. * requestBody: * content: * application/json: @@ -36,50 +37,67 @@ import { EntityManager } from "typeorm" * description: * description: "A description of the Price List." * type: string + * starts_at: + * description: "The date with timezone that the Price List starts being valid." + * type: string + * format: date + * ends_at: + * description: "The date with timezone that the Price List ends being valid." + * type: string + * format: date * type: * description: The type of the Price List. * type: string * enum: * - sale * - override - * status: - * description: The status of the Price List. - * type: string - * enum: - * - active - * - draft - * prices: - * description: The prices of the Price List. - * type: array - * items: - * properties: - * id: - * description: The id of the price. - * type: string - * region_id: - * description: The id of the Region for which the price is used. - * type: string - * currency_code: - * description: The 3 character ISO currency code for which the price will be used. - * type: string - * amount: - * description: The amount to charge for the Product Variant. - * type: integer - * min_quantity: - * description: The minimum quantity for which the price will be used. - * type: integer - * max_quantity: - * description: The maximum quantity for which the price will be used. - * type: integer - * customer_groups: - * type: array + * status: + * description: The status of the Price List. + * type: string + * enum: + * - active + * - draft + * prices: + * description: The prices of the Price List. + * type: array + * items: + * required: + * - amount + * - variant_id + * properties: + * id: + * description: The ID of the price. + * type: string + * region_id: + * description: The ID of the Region for which the price is used. Only required if currecny_code is not provided. + * type: string + * currency_code: + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * variant_id: + * description: The ID of the Variant for which the price is used. + * type: string + * amount: + * description: The amount to charge for the Product Variant. + * type: integer + * min_quantity: + * description: The minimum quantity for which the price will be used. + * type: integer + * max_quantity: + * description: The maximum quantity for which the price will be used. + * type: integer + * customer_groups: + * type: array * description: A list of customer groups that the Price List applies to. * items: * required: * - id * properties: * id: - * description: The id of a customer group + * description: The ID of a customer group * type: string * tags: * - Price List @@ -90,7 +108,7 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * product: + * price_list: * $ref: "#/components/schemas/price_list" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts b/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts index 6638e8e93a..f4dbafe5e9 100644 --- a/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts +++ b/packages/medusa/src/api/routes/admin/product-tags/list-product-tags.ts @@ -1,21 +1,22 @@ -import { Type } from "class-transformer" -import { IsNumber, IsOptional, IsString } from "class-validator" -import { identity, omit, pickBy } from "lodash" -import { MedusaError } from "medusa-core-utils" -import { - allowedAdminProductTagsFields, - defaultAdminProductTagsFields, - defaultAdminProductTagsRelations, -} from "." -import { ProductTag } from "../../../../models/product-tag" -import ProductTagService from "../../../../services/product-tag" import { DateComparisonOperator, FindConfig, StringComparisonOperator, } from "../../../../types/common" -import { validator } from "../../../../utils/validator" +import { IsNumber, IsOptional, IsString } from "class-validator" +import { + allowedAdminProductTagsFields, + defaultAdminProductTagsFields, + defaultAdminProductTagsRelations, +} from "." +import { identity, omit, pickBy } from "lodash" + import { IsType } from "../../../../utils/validators/is-type" +import { MedusaError } from "medusa-core-utils" +import { ProductTag } from "../../../../models/product-tag" +import ProductTagService from "../../../../services/product-tag" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [get] /product-tags @@ -24,12 +25,72 @@ import { IsType } from "../../../../utils/validators/is-type" * description: "Retrieve a list of Product Tags." * x-authenticated: true * parameters: - * - (query) limit {string} The number of tags to return. - * - (query) offset {string} The offset of tags to return. - * - (query) value {string} The value of tags to return. - * - (query) id {string} The id of tags to return. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting tas was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting tas was updated, i.e. less than, greater than etc. + * - (query) limit=10 {integer} The number of tags to return. + * - (query) offset=0 {integer} The number of items to skip before the results. + * - (query) order {string} The field to sort items by. + * - in: query + * name: value + * style: form + * explode: false + * description: The tag values to search for + * schema: + * type: array + * items: + * type: string + * - (query) q {string} A query string to search values for + * - in: query + * name: id + * style: form + * explode: false + * description: The tag IDs to search for + * schema: + * type: array + * items: + * type: string + * - in: query + * name: created_at + * description: Date comparison for when resulting product tags were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting product tags were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: * - Product Tag * responses: @@ -39,8 +100,17 @@ import { IsType } from "../../../../utils/validators/is-type" * application/json: * schema: * properties: - * tags: + * product_tags: * $ref: "#/components/schemas/product_tag" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(AdminGetProductTagsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts b/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts index d04d1db731..8fe0d9260c 100644 --- a/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts +++ b/packages/medusa/src/api/routes/admin/product-types/list-product-types.ts @@ -1,21 +1,22 @@ -import { Type } from "class-transformer" -import { IsNumber, IsOptional, IsString } from "class-validator" -import { identity, omit, pickBy } from "lodash" -import { MedusaError } from "medusa-core-utils" -import { - allowedAdminProductTypeFields, - defaultAdminProductTypeFields, - defaultAdminProductTypeRelations, -} from "." -import { ProductType } from "../../../../models/product-type" -import ProductTypeService from "../../../../services/product-type" import { DateComparisonOperator, FindConfig, StringComparisonOperator, } from "../../../../types/common" -import { validator } from "../../../../utils/validator" +import { IsNumber, IsOptional, IsString } from "class-validator" +import { + allowedAdminProductTypeFields, + defaultAdminProductTypeFields, + defaultAdminProductTypeRelations, +} from "." +import { identity, omit, pickBy } from "lodash" + import { IsType } from "../../../../utils/validators/is-type" +import { MedusaError } from "medusa-core-utils" +import { ProductType } from "../../../../models/product-type" +import ProductTypeService from "../../../../services/product-type" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [get] /product-types @@ -24,14 +25,74 @@ import { IsType } from "../../../../utils/validators/is-type" * description: "Retrieve a list of Product Types." * x-authenticated: true * parameters: - * - (query) limit {string} The number of types to return. - * - (query) offset {string} The offset of types to return. - * - (query) value {string} The value of types to return. - * - (query) id {string} The id of types to return. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting tas was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting tas was updated, i.e. less than, greater than etc. + * - (query) limit=10 {integer} The number of types to return. + * - (query) offset=0 {integer} The number of items to skip before the results. + * - (query) order {string} The field to sort items by. + * - in: query + * name: value + * style: form + * explode: false + * description: The type values to search for + * schema: + * type: array + * items: + * type: string + * - in: query + * name: id + * style: form + * explode: false + * description: The type IDs to search for + * schema: + * type: array + * items: + * type: string + * - (query) q {string} A query string to search values for + * - in: query + * name: created_at + * description: Date comparison for when resulting product types were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting product types were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: - * - Product Tag + * - Product Type * responses: * "200": * description: OK @@ -39,8 +100,17 @@ import { IsType } from "../../../../utils/validators/is-type" * application/json: * schema: * properties: - * types: - * $ref: "#/components/schemas/product_tag" + * product_types: + * $ref: "#/components/schemas/product_type" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(AdminGetProductTypesParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/products/add-option.ts b/packages/medusa/src/api/routes/admin/products/add-option.ts index 2357c86977..3fa80b9020 100644 --- a/packages/medusa/src/api/routes/admin/products/add-option.ts +++ b/packages/medusa/src/api/routes/admin/products/add-option.ts @@ -1,6 +1,7 @@ -import { IsString } from "class-validator" +import { PricingService, ProductService } from "../../../../services" import { defaultAdminProductFields, defaultAdminProductRelations } from "." -import { ProductService, PricingService } from "../../../../services" + +import { IsString } from "class-validator" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -11,7 +12,7 @@ import { EntityManager } from "typeorm" * x-authenticated: true * description: "Adds a Product Option to a Product" * parameters: - * - (path) id=* {string} The id of the Product. + * - (path) id=* {string} The ID of the Product. * requestBody: * content: * application/json: diff --git a/packages/medusa/src/api/routes/admin/products/create-product.ts b/packages/medusa/src/api/routes/admin/products/create-product.ts index 4c1fa71c50..803bbdbe08 100644 --- a/packages/medusa/src/api/routes/admin/products/create-product.ts +++ b/packages/medusa/src/api/routes/admin/products/create-product.ts @@ -1,4 +1,7 @@ -import { Type } from "class-transformer" +import { + CreateProductVariantInput, + ProductVariantPricesCreateReq, +} from "../../../../types/product-variant" import { IsArray, IsBoolean, @@ -9,10 +12,6 @@ import { IsString, ValidateNested, } from "class-validator" -import { EntityManager } from "typeorm" -import { defaultAdminProductFields, defaultAdminProductRelations } from "." -import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels" -import { ProductStatus } from "../../../../models" import { PricingService, ProductService, @@ -24,11 +23,13 @@ import { ProductTagReq, ProductTypeReq, } from "../../../../types/product" +import { defaultAdminProductFields, defaultAdminProductRelations } from "." + +import { EntityManager } from "typeorm" import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators" -import { - CreateProductVariantInput, - ProductVariantPricesCreateReq, -} from "../../../../types/product-variant" +import { ProductStatus } from "../../../../models" +import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** @@ -40,10 +41,6 @@ import { validator } from "../../../../utils/validator" * requestBody: * content: * application/json: - * required: - * - title - * - subtitle - * - description * schema: * required: * - title @@ -60,9 +57,11 @@ import { validator } from "../../../../utils/validator" * is_giftcard: * description: A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to `true` will result in a Gift Card being created. * type: boolean + * default: false * discountable: * description: A flag to indicate if discounts can be applied to the LineItems generated from this Product * type: boolean + * default: true * images: * description: Images of the Product. * type: array @@ -74,39 +73,55 @@ import { validator } from "../../../../utils/validator" * handle: * description: A unique handle to identify the Product by. * type: string + * status: + * description: The status of the product. + * type: string + * enum: [draft, proposed, published, rejected] + * default: draft * type: * description: The Product Type to associate the Product with. * type: object + * required: + * - value * properties: + * id: + * description: The ID of the Product Type. + * type: string * value: * description: The value of the Product Type. * type: string * collection_id: - * description: The id of the Collection the Product should belong to. + * description: The ID of the Collection the Product should belong to. * type: string * tags: * description: Tags to associate the Product with. * type: array * items: + * required: + * - value * properties: * id: - * description: The id of an existing Tag. + * description: The ID of an existing Tag. * type: string * value: * description: The value of the Tag, these will be upserted. * type: string - * sales_channels: - * description: [EXPERIMENTAL] Sales channels to associate the Product with. + * sales_channels: + * description: "[EXPERIMENTAL] Sales channels to associate the Product with." * type: array * items: + * required: + * - id * properties: * id: - * description: The id of an existing Sales channel. + * description: The ID of an existing Sales channel. * type: string * options: * description: The Options that the Product should have. These define on which properties the Product's Product Variants will differ. * type: array * items: + * required: + * - title * properties: * title: * description: The title to identify the Product Option by. @@ -115,6 +130,8 @@ import { validator } from "../../../../utils/validator" * description: A list of Product Variants to create with the Product. * type: array * items: + * required: + * - title * properties: * title: * description: The title to identify the Product Variant by. @@ -137,6 +154,7 @@ import { validator } from "../../../../utils/validator" * inventory_quantity: * description: The amount of stock kept for the Product Variant. * type: integer + * default: 0 * allow_backorder: * description: Whether the Product Variant can be purchased when out of stock. * type: boolean @@ -145,16 +163,16 @@ import { validator } from "../../../../utils/validator" * type: boolean * weight: * description: The wieght of the Product Variant. - * type: string + * type: number * length: * description: The length of the Product Variant. - * type: string + * type: number * height: * description: The height of the Product Variant. - * type: string + * type: number * width: * description: The width of the Product Variant. - * type: string + * type: number * origin_country: * description: The country of origin of the Product Variant. * type: string @@ -170,37 +188,50 @@ import { validator } from "../../../../utils/validator" * prices: * type: array * items: + * required: + * - amount * properties: * region_id: - * description: The id of the Region for which the price is used. + * description: The ID of the Region for which the price is used. Only required if currency_code is not provided. * type: string * currency_code: - * description: The 3 character ISO currency code for which the price will be used. + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * amount: * description: The amount to charge for the Product Variant. * type: integer - * sale_amount: - * description: The sale amount to charge for the Product Variant. + * min_quantity: + * description: The minimum quantity for which the price will be used. + * type: integer + * max_quantity: + * description: The maximum quantity for which the price will be used. * type: integer * options: * type: array * items: + * required: + * - value * properties: * value: * description: The value to give for the Product Option at the same index in the Product's `options` field. * type: string * weight: * description: The wieght of the Product. - * type: string + * type: number * length: * description: The length of the Product. - * type: string + * type: number * height: * description: The height of the Product. - * type: string + * type: number * width: * description: The width of the Product. + * type: number + * hs_code: + * description: The Harmonized System code for the Product Variant. * type: string * origin_country: * description: The country of origin of the Product. diff --git a/packages/medusa/src/api/routes/admin/products/create-variant.ts b/packages/medusa/src/api/routes/admin/products/create-variant.ts index 135eeadb8d..5e4958ab3f 100644 --- a/packages/medusa/src/api/routes/admin/products/create-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/create-variant.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, @@ -8,9 +7,11 @@ import { IsString, ValidateNested, } from "class-validator" -import { defaultAdminProductFields, defaultAdminProductRelations } from "." import { ProductService, ProductVariantService } from "../../../../services" +import { defaultAdminProductFields, defaultAdminProductRelations } from "." + import { ProductVariantPricesCreateReq } from "../../../../types/product-variant" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -21,7 +22,7 @@ import { EntityManager } from "typeorm" * description: "Creates a Product Variant. Each Product Variant must have a unique combination of Product Option Values." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. + * - (path) id=* {string} The ID of the Product. * requestBody: * content: * application/json: @@ -52,6 +53,7 @@ import { EntityManager } from "typeorm" * inventory_quantity: * description: The amount of stock kept for the Product Variant. * type: integer + * default: 0 * allow_backorder: * description: Whether the Product Variant can be purchased when out of stock. * type: boolean @@ -60,16 +62,16 @@ import { EntityManager } from "typeorm" * type: boolean * weight: * description: The wieght of the Product Variant. - * type: string + * type: number * length: * description: The length of the Product Variant. - * type: string + * type: number * height: * description: The height of the Product Variant. - * type: string + * type: number * width: * description: The width of the Product Variant. - * type: string + * type: number * origin_country: * description: The country of origin of the Product Variant. * type: string @@ -85,28 +87,39 @@ import { EntityManager } from "typeorm" * prices: * type: array * items: + * required: + * - amount * properties: + * id: + * description: The ID of the price. + * type: string * region_id: - * description: The id of the Region for which the price is used. + * description: The ID of the Region for which the price is used. Only required if currency_code is not provided. * type: string * currency_code: - * description: The 3 character ISO currency code for which the price will be used. + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * amount: * description: The amount to charge for the Product Variant. * type: integer * min_quantity: - * description: The minimum quantity for which the price will be used. - * type: integer + * description: The minimum quantity for which the price will be used. + * type: integer * max_quantity: * description: The maximum quantity for which the price will be used. * type: integer * options: * type: array * items: + * required: + * - option_id + * - value * properties: * option_id: - * description: The id of the Product Option to set the value for. + * description: The ID of the Product Option to set the value for. * type: string * value: * description: The value to give for the Product Option. diff --git a/packages/medusa/src/api/routes/admin/products/delete-option.ts b/packages/medusa/src/api/routes/admin/products/delete-option.ts index 692dc0a37f..e5e7909dc2 100644 --- a/packages/medusa/src/api/routes/admin/products/delete-option.ts +++ b/packages/medusa/src/api/routes/admin/products/delete-option.ts @@ -1,6 +1,7 @@ import { defaultAdminProductFields, defaultAdminProductRelations } from "." -import { ProductService } from "../../../../services" + import { EntityManager } from "typeorm" +import { ProductService } from "../../../../services" /** * @oas [delete] /products/{id}/options/{option_id} @@ -9,8 +10,8 @@ import { EntityManager } from "typeorm" * description: "Deletes a Product Option. Before a Product Option can be deleted all Option Values for the Product Option must be the same. You may, for example, have to delete some of your variants prior to deleting the Product Option" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. - * - (path) option_id=* {string} The id of the Product Option. + * - (path) id=* {string} The ID of the Product. + * - (path) option_id=* {string} The ID of the Product Option. * tags: * - Product * responses: @@ -20,14 +21,17 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * id: + * option_id: * type: string - * description: The id of the deleted Product Option + * description: The ID of the deleted Product Option * object: * type: string * description: The type of the object that was deleted. + * default: option * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true * product: * $ref: "#/components/schemas/product" */ diff --git a/packages/medusa/src/api/routes/admin/products/delete-product.ts b/packages/medusa/src/api/routes/admin/products/delete-product.ts index f39c50dd23..f8955a7067 100644 --- a/packages/medusa/src/api/routes/admin/products/delete-product.ts +++ b/packages/medusa/src/api/routes/admin/products/delete-product.ts @@ -1,5 +1,5 @@ -import { ProductService } from "../../../../services" import { EntityManager } from "typeorm" +import { ProductService } from "../../../../services" /** * @oas [delete] /products/{id} @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Product and it's associated Product Variants." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. + * - (path) id=* {string} The ID of the Product. * tags: * - Product * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Product. + * description: The ID of the deleted Product. * object: * type: string * description: The type of the object that was deleted. + * default: product * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/delete-variant.ts b/packages/medusa/src/api/routes/admin/products/delete-variant.ts index ff701fc642..ecf09a932f 100644 --- a/packages/medusa/src/api/routes/admin/products/delete-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/delete-variant.ts @@ -1,9 +1,10 @@ -import { defaultAdminProductFields, defaultAdminProductRelations } from "." import { - ProductService, PricingService, + ProductService, ProductVariantService, } from "../../../../services" +import { defaultAdminProductFields, defaultAdminProductRelations } from "." + import { EntityManager } from "typeorm" /** @@ -13,8 +14,8 @@ import { EntityManager } from "typeorm" * description: "Deletes a Product Variant." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. - * - (path) variant_id=* {string} The id of the Product Variant. + * - (path) id=* {string} The ID of the Product. + * - (path) variant_id=* {string} The ID of the Product Variant. * tags: * - Product * responses: @@ -24,14 +25,19 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * id: + * variant_id: * type: string - * description: The id of the deleted Product Variant. + * description: The ID of the deleted Product Variant. * object: * type: string * description: The type of the object that was deleted. + * default: variant * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true + * product: + * $ref: "#/components/schemas/product" */ export default async (req, res) => { const { id, variant_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/get-product.ts b/packages/medusa/src/api/routes/admin/products/get-product.ts index cea4a9783b..5ebb548054 100644 --- a/packages/medusa/src/api/routes/admin/products/get-product.ts +++ b/packages/medusa/src/api/routes/admin/products/get-product.ts @@ -1,4 +1,4 @@ -import { ProductService, PricingService } from "../../../../services" +import { PricingService, ProductService } from "../../../../services" /** * @oas [get] /products/{id} @@ -7,7 +7,7 @@ import { ProductService, PricingService } from "../../../../services" * description: "Retrieves a Product." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. + * - (path) id=* {string} The ID of the Product. * tags: * - Product * responses: diff --git a/packages/medusa/src/api/routes/admin/products/list-products.ts b/packages/medusa/src/api/routes/admin/products/list-products.ts index 37ed39f70d..5e2a2fe2be 100644 --- a/packages/medusa/src/api/routes/admin/products/list-products.ts +++ b/packages/medusa/src/api/routes/admin/products/list-products.ts @@ -1,9 +1,10 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString } from "class-validator" -import { Product } from "../../../../models" -import { PricedProduct } from "../../../../types/pricing" import { PricingService, ProductService } from "../../../../services" + import { FilterableProductProps } from "../../../../types/product" +import { PricedProduct } from "../../../../types/pricing" +import { Product } from "../../../../models" +import { Type } from "class-transformer" /** * @oas [get] /products @@ -12,23 +13,139 @@ import { FilterableProductProps } from "../../../../types/product" * description: "Retrieves a list of Product" * x-authenticated: true * parameters: - * - (query) q {string} Query used for searching products. - * - (query) id {string} Id of the product to search for. - * - (query) status {string[]} Status to search for. - * - (query) collection_id {string[]} Collection ids to search for. - * - (query) tags {string[]} Tags to search for. - * - (query) title {string} to search for. - * - (query) description {string} to search for. - * - (query) handle {string} to search for. - * - (query) is_giftcard {string} Search for giftcards using is_giftcard=true. - * - (query) type {string} to search for. - * - (query) order {string} to retrieve products in. - * - (query) sales_chanel_id {string[]} to retrieve products in. - * - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting products was deleted, i.e. less than, greater than etc. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting products was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting products was updated, i.e. less than, greater than etc. - * - (query) offset {string} How many products to skip in the result. - * - (query) limit {string} Limit the number of products returned. + * - (query) q {string} Query used for searching product title and description, variant title and sku, and collection title. + * - in: query + * name: id + * style: form + * explode: false + * description: Filter by product IDs. + * schema: + * oneOf: + * - type: string + * description: ID of the product to search for. + * - type: array + * items: + * type: string + * description: ID of a product. + * - in: query + * name: status + * style: form + * explode: false + * description: Status to search for + * schema: + * type: array + * items: + * type: string + * enum: [draft, proposed, published, rejected] + * - in: query + * name: collection_id + * style: form + * explode: false + * description: Collection ids to search for. + * schema: + * type: array + * items: + * type: string + * - in: query + * name: tags + * style: form + * explode: false + * description: Tag IDs to search for + * schema: + * type: array + * items: + * type: string + * - in: query + * name: price_list_id + * style: form + * explode: false + * description: Price List IDs to search for + * schema: + * type: array + * items: + * type: string + * - in: query + * name: sales_channel_id + * style: form + * explode: false + * description: Sales Channel IDs to filter products by + * schema: + * type: array + * items: + * type: string + * - (query) title {string} title to search for. + * - (query) description {string} description to search for. + * - (query) handle {string} handle to search for. + * - (query) is_giftcard {boolean} Search for giftcards using is_giftcard=true. + * - (query) type {string} type ID to search for. + * - in: query + * name: created_at + * description: Date comparison for when resulting products were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting products were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: deleted_at + * description: Date comparison for when resulting products were deleted. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - (query) offset=0 {integer} How many products to skip in the result. + * - (query) limit=50 {integer} Limit the number of products returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each product of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each product of the result. * tags: @@ -40,19 +157,19 @@ import { FilterableProductProps } from "../../../../types/product" * application/json: * schema: * properties: - * count: - * description: The number of Products. - * type: integer - * offset: - * description: The offset of the Product query. - * type: integer - * limit: - * description: The limit of the Product query. - * type: integer * products: * type: array * items: * $ref: "#/components/schemas/product" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts b/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts index ec83366d5e..3bd5ee597e 100644 --- a/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts +++ b/packages/medusa/src/api/routes/admin/products/list-tag-usage-count.ts @@ -1,5 +1,34 @@ import { ProductService } from "../../../../services" +/** + * @oas [get] /products/tag-usage + * operationId: "GetProductsTagUsage" + * summary: "List Product Tags Usage Number" + * description: "Retrieves a list of Product Tags with how many times each is used." + * x-authenticated: true + * tags: + * - Product Tag + * responses: + * 200: + * description: OK + * content: + * application/json: + * schema: + * properties: + * tags: + * type: array + * items: + * properties: + * id: + * description: The ID of the tag. + * type: string + * usage_count: + * description: The number of products that use this tag. + * type: string + * value: + * description: The value of the tag. + * type: string + */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/admin/products/list-variants.ts b/packages/medusa/src/api/routes/admin/products/list-variants.ts index 6914378346..b5972c6e35 100644 --- a/packages/medusa/src/api/routes/admin/products/list-variants.ts +++ b/packages/medusa/src/api/routes/admin/products/list-variants.ts @@ -1,11 +1,12 @@ -import { Request, Response } from "express" -import { ProductVariantService } from "../../../../services" -import { validator } from "../../../../utils/validator" import { IsNumber, IsOptional, IsString } from "class-validator" -import { Type } from "class-transformer" -import { getRetrieveConfig } from "../../../../utils/get-query-config" +import { Request, Response } from "express" + import { ProductVariant } from "../../../../models" +import { ProductVariantService } from "../../../../services" +import { Type } from "class-transformer" import { defaultAdminGetProductsVariantsFields } from "./index" +import { getRetrieveConfig } from "../../../../utils/get-query-config" +import { validator } from "../../../../utils/validator" /** * @oas [get] /products/{id}/variants @@ -14,11 +15,11 @@ import { defaultAdminGetProductsVariantsFields } from "./index" * description: "Retrieves a list of the Product Variants associated with a Product." * x-authenticated: true * parameters: - * - (path) id=* {string} Id of the product to search for the variants. + * - (path) id=* {string} ID of the product to search for the variants. * - (query) fields {string} Comma separated string of the column to select. * - (query) expand {string} Comma separated string of the relations to include. - * - (query) offset {string} How many products to skip in the result. - * - (query) limit {string} Limit the number of products returned. + * - (query) offset=0 {integer} How many items to skip before the results. + * - (query) limit=100 {integer} Limit the number of items returned. * tags: * - Product * responses: @@ -32,6 +33,15 @@ import { defaultAdminGetProductsVariantsFields } from "./index" * type: array * items: * $ref: "#/components/schemas/product_variant" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/products/set-metadata.ts b/packages/medusa/src/api/routes/admin/products/set-metadata.ts index de5b2a3e71..909784962c 100644 --- a/packages/medusa/src/api/routes/admin/products/set-metadata.ts +++ b/packages/medusa/src/api/routes/admin/products/set-metadata.ts @@ -1,5 +1,6 @@ -import { IsString } from "class-validator" import { defaultAdminProductFields, defaultAdminProductRelations } from "." + +import { IsString } from "class-validator" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -10,7 +11,7 @@ import { EntityManager } from "typeorm" * description: "Set metadata key/value pair for Product" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. + * - (path) id=* {string} The ID of the Product. * requestBody: * content: * application/json: diff --git a/packages/medusa/src/api/routes/admin/products/update-option.ts b/packages/medusa/src/api/routes/admin/products/update-option.ts index 22822873e8..9883b9351d 100644 --- a/packages/medusa/src/api/routes/admin/products/update-option.ts +++ b/packages/medusa/src/api/routes/admin/products/update-option.ts @@ -1,5 +1,6 @@ -import { IsString } from "class-validator" import { defaultAdminProductFields, defaultAdminProductRelations } from "." + +import { IsString } from "class-validator" import { ProductService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -11,14 +12,14 @@ import { EntityManager } from "typeorm" * description: "Updates a Product Option" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. - * - (path) option_id=* {string} The id of the Product Option. + * - (path) id=* {string} The ID of the Product. + * - (path) option_id=* {string} The ID of the Product Option. * requestBody: * content: * application/json: - * required: - * - title * schema: + * required: + * - title * properties: * title: * description: "The title of the Product Option" diff --git a/packages/medusa/src/api/routes/admin/products/update-product.ts b/packages/medusa/src/api/routes/admin/products/update-product.ts index 01598f3b7f..680bf58f75 100644 --- a/packages/medusa/src/api/routes/admin/products/update-product.ts +++ b/packages/medusa/src/api/routes/admin/products/update-product.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, @@ -12,19 +11,21 @@ import { ValidateIf, ValidateNested, } from "class-validator" -import { defaultAdminProductFields, defaultAdminProductRelations } from "." -import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels" -import { ProductStatus } from "../../../../models" import { PricingService, ProductService } from "../../../../services" import { ProductSalesChannelReq, ProductTagReq, ProductTypeReq, } from "../../../../types/product" -import { ProductVariantPricesUpdateReq } from "../../../../types/product-variant" -import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators" -import { validator } from "../../../../utils/validator" +import { defaultAdminProductFields, defaultAdminProductRelations } from "." + import { EntityManager } from "typeorm" +import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators" +import { ProductStatus } from "../../../../models" +import { ProductVariantPricesUpdateReq } from "../../../../types/product-variant" +import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [post] /products/{id} @@ -33,7 +34,7 @@ import { EntityManager } from "typeorm" * description: "Updates a Product" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. + * - (path) id=* {string} The ID of the Product. * requestBody: * content: * application/json: @@ -48,9 +49,6 @@ import { EntityManager } from "typeorm" * description: * description: "A description of the Product." * type: string - * is_giftcard: - * description: A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to `true` will result in a Gift Card being created. - * type: boolean * discountable: * description: A flag to indicate if discounts can be applied to the LineItems generated from this Product * type: boolean @@ -65,48 +63,56 @@ import { EntityManager } from "typeorm" * handle: * description: A unique handle to identify the Product by. * type: string + * status: + * description: The status of the product. + * type: string + * enum: [draft, proposed, published, rejected] * type: * description: The Product Type to associate the Product with. * type: object + * required: + * - value * properties: + * id: + * description: The ID of the Product Type. + * type: string * value: * description: The value of the Product Type. * type: string * collection_id: - * description: The id of the Collection the Product should belong to. + * description: The ID of the Collection the Product should belong to. * type: string * tags: * description: Tags to associate the Product with. * type: array * items: + * required: + * - value * properties: * id: - * description: The id of an existing Tag. + * description: The ID of an existing Tag. * type: string * value: * description: The value of the Tag, these will be upserted. * type: string - * sales_channels: - * description: [EXPERIMENTAL] Sales channels to associate the Product with. + * sales_channels: + * description: "[EXPERIMENTAL] Sales channels to associate the Product with." * type: array * items: + * required: + * - id * properties: * id: - * description: The id of an existing Sales channel. - * type: string - * options: - * description: The Options that the Product should have. These define on which properties the Product's Product Variants will differ. - * type: array - * items: - * properties: - * title: - * description: The title to identify the Product Option by. + * description: The ID of an existing Sales channel. * type: string * variants: * description: A list of Product Variants to create with the Product. * type: array * items: * properties: + * id: + * description: The ID of the Product Variant. + * type: string * title: * description: The title to identify the Product Variant by. * type: string @@ -136,16 +142,16 @@ import { EntityManager } from "typeorm" * type: boolean * weight: * description: The wieght of the Product Variant. - * type: string + * type: number * length: * description: The length of the Product Variant. - * type: string + * type: number * height: * description: The height of the Product Variant. - * type: string + * type: number * width: * description: The width of the Product Variant. - * type: string + * type: number * origin_country: * description: The country of origin of the Product Variant. * type: string @@ -161,38 +167,55 @@ import { EntityManager } from "typeorm" * prices: * type: array * items: + * required: + * - amount * properties: + * id: + * description: The ID of the Price. + * type: string * region_id: - * description: The id of the Region for which the price is used. + * description: The ID of the Region for which the price is used. Only required if currency_code is not provided. * type: string * currency_code: - * description: The 3 character ISO currency code for which the price will be used. + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * amount: * description: The amount to charge for the Product Variant. * type: integer - * sale_amount: - * description: The sale amount to charge for the Product Variant. + * min_quantity: + * description: The minimum quantity for which the price will be used. + * type: integer + * max_quantity: + * description: The maximum quantity for which the price will be used. * type: integer * options: * type: array * items: + * required: + * - option_id + * - value * properties: + * option_id: + * description: The ID of the Option. + * type: string * value: * description: The value to give for the Product Option at the same index in the Product's `options` field. * type: string * weight: * description: The wieght of the Product. - * type: string + * type: number * length: * description: The length of the Product. - * type: string + * type: number * height: * description: The height of the Product. - * type: string + * type: number * width: * description: The width of the Product. - * type: string + * type: number * origin_country: * description: The country of origin of the Product. * type: string diff --git a/packages/medusa/src/api/routes/admin/products/update-variant.ts b/packages/medusa/src/api/routes/admin/products/update-variant.ts index c043f8e416..e8fc412c94 100644 --- a/packages/medusa/src/api/routes/admin/products/update-variant.ts +++ b/packages/medusa/src/api/routes/admin/products/update-variant.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, @@ -8,14 +7,16 @@ import { IsString, ValidateNested, } from "class-validator" -import { defaultAdminProductFields, defaultAdminProductRelations } from "." import { - ProductService, PricingService, + ProductService, ProductVariantService, } from "../../../../services" +import { defaultAdminProductFields, defaultAdminProductRelations } from "." + import { PriceSelectionParams } from "../../../../types/price-selection" import { ProductVariantPricesUpdateReq } from "../../../../types/product-variant" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -26,8 +27,8 @@ import { EntityManager } from "typeorm" * description: "Update a Product Variant." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Product. - * - (path) variant_id=* {string} The id of the Product Variant. + * - (path) id=* {string} The ID of the Product. + * - (path) variant_id=* {string} The ID of the Product Variant. * requestBody: * content: * application/json: @@ -62,16 +63,16 @@ import { EntityManager } from "typeorm" * type: boolean * weight: * description: The wieght of the Product Variant. - * type: string + * type: number * length: * description: The length of the Product Variant. - * type: string + * type: number * height: * description: The height of the Product Variant. - * type: string + * type: number * width: * description: The width of the Product Variant. - * type: string + * type: number * origin_country: * description: The country of origin of the Product Variant. * type: string @@ -87,16 +88,21 @@ import { EntityManager } from "typeorm" * prices: * type: array * items: + * required: + * - amount * properties: * id: - * description: The id of the price. + * description: The ID of the price. * type: string * region_id: - * description: The id of the Region for which the price is used. + * description: The ID of the Region for which the price is used. Only required if currency_code is not provided. * type: string * currency_code: - * description: The 3 character ISO currency code for which the price will be used. + * description: The 3 character ISO currency code for which the price will be used. Only required if region_id is not provided. * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * amount: * description: The amount to charge for the Product Variant. * type: integer @@ -109,9 +115,12 @@ import { EntityManager } from "typeorm" * options: * type: array * items: + * required: + * - option_id + * - value * properties: * option_id: - * description: The id of the Product Option to set the value for. + * description: The ID of the Product Option to set the value for. * type: string * value: * description: The value to give for the Product Option. diff --git a/packages/medusa/src/api/routes/admin/regions/add-country.ts b/packages/medusa/src/api/routes/admin/regions/add-country.ts index 60463820c0..33ca5610f6 100644 --- a/packages/medusa/src/api/routes/admin/regions/add-country.ts +++ b/packages/medusa/src/api/routes/admin/regions/add-country.ts @@ -1,9 +1,11 @@ +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + +import { EntityManager } from "typeorm" import { IsString } from "class-validator" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." -import { validator } from "../../../../utils/validator" import { Region } from "../../../.." import RegionService from "../../../../services/region" -import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /regions/{id}/countries * operationId: "PostRegionsRegionCountries" @@ -11,7 +13,7 @@ import { EntityManager } from "typeorm" * description: "Adds a Country to the list of Countries in a Region" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * requestBody: * content: * application/json: @@ -22,6 +24,9 @@ import { EntityManager } from "typeorm" * country_code: * description: "The 2 character ISO code for the Country." * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * description: See a list of codes. * tags: * - Region * responses: diff --git a/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts b/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts index 5337ee63d9..29b6fa76ef 100644 --- a/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/add-fulfillment-provider.ts @@ -1,9 +1,11 @@ +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + +import { EntityManager } from "typeorm" import { IsString } from "class-validator" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." -import { validator } from "../../../../utils/validator" import { Region } from "../../../.." import RegionService from "../../../../services/region" -import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /regions/{id}/fulfillment-providers * operationId: "PostRegionsRegionFulfillmentProviders" @@ -11,16 +13,16 @@ import { EntityManager } from "typeorm" * description: "Adds a Fulfillment Provider to a Region" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * requestBody: * content: * application/json: - * required: - * - provider_id * schema: + * required: + * - provider_id * properties: * provider_id: - * description: "The id of the Fulfillment Provider to add." + * description: "The ID of the Fulfillment Provider to add." * type: string * tags: * - Region diff --git a/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts b/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts index 4973eef657..8cb05a6b26 100644 --- a/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/add-payment-provider.ts @@ -1,9 +1,10 @@ +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + +import { EntityManager } from "typeorm" import { IsString } from "class-validator" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." -import { validator } from "../../../../utils/validator" import { Region } from "../../../.." import RegionService from "../../../../services/region" -import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" /** * @oas [post] /regions/{id}/payment-providers @@ -12,16 +13,16 @@ import { EntityManager } from "typeorm" * description: "Adds a Payment Provider to a Region" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * requestBody: * content: * application/json: - * required: - * - provider_id * schema: + * required: + * - provider_id * properties: * provider_id: - * description: "The id of the Payment Provider to add." + * description: "The ID of the Payment Provider to add." * type: string * tags: * - Region diff --git a/packages/medusa/src/api/routes/admin/regions/create-region.ts b/packages/medusa/src/api/routes/admin/regions/create-region.ts index ba12a36db6..80960b81f3 100644 --- a/packages/medusa/src/api/routes/admin/regions/create-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/create-region.ts @@ -1,9 +1,11 @@ import { IsArray, IsNumber, IsOptional, IsString } from "class-validator" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." -import { validator } from "../../../../utils/validator" +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + +import { EntityManager } from "typeorm" import { Region } from "../../../.." import RegionService from "../../../../services/region" -import { EntityManager } from "typeorm" +import { validator } from "../../../../utils/validator" + /** * @oas [post] /regions * operationId: "PostRegions" @@ -13,11 +15,14 @@ import { EntityManager } from "typeorm" * requestBody: * content: * application/json: - * required: - * - name - * - currency_code - * - tax_rate * schema: + * required: + * - name + * - currency_code + * - tax_rate + * - payment_providers + * - fulfillment_providers + * - countries * properties: * name: * description: "The name of the Region" @@ -25,6 +30,9 @@ import { EntityManager } from "typeorm" * currency_code: * description: "The 3 character ISO currency code to use for the Region." * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * tax_code: * description: "An optional tax code the Region." * type: string @@ -32,17 +40,18 @@ import { EntityManager } from "typeorm" * description: "The tax rate to use on Orders in the Region." * type: number * payment_providers: - * description: "A list of Payment Providers that should be enabled for the Region" + * description: "A list of Payment Provider IDs that should be enabled for the Region" * type: array * items: * type: string * fulfillment_providers: - * description: "A list of Fulfillment Providers that should be enabled for the Region" + * description: "A list of Fulfillment Provider IDs that should be enabled for the Region" * type: array * items: * type: string * countries: - * description: "A list of countries that should be included in the Region." + * description: "A list of countries' 2 ISO Characters that should be included in the Region." + * example: ["US"] * type: array * items: * type: string diff --git a/packages/medusa/src/api/routes/admin/regions/delete-region.ts b/packages/medusa/src/api/routes/admin/regions/delete-region.ts index 3a9c651bdf..54629ca7c9 100644 --- a/packages/medusa/src/api/routes/admin/regions/delete-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/delete-region.ts @@ -1,5 +1,5 @@ -import RegionService from "../../../../services/region" import { EntityManager } from "typeorm" +import RegionService from "../../../../services/region" /** * @oas [delete] /regions/{id} @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Region." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * tags: * - Region * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Region. + * description: The ID of the deleted Region. * object: * type: string * description: The type of the object that was deleted. + * default: region * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts b/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts index 736ccade89..aef8f97159 100644 --- a/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts +++ b/packages/medusa/src/api/routes/admin/regions/get-fulfillment-options.ts @@ -1,6 +1,6 @@ -import RegionService from "../../../../services/region" -import FulfillmentProviderService from "../../../../services/fulfillment-provider" import { FulfillmentOption } from "." +import FulfillmentProviderService from "../../../../services/fulfillment-provider" +import RegionService from "../../../../services/region" /** * @oas [get] /regions/{id}/fulfillment-options @@ -9,7 +9,7 @@ import { FulfillmentOption } from "." * description: "Gathers all the fulfillment options available to in the Region." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * tags: * - Region * responses: @@ -22,7 +22,17 @@ import { FulfillmentOption } from "." * fulfillment_options: * type: array * items: - * type: object + * properties: + * provider_id: + * type: string + * description: ID of the fulfillment provider + * options: + * type: array + * description: fulfillment provider options + * example: + * - id: "manual-fulfillment" + * - id: "manual-fulfillment-return" + * is_return: true */ export default async (req, res) => { const { region_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/regions/get-region.ts b/packages/medusa/src/api/routes/admin/regions/get-region.ts index c788e87f7e..96af4b1322 100644 --- a/packages/medusa/src/api/routes/admin/regions/get-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/get-region.ts @@ -1,5 +1,6 @@ +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + import RegionService from "../../../../services/region" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." /** * @oas [get] /regions/{id} @@ -8,7 +9,7 @@ import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." * description: "Retrieves a Region." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * tags: * - Region * responses: diff --git a/packages/medusa/src/api/routes/admin/regions/list-regions.ts b/packages/medusa/src/api/routes/admin/regions/list-regions.ts index 56aec531ab..846e788236 100644 --- a/packages/medusa/src/api/routes/admin/regions/list-regions.ts +++ b/packages/medusa/src/api/routes/admin/regions/list-regions.ts @@ -1,11 +1,12 @@ -import { validator } from "../../../../utils/validator" +import { IsInt, IsOptional, ValidateNested } from "class-validator" +import _, { identity } from "lodash" +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + +import { DateComparisonOperator } from "../../../../types/common" import { Region } from "../../../.." import RegionService from "../../../../services/region" -import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." -import { IsInt, IsOptional, ValidateNested } from "class-validator" import { Type } from "class-transformer" -import _, { identity } from "lodash" -import { DateComparisonOperator } from "../../../../types/common" +import { validator } from "../../../../utils/validator" /** * @oas [get] /regions @@ -18,30 +19,32 @@ import { DateComparisonOperator } from "../../../../types/common" * name: limit * schema: * type: integer + * default: 50 * required: false * description: limit the number of regions in response * - in: query * name: offset * schema: * type: integer + * default: 0 * required: false * description: Offset of regions in response (used for pagination) - * - in: query + * - in: query * name: created_at * schema: - * type: DateComparisonOperator + * type: object * required: false * description: Date comparison for when resulting region was created, i.e. less than, greater than etc. - * - in: query + * - in: query * name: updated_at * schema: - * type: DateComparisonOperator + * type: object * required: false * description: Date comparison for when resulting region was updated, i.e. less than, greater than etc. - * - in: query + * - in: query * name: deleted_at * schema: - * type: DateComparisonOperator + * type: object * required: false * description: Date comparison for when resulting region was deleted, i.e. less than, greater than etc. * tags: @@ -57,6 +60,15 @@ import { DateComparisonOperator } from "../../../../types/common" * type: array * items: * $ref: "#/components/schemas/region" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(AdminGetRegionsParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/regions/remove-country.ts b/packages/medusa/src/api/routes/admin/regions/remove-country.ts index 17bf4ecfdc..42bc3ecc31 100644 --- a/packages/medusa/src/api/routes/admin/regions/remove-country.ts +++ b/packages/medusa/src/api/routes/admin/regions/remove-country.ts @@ -1,6 +1,7 @@ -import RegionService from "../../../../services/region" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + import { EntityManager } from "typeorm" +import RegionService from "../../../../services/region" /** * @oas [delete] /regions/{id}/countries/{country_code} @@ -9,8 +10,16 @@ import { EntityManager } from "typeorm" * x-authenticated: true * description: "Removes a Country from the list of Countries in a Region" * parameters: - * - (path) id=* {string} The id of the Region. - * - (path) country_code=* {string} The 2 character ISO code for the Country. + * - (path) id=* {string} The ID of the Region. + * - in: path + * name: country_code + * description: The 2 character ISO code for the Country. + * required: true + * schema: + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * tags: * - Region * responses: diff --git a/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts b/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts index db107bea67..96e778bbf9 100644 --- a/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/remove-fulfillment-provider.ts @@ -1,6 +1,7 @@ -import RegionService from "../../../../services/region" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + import { EntityManager } from "typeorm" +import RegionService from "../../../../services/region" /** * @oas [delete] /regions/{id}/fulfillment-providers/{provider_id} @@ -9,8 +10,8 @@ import { EntityManager } from "typeorm" * description: "Removes a Fulfillment Provider." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. - * - (path) provider_id=* {string} The id of the Fulfillment Provider. + * - (path) id=* {string} The ID of the Region. + * - (path) provider_id=* {string} The ID of the Fulfillment Provider. * tags: * - Region * responses: diff --git a/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts b/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts index 344e392a50..7faed2b11b 100644 --- a/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts +++ b/packages/medusa/src/api/routes/admin/regions/remove-payment-provider.ts @@ -1,6 +1,7 @@ -import RegionService from "../../../../services/region" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + import { EntityManager } from "typeorm" +import RegionService from "../../../../services/region" /** * @oas [delete] /regions/{id}/payment-providers/{provider_id} @@ -9,8 +10,8 @@ import { EntityManager } from "typeorm" * description: "Removes a Payment Provider." * x-authenticated: true * parameters: - * - (path) region_id=* {string} The id of the Region. - * - (path) provider_id=* {string} The id of the Payment Provider. + * - (path) id=* {string} The ID of the Region. + * - (path) provider_id=* {string} The ID of the Payment Provider. * tags: * - Region * responses: diff --git a/packages/medusa/src/api/routes/admin/regions/update-region.ts b/packages/medusa/src/api/routes/admin/regions/update-region.ts index 51c9889aeb..fa67f12a10 100644 --- a/packages/medusa/src/api/routes/admin/regions/update-region.ts +++ b/packages/medusa/src/api/routes/admin/regions/update-region.ts @@ -5,10 +5,11 @@ import { IsOptional, IsString, } from "class-validator" -import { defaultAdminRegionRelations, defaultAdminRegionFields } from "." -import { validator } from "../../../../utils/validator" -import RegionService from "../../../../services/region" +import { defaultAdminRegionFields, defaultAdminRegionRelations } from "." + import { EntityManager } from "typeorm" +import RegionService from "../../../../services/region" +import { validator } from "../../../../utils/validator" /** * @oas [post] /regions/{id} @@ -17,7 +18,7 @@ import { EntityManager } from "typeorm" * description: "Updates a Region" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Region. + * - (path) id=* {string} The ID of the Region. * requestBody: * content: * application/json: @@ -29,6 +30,9 @@ import { EntityManager } from "typeorm" * currency_code: * description: "The 3 character ISO currency code to use for the Region." * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * automatic_taxes: * description: "If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes." * type: boolean @@ -36,7 +40,7 @@ import { EntityManager } from "typeorm" * description: "Whether gift cards in this region should be applied sales tax when purchasing a gift card" * type: boolean * tax_provider_id: - * description: "The id of the tax provider to use; if null the system tax provider is used" + * description: "The ID of the tax provider to use; if null the system tax provider is used" * type: string * tax_code: * description: "An optional tax code the Region." @@ -45,17 +49,17 @@ import { EntityManager } from "typeorm" * description: "The tax rate to use on Orders in the Region." * type: number * payment_providers: - * description: "A list of Payment Providers that should be enabled for the Region" + * description: "A list of Payment Provider IDs that should be enabled for the Region" * type: array * items: * type: string * fulfillment_providers: - * description: "A list of Fulfillment Providers that should be enabled for the Region" + * description: "A list of Fulfillment Provider IDs that should be enabled for the Region" * type: array * items: * type: string * countries: - * description: "A list of countries that should be included in the Region." + * description: "A list of countries' 2 ISO Characters that should be included in the Region." * type: array * items: * type: string diff --git a/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts index fbb9301f7f..c23c7b2f6c 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/create-reason.ts @@ -3,6 +3,7 @@ import { defaultAdminReturnReasonsFields, defaultAdminReturnReasonsRelations, } from "." + import { ReturnReasonService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -27,8 +28,8 @@ import { EntityManager } from "typeorm" * value: * description: "The value that the Return Reason will be identified by. Must be unique." * type: string - * parent_return_reason_id: - * description: "The id of the parent return reason." + * parent_return_reason_id: + * description: "The ID of the parent return reason." * type: string * description: * description: "An optional description to for the Reason." diff --git a/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts index 1ed3504c85..e8d17aab9c 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/delete-reason.ts @@ -1,5 +1,5 @@ -import { ReturnReasonService } from "../../../../services" import { EntityManager } from "typeorm" +import { ReturnReasonService } from "../../../../services" /** * @oas [delete] /return-reasons/{id} @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a return reason." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the return reason + * - (path) id=* {string} The ID of the return reason * tags: * - Return Reason * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted return reason + * description: The ID of the deleted return reason * object: * type: string * description: The type of the object that was deleted. + * default: return_reason * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts index 3806eca57a..260b967b78 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/get-reason.ts @@ -2,6 +2,7 @@ import { defaultAdminReturnReasonsFields, defaultAdminReturnReasonsRelations, } from "." + import { ReturnReasonService } from "../../../../services" /** @@ -11,7 +12,7 @@ import { ReturnReasonService } from "../../../../services" * description: "Retrieves a Return Reason." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Return Reason. + * - (path) id=* {string} The ID of the Return Reason. * tags: * - Return Reason * responses: diff --git a/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts b/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts index cc194323f3..71df342bde 100644 --- a/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts +++ b/packages/medusa/src/api/routes/admin/return-reasons/update-reason.ts @@ -3,6 +3,7 @@ import { defaultAdminReturnReasonsFields, defaultAdminReturnReasonsRelations, } from "." + import { ReturnReasonService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -14,7 +15,7 @@ import { EntityManager } from "typeorm" * description: "Updates a Return Reason" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Return Reason. + * - (path) id=* {string} The ID of the Return Reason. * requestBody: * content: * application/json: @@ -23,6 +24,9 @@ import { EntityManager } from "typeorm" * label: * description: "The label to display to the Customer." * type: string + * value: + * description: "The value that the Return Reason will be identified by. Must be unique." + * type: string * description: * description: "An optional description to for the Reason." * type: string diff --git a/packages/medusa/src/api/routes/admin/returns/cancel-return.ts b/packages/medusa/src/api/routes/admin/returns/cancel-return.ts index c3d2096a64..38d6d2ad08 100644 --- a/packages/medusa/src/api/routes/admin/returns/cancel-return.ts +++ b/packages/medusa/src/api/routes/admin/returns/cancel-return.ts @@ -11,7 +11,7 @@ import { EntityManager } from "typeorm" * summary: "Cancel a Return" * description: "Registers a Return as canceled." * parameters: - * - (path) id=* {string} The id of the Return. + * - (path) id=* {string} The ID of the Return. * tags: * - Return * responses: @@ -21,7 +21,7 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * return: + * order: * $ref: "#/components/schemas/order" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/returns/list-returns.ts b/packages/medusa/src/api/routes/admin/returns/list-returns.ts index 1e8b73275c..bd2f709b40 100644 --- a/packages/medusa/src/api/routes/admin/returns/list-returns.ts +++ b/packages/medusa/src/api/routes/admin/returns/list-returns.ts @@ -1,6 +1,7 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional } from "class-validator" + import { ReturnService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** @@ -9,8 +10,8 @@ import { validator } from "../../../../utils/validator" * summary: "List Returns" * description: "Retrieves a list of Returns" * parameters: - * - (path) limit {number} The upper limit for the amount of responses returned. - * - (path) offset {number} The offset of the list returned. + * - (query) limit=50 {number} The upper limit for the amount of responses returned. + * - (query) offset=0 {number} The offset of the list returned. * tags: * - Return * responses: @@ -24,6 +25,15 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/return" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const returnService: ReturnService = req.scope.resolve("returnService") diff --git a/packages/medusa/src/api/routes/admin/returns/receive-return.ts b/packages/medusa/src/api/routes/admin/returns/receive-return.ts index df2795f1e1..10e7633c69 100644 --- a/packages/medusa/src/api/routes/admin/returns/receive-return.ts +++ b/packages/medusa/src/api/routes/admin/returns/receive-return.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsNumber, @@ -6,8 +5,10 @@ import { IsString, ValidateNested, } from "class-validator" -import { EntityManager } from "typeorm" import { OrderService, ReturnService, SwapService } from "../../../../services" + +import { EntityManager } from "typeorm" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** @@ -16,7 +17,7 @@ import { validator } from "../../../../utils/validator" * summary: "Receive a Return" * description: "Registers a Return as received. Updates statuses on Orders and Swaps accordingly." * parameters: - * - (path) id=* {string} The id of the Return. + * - (path) id=* {string} The ID of the Return. * requestBody: * content: * application/json: @@ -28,16 +29,19 @@ import { validator } from "../../../../utils/validator" * description: The Line Items that have been received. * type: array * items: + * required: + * - item_id + * - quantity * properties: * item_id: - * description: The id of the Line Item. + * description: The ID of the Line Item. * type: string * quantity: * description: The quantity of the Line Item. * type: integer * refund: * description: The amount to refund. - * type: integer + * type: number * tags: * - Return * responses: diff --git a/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts b/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts index 87acf90872..f5dc460358 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/add-product-batch.ts @@ -1,9 +1,10 @@ -import { Request, Response } from "express" -import { SalesChannelService } from "../../../../services" import { IsArray, ValidateNested } from "class-validator" -import { Type } from "class-transformer" -import { ProductBatchSalesChannel } from "../../../../types/sales-channels" +import { Request, Response } from "express" + import { EntityManager } from "typeorm" +import { ProductBatchSalesChannel } from "../../../../types/sales-channels" +import { SalesChannelService } from "../../../../services" +import { Type } from "class-transformer" /** * @oas [post] /sales-channels/{id}/products/batch @@ -12,8 +13,25 @@ import { EntityManager } from "typeorm" * description: "Assign a batch of product to a sales channel." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Sales channel. - * - (body) product_ids=* {ProductBatchSalesChannel} The product ids that must be assigned to the sales channel. + * - (path) id=* {string} The ID of the Sales channel. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - product_ids + * properties: + * product_ids: + * description: The IDs of the products to add to the Sales Channel + * type: array + * items: + * type: object + * required: + * - id + * properties: + * id: + * type: string + * description: The ID of the product * tags: * - Sales Channel * responses: diff --git a/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts index 464a6ea3fc..66254dfc1e 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/create-sales-channel.ts @@ -1,19 +1,32 @@ -import { Request, Response } from "express" import { IsBoolean, IsOptional, IsString } from "class-validator" +import { Request, Response } from "express" -import SalesChannelService from "../../../../services/sales-channel" import { CreateSalesChannelInput } from "../../../../types/sales-channels" import { EntityManager } from "typeorm" +import SalesChannelService from "../../../../services/sales-channel" /** * @oas [post] /sales-channels * operationId: "PostSalesChannels" - * summary: "Create a sales channel" - * description: "Creates a sales channel." + * summary: "Create a Sales Channel" + * description: "Creates a Sales Channel." * x-authenticated: true - * parameters: - * - (body) name=* {string} Name of the sales channel - * - (body) description=* {string} Description of the sales channel + * requestBody: + * content: + * application/json: + * schema: + * required: + * - name + * properties: + * name: + * description: The name of the Sales Channel + * type: string + * description: + * description: The description of the Sales Channel + * type: string + * is_disabled: + * description: Whether the Sales Channel is disabled or not. + * type: boolean * tags: * - Sales Channel * responses: diff --git a/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts b/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts index 2ccdb7564d..c41b5ed022 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/delete-products-batch.ts @@ -1,9 +1,10 @@ -import { Type } from "class-transformer" import { IsArray, ValidateNested } from "class-validator" -import { SalesChannelService } from "../../../../services" import { Request, Response } from "express" -import { ProductBatchSalesChannel } from "../../../../types/sales-channels" + import { EntityManager } from "typeorm" +import { ProductBatchSalesChannel } from "../../../../types/sales-channels" +import { SalesChannelService } from "../../../../services" +import { Type } from "class-transformer" /** * @oas [delete] /sales-channels/{id}/products/batch @@ -12,8 +13,25 @@ import { EntityManager } from "typeorm" * description: "Remove a list of products from a sales channel." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the customer group. - * - (body) product_ids=* {ProductBatchSalesChannel[]} ids of the product to remove + * - (path) id=* {string} The ID of the Sales Channel + * requestBody: + * content: + * application/json: + * schema: + * required: + * - product_ids + * properties: + * product_ids: + * description: The IDs of the products to delete from the Sales Channel. + * type: array + * items: + * type: object + * required: + * - id + * properties: + * id: + * description: The ID of a product + * type: string * tags: * - Sales Channel * responses: diff --git a/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts index 3cdae84192..838a9e098d 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/delete-sales-channel.ts @@ -1,6 +1,7 @@ import { Request, Response } from "express" -import { SalesChannelService } from "../../../../services/" + import { EntityManager } from "typeorm" +import { SalesChannelService } from "../../../../services/" /** * @oas [delete] /sales-channels/{id} @@ -9,7 +10,7 @@ import { EntityManager } from "typeorm" * description: "Deletes the sales channel." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Sales channel. + * - (path) id=* {string} The ID of the Sales channel. * tags: * - Sales Channel * responses: @@ -21,12 +22,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Sales Channel. + * description: The ID of the deleted sales channel * object: * type: string * description: The type of the object that was deleted. + * default: sales-channel * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req: Request, res: Response): Promise => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts index 394cfaceaf..f9819c31be 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/get-sales-channel.ts @@ -1,4 +1,5 @@ import { Request, Response } from "express" + import { SalesChannelService } from "../../../../services" /** @@ -8,7 +9,7 @@ import { SalesChannelService } from "../../../../services" * description: "Retrieves the sales channel." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Sales channel. + * - (path) id=* {string} The ID of the Sales channel. * tags: * - Sales Channel * responses: diff --git a/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts b/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts index ef776f2f1a..b064bb4d02 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/list-sales-channels.ts @@ -1,12 +1,13 @@ -import { Request, Response } from "express" -import { IsNumber, IsOptional, IsString, ValidateNested } from "class-validator" -import { Type } from "class-transformer" -import { removeUndefinedProperties } from "../../../../utils" -import { SalesChannelService } from "../../../../services" import { DateComparisonOperator, extendedFindParamsMixin, } from "../../../../types/common" +import { IsNumber, IsOptional, IsString, ValidateNested } from "class-validator" +import { Request, Response } from "express" + +import { SalesChannelService } from "../../../../services" +import { Type } from "class-transformer" +import { removeUndefinedProperties } from "../../../../utils" /** * @oas [get] /sales-channels @@ -15,16 +16,79 @@ import { * description: "Retrieves a list of sales channels" * x-authenticated: true * parameters: - * - (query) id {string} id of the sales channel + * - (query) id {string} ID of the sales channel * - (query) name {string} Name of the sales channel * - (query) description {string} Description of the sales channel - * - (query) q {string} Query used for searching sales channels. - * - (query) order {string} to retrieve sales channels in. - * - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting sales channels was deleted, i.e. less than, greater than etc. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting sales channels was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting sales channels was updated, i.e. less than, greater than etc. - * - (query) offset {string} How many sales channels to skip in the result. - * - (query) limit {string} Limit the number of sales channels returned. + * - (query) q {string} Query used for searching sales channels' names and descriptions. + * - (query) order {string} The field to order the results by. + * - in: query + * name: created_at + * description: Date comparison for when resulting collections were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting collections were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: deleted_at + * description: Date comparison for when resulting collections were deleted. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - (query) offset=0 {integer} How many sales channels to skip in the result. + * - (query) limit=20 {integer} Limit the number of sales channels returned. * - (query) expand {string} (Comma separated) Which fields should be expanded in each sales channel of the result. * - (query) fields {string} (Comma separated) Which fields should be included in each sales channel of the result. * tags: @@ -36,19 +100,19 @@ import { * application/json: * schema: * properties: - * count: - * description: The number of Sales channels. - * type: integer - * offset: - * description: The offset of the Sales channel query. - * type: integer - * limit: - * description: The limit of the Sales channel query. - * type: integer * sales_channels: * type: array * items: - * $ref: "#/components/schemas/sales_channel" + * $ref: "#/components/schemas/sales_channel" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req: Request, res: Response) => { const salesChannelService: SalesChannelService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts b/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts index c42647ff5a..502a38c9e9 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/update-sales-channel.ts @@ -1,5 +1,6 @@ import { IsBoolean, IsOptional, IsString } from "class-validator" import { Request, Response } from "express" + import { SalesChannelService } from "../../../../services" import { EntityManager } from "typeorm" @@ -10,7 +11,7 @@ import { EntityManager } from "typeorm" * description: "Updates a Sales Channel." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Sales Channel. + * - (path) id=* {string} The ID of the Sales Channel. * requestBody: * content: * application/json: @@ -34,8 +35,8 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * customer: - * $ref: "#/components/schemas/sales-channel" + * sales_channel: + * $ref: "#/components/schemas/sales_channel" */ export default async (req: Request, res: Response) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts index 84a1f26e92..347c810712 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsNumber, @@ -8,6 +7,8 @@ import { ValidateNested, } from "class-validator" import { defaultFields, defaultRelations } from "." + +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -21,18 +22,24 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: + * required: + * - name + * - region_id + * - provider_id + * - data + * - price_type * properties: * name: * description: "The name of the Shipping Option" * type: string * region_id: - * description: "The id of the Region in which the Shipping Option will be available." + * description: "The ID of the Region in which the Shipping Option will be available." * type: string * provider_id: - * description: "The id of the Fulfillment Provider that handles the Shipping Option." + * description: "The ID of the Fulfillment Provider that handles the Shipping Option." * type: string * profile_id: - * description: "The id of the Shipping Profile to add the Shipping Option to." + * description: "The ID of the Shipping Profile to add the Shipping Option to." * type: number * data: * description: "The data needed for the Fulfillment Provider to handle shipping with this Shipping Option." @@ -50,6 +57,9 @@ import { EntityManager } from "typeorm" * description: "The requirements that must be satisfied for the Shipping Option to be available." * type: array * items: + * required: + * - type + * - amount * properties: * type: * description: The type of the requirement @@ -63,9 +73,11 @@ import { EntityManager } from "typeorm" * is_return: * description: Whether the Shipping Option defines a return shipment. * type: boolean + * default: false * admin_only: * description: If true, the option can be used for draft orders * type: boolean + * default: false * metadata: * description: An optional set of key-value pairs with additional information. * type: object diff --git a/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts index 6b5c4ee724..97325577ae 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/delete-shipping-option.ts @@ -7,7 +7,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Shipping Option." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Shipping Option. + * - (path) id=* {string} The ID of the Shipping Option. * tags: * - Shipping Option * responses: @@ -19,12 +19,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Shipping Option. + * description: The ID of the deleted Shipping Option. * object: * type: string * description: The type of the object that was deleted. + * default: shipping-option * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { option_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts index 1100444928..6406c11a19 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/get-shipping-option.ts @@ -5,7 +5,7 @@ * description: "Retrieves a Shipping Option." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Shipping Option. + * - (path) id=* {string} The ID of the Shipping Option. * tags: * - Shipping Option * responses: diff --git a/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts b/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts index f6790d8732..b7662973ab 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/list-shipping-options.ts @@ -1,9 +1,10 @@ -import { Transform } from "class-transformer" import { IsBoolean, IsOptional, IsString } from "class-validator" import { defaultFields, defaultRelations } from "." + import { PricingService } from "../../../../services" -import { validator } from "../../../../utils/validator" +import { Transform } from "class-transformer" import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean" +import { validator } from "../../../../utils/validator" /** * @oas [get] /shipping-options @@ -12,23 +13,20 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean" * description: "Retrieves a list of Shipping Options." * x-authenticated: true * parameters: - * - in: path + * - in: query * name: region_id * schema: * type: string - * required: false - * description: Region to fetch options from - * - in: path + * description: Region ID to fetch options from + * - in: query * name: is_return * schema: * type: boolean - * required: false - * description: Flag for fetching return options - * - in: path + * description: Flag for fetching return options only + * - in: query * name: admin_only * schema: * type: boolean - * required: false * description: Flag for fetching admin specific options * tags: * - Shipping Option @@ -43,6 +41,9 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean" * type: array * items: * $ref: "#/components/schemas/shipping_option" + * count: + * type: integer + * description: The total number of items available */ export default async (req, res) => { const validatedParams = await validator( diff --git a/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts index 040a74f626..a4f3286f74 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsBoolean, @@ -9,6 +8,8 @@ import { ValidateNested, } from "class-validator" import { defaultFields, defaultRelations } from "." + +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -19,11 +20,13 @@ import { EntityManager } from "typeorm" * description: "Updates a Shipping Option" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Shipping Option. + * - (path) id=* {string} The ID of the Shipping Option. * requestBody: * content: * application/json: * schema: + * required: + * - requirements * properties: * name: * description: "The name of the Shipping Option" @@ -41,7 +44,13 @@ import { EntityManager } from "typeorm" * description: "The requirements that must be satisfied for the Shipping Option to be available." * type: array * items: + * required: + * - type + * - amount * properties: + * id: + * description: The ID of the requirement + * type: string * type: * description: The type of the requirement * type: string diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts index ce38e7fa36..96547d7d06 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/delete-shipping-profile.ts @@ -1,5 +1,5 @@ -import { ShippingProfileService } from "../../../../services" import { EntityManager } from "typeorm" +import { ShippingProfileService } from "../../../../services" /** * @oas [delete] /shipping-profiles/{id} @@ -8,7 +8,7 @@ import { EntityManager } from "typeorm" * description: "Deletes a Shipping Profile." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Shipping Profile. + * - (path) id=* {string} The ID of the Shipping Profile. * tags: * - Shipping Profile * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Shipping Profile. + * description: The ID of the deleted Shipping Profile. * object: * type: string * description: The type of the object that was deleted. + * default: shipping_profile * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { profile_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts index 7b2954bbe5..3da47c61e3 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/get-shipping-profile.ts @@ -2,6 +2,7 @@ import { defaultAdminShippingProfilesFields, defaultAdminShippingProfilesRelations, } from "." + import { ShippingProfileService } from "../../../../services" /** @@ -11,7 +12,7 @@ import { ShippingProfileService } from "../../../../services" * description: "Retrieves a Shipping Profile." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Shipping Profile. + * - (path) id=* {string} The ID of the Shipping Profile. * tags: * - Shipping Profile * responses: diff --git a/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts b/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts index 2e6e4a932f..885542d1af 100644 --- a/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts +++ b/packages/medusa/src/api/routes/admin/shipping-profiles/update-shipping-profile.ts @@ -1,4 +1,5 @@ import { IsOptional, IsString } from "class-validator" + import { ShippingProfileService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -9,7 +10,7 @@ import { EntityManager } from "typeorm" * summary: "Update a Shipping Profiles" * description: "Updates a Shipping Profile" * parameters: - * - (path) id=* {string} The id of the Shipping Profile. + * - (path) id=* {string} The ID of the Shipping Profile. * requestBody: * content: * application/json: @@ -27,7 +28,7 @@ import { EntityManager } from "typeorm" * application/json: * schema: * properties: - * shipping_profiles: + * shipping_profile: * $ref: "#/components/schemas/shipping_profile" */ export default async (req, res) => { diff --git a/packages/medusa/src/api/routes/admin/store/add-currency.ts b/packages/medusa/src/api/routes/admin/store/add-currency.ts index babfb56a0d..7bc0b81245 100644 --- a/packages/medusa/src/api/routes/admin/store/add-currency.ts +++ b/packages/medusa/src/api/routes/admin/store/add-currency.ts @@ -7,7 +7,15 @@ import { EntityManager } from "typeorm" * description: "Adds a Currency Code to the available currencies." * x-authenticated: true * parameters: - * - (path) code=* {string} The 3 character ISO currency code. + * - in: path + * name: code + * required: true + * description: The 3 character ISO currency code. + * schema: + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * tags: * - Store * responses: diff --git a/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts b/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts index acffd3d941..7c1ad38c7b 100644 --- a/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts +++ b/packages/medusa/src/api/routes/admin/store/list-payment-providers.ts @@ -17,7 +17,7 @@ import { PaymentProviderService } from "../../../../services" * payment_providers: * type: array * items: - * $ref: "#/components/schemas/store" + * $ref: "#/components/schemas/payment_provider" */ export default async (req, res) => { const paymentProviderService: PaymentProviderService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts b/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts index 9c9674cda6..af67f97b57 100644 --- a/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts +++ b/packages/medusa/src/api/routes/admin/store/list-tax-providers.ts @@ -18,7 +18,7 @@ import { TaxProviderService } from "../../../../services" * tax_providers: * type: array * items: - * $ref: "#/components/schemas/store" + * $ref: "#/components/schemas/tax_provider" */ export default async (req, res) => { const taxProviderService: TaxProviderService = diff --git a/packages/medusa/src/api/routes/admin/store/remove-currency.ts b/packages/medusa/src/api/routes/admin/store/remove-currency.ts index 60593ad4db..6a038f29d9 100644 --- a/packages/medusa/src/api/routes/admin/store/remove-currency.ts +++ b/packages/medusa/src/api/routes/admin/store/remove-currency.ts @@ -8,7 +8,15 @@ import { EntityManager } from "typeorm" * description: "Removes a Currency Code from the available currencies." * x-authenticated: true * parameters: - * - (path) code=* {string} The 3 character ISO currency code. + * - in: path + * name: code + * required: true + * description: The 3 character ISO currency code. + * schema: + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * tags: * - Store * responses: diff --git a/packages/medusa/src/api/routes/admin/store/update-store.ts b/packages/medusa/src/api/routes/admin/store/update-store.ts index 1f119ff8c7..aa45888932 100644 --- a/packages/medusa/src/api/routes/admin/store/update-store.ts +++ b/packages/medusa/src/api/routes/admin/store/update-store.ts @@ -1,4 +1,5 @@ -import { IsArray, IsOptional, IsString, IsObject } from "class-validator" +import { IsArray, IsObject, IsOptional, IsString } from "class-validator" + import { StoreService } from "../../../../services" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -29,6 +30,17 @@ import { EntityManager } from "typeorm" * default_currency_code: * description: "The default currency code for the Store." * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * currencies: + * description: "Array of currencies in 2 character ISO code format." + * type: array + * items: + * type: string + * metadata: + * description: "An optional set of key-value pairs with additional information." + * type: object * tags: * - Store * responses: diff --git a/packages/medusa/src/api/routes/admin/swaps/get-swap.ts b/packages/medusa/src/api/routes/admin/swaps/get-swap.ts index 59b11fe456..d341c44e57 100644 --- a/packages/medusa/src/api/routes/admin/swaps/get-swap.ts +++ b/packages/medusa/src/api/routes/admin/swaps/get-swap.ts @@ -1,4 +1,5 @@ import { defaultAdminSwapFields, defaultAdminSwapRelations } from "." + import { SwapService } from "../../../../services" /** @@ -8,7 +9,7 @@ import { SwapService } from "../../../../services" * description: "Retrieves a Swap." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Swap. + * - (path) id=* {string} The ID of the Swap. * tags: * - Swap * responses: diff --git a/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts b/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts index f23acb79e6..a1a224f1f3 100644 --- a/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts +++ b/packages/medusa/src/api/routes/admin/swaps/list-swaps.ts @@ -1,12 +1,17 @@ -import { Type } from "class-transformer" import { IsInt, IsOptional } from "class-validator" + import { SwapService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" + /** * @oas [get] /swaps * operationId: "GetSwaps" * summary: "List Swaps" * description: "Retrieves a list of Swaps." + * parameters: + * - (query) limit=50 {number} The upper limit for the amount of responses returned. + * - (query) offset=0 {number} The offset of the list returned. * x-authenticated: true * tags: * - Swap @@ -21,6 +26,15 @@ import { validator } from "../../../../utils/validator" * type: array * items: * $ref: "#/components/schemas/swap" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const swapService: SwapService = req.scope.resolve("swapService") diff --git a/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts b/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts index b85b565844..1b4a88bd2c 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/add-to-product-types.ts @@ -1,5 +1,5 @@ -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -11,9 +11,40 @@ import { EntityManager } from "typeorm" * operationId: "PostTaxRatesTaxRateProductTypes" * summary: "Add Tax Rate to Product Types" * description: "Associates a Tax Rate with a list of Product Types" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - product_types + * properties: + * product_types: + * type: array + * description: "The IDs of the types of products to associate with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -22,9 +53,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts b/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts index bb535b066b..4b6e761727 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/add-to-products.ts @@ -1,5 +1,5 @@ -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -11,9 +11,40 @@ import { EntityManager } from "typeorm" * operationId: "PostTaxRatesTaxRateProducts" * summary: "Add Tax Rate to Products" * description: "Associates a Tax Rate with a list of Products" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - products + * properties: + * products: + * type: array + * description: "The IDs of the products to associate with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -22,9 +53,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator(AdminPostTaxRatesTaxRateProductsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts b/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts index 3f4d2370a0..ba0fb060d6 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/add-to-shipping-options.ts @@ -1,5 +1,5 @@ -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -10,10 +10,41 @@ import { EntityManager } from "typeorm" * @oas [post] /tax-rates/:id/shipping-options/batch * operationId: "PostTaxRatesTaxRateShippingOptions" * summary: "Add Tax Rate to Product Types" - * description: "Associates a Tax Rate with a list of Product Types" + * description: "Associates a Tax Rate with a list of Shipping Options" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - shipping_options + * properties: + * shipping_options: + * type: array + * description: "The IDs of the shipping options to associate with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -22,9 +53,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts index a341d64139..145a0958b6 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/create-tax-rate.ts @@ -1,22 +1,77 @@ -import { EntityManager } from "typeorm" -import { IsString, IsArray, IsOptional } from "class-validator" -import { omit } from "lodash" -import { MedusaError } from "medusa-core-utils" +import { IsArray, IsOptional, IsString } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" +import { EntityManager } from "typeorm" +import { IsType } from "../../../../utils/validators/is-type" +import { MedusaError } from "medusa-core-utils" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" +import { omit } from "lodash" import { validator } from "../../../../utils/validator" -import { IsType } from "../../../../utils/validators/is-type" /** * @oas [post] /tax-rates * operationId: "PostTaxRates" * summary: "Create a Tax Rate" * description: "Creates a Tax Rate" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - code + * - name + * - region_id + * properties: + * code: + * type: string + * description: "A code to identify the tax type by" + * name: + * type: string + * description: "A human friendly name for the tax" + * region_id: + * type: string + * description: "The ID of the Region that the rate belongs to" + * rate: + * type: number + * description: "The numeric rate to charge" + * products: + * type: array + * description: "The IDs of the products associated with this tax rate" + * items: + * type: string + * shipping_options: + * type: array + * description: "The IDs of the shipping options associated with this tax rate" + * items: + * type: string + * product_types: + * type: array + * description: "The IDs of the types of products associated with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -25,9 +80,7 @@ import { IsType } from "../../../../utils/validators/is-type" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator(AdminPostTaxRatesReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts index 8fc87e96b4..f97a1fad9f 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/delete-tax-rate.ts @@ -1,5 +1,5 @@ -import { TaxRateService } from "../../../../services" import { EntityManager } from "typeorm" +import { TaxRateService } from "../../../../services" /** * @oas [delete] /tax-rates/{id} @@ -8,9 +8,9 @@ import { EntityManager } from "typeorm" * description: "Deletes a Tax Rate" * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the Shipping Option. + * - (path) id=* {string} The ID of the Shipping Option. * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Shipping Option. + * description: The ID of the deleted Shipping Option. * object: * type: string * description: The type of the object that was deleted. + * default: tax-rate * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts index f5b8928b08..71e80ac276 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/get-tax-rate.ts @@ -1,5 +1,5 @@ -import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -10,9 +10,28 @@ import { validator } from "../../../../utils/validator" * operationId: "GetTaxRatesTaxRate" * summary: "Get Tax Rate" * description: "Retrieves a TaxRate" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -21,9 +40,7 @@ import { validator } from "../../../../utils/validator" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator(AdminGetTaxRatesTaxRateParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts b/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts index dcc4bd5ba3..c50e9e2fcc 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/list-tax-rates.ts @@ -1,12 +1,12 @@ -import { getListConfig, pickByConfig } from "./utils/get-query-config" import { IsArray, IsNumber, IsOptional, IsString } from "class-validator" -import { Type } from "class-transformer" -import { omit, pickBy, identity } from "lodash" +import { getListConfig, pickByConfig } from "./utils/get-query-config" +import { identity, omit, pickBy } from "lodash" -import { TaxRate } from "../../../.." -import { NumericalComparisonOperator } from "../../../../types/common" -import { TaxRateService } from "../../../../services" import { IsType } from "../../../../utils/validators/is-type" +import { NumericalComparisonOperator } from "../../../../types/common" +import { TaxRate } from "../../../.." +import { TaxRateService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** @@ -16,18 +16,63 @@ import { validator } from "../../../../utils/validator" * description: "Retrieves a list of TaxRates" * x-authenticated: true * parameters: - * - (query) q {string} Query used for searching orders. - * - (query) id {string} Id of the order to search for. - * - (query) region_id {string} to search for. - * - (query) code {string} to search for. - * - (query) rate {string} to search for. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting orders was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting orders was updated, i.e. less than, greater than etc. - * - (query) offset {string} How many orders to skip in the result. - * - (query) limit {string} Limit the number of orders returned. - * - (query) fields {string} (Comma separated) Which fields should be included in each order of the result. + * - (query) name {string} Name of tax rate to retrieve + * - in: query + * name: region_id + * style: form + * explode: false + * description: Filter by Region ID + * schema: + * oneOf: + * - type: string + * - type: array + * items: + * type: string + * - (query) code {string} code to search for. + * - in: query + * name: rate + * style: form + * explode: false + * description: Filter by Rate + * schema: + * oneOf: + * - type: number + * - type: object + * properties: + * lt: + * type: number + * description: filter by rates less than this number + * gt: + * type: number + * description: filter by rates greater than this number + * lte: + * type: number + * description: filter by rates less than or equal to this number + * gte: + * type: number + * description: filter by rates greater than or equal to this number + * - (query) offset=0 {integer} How many tax rates to skip before retrieving the result. + * - (query) limit=50 {integer} Limit the number of tax rates returned. + * - in: query + * name: fields + * description: "Which fields should be included in each item." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved for each item." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * tags: - * - Order + * - Tax Rate * responses: * 200: * description: OK @@ -35,10 +80,19 @@ import { validator } from "../../../../utils/validator" * application/json: * schema: * properties: - * orders: + * tax_rates: * type: array * items: - * $ref: "#/components/schemas/order" + * $ref: "#/components/schemas/tax_rate" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const value = await validator(AdminGetTaxRatesParams, req.query) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts index 32fa236b5c..c80190a803 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-product-types.ts @@ -1,5 +1,5 @@ -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -11,9 +11,40 @@ import { EntityManager } from "typeorm" * operationId: "DeleteTaxRatesTaxRateProductTypes" * summary: "Remove Tax Rate from Product Types" * description: "Removes a Tax Rate from a list of Product Types" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - product_types + * properties: + * product_types: + * type: array + * description: "The IDs of the types of products to remove association with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -22,9 +53,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts index 954cceda30..1c3b6996ac 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-products.ts @@ -1,5 +1,5 @@ -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -11,9 +11,40 @@ import { EntityManager } from "typeorm" * operationId: "DeleteTaxRatesTaxRateProducts" * summary: "Removes Tax Rate from Products" * description: "Removes a Tax Rate from a list of Products" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - products + * properties: + * products: + * type: array + * description: "The IDs of the products to remove association with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -22,9 +53,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator(AdminDeleteTaxRatesTaxRateProductsReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts index 1ef6cd5d3b..0a1a13d6d8 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/remove-from-shipping-options.ts @@ -1,5 +1,5 @@ -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" import { IsArray, IsOptional } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" @@ -11,9 +11,40 @@ import { EntityManager } from "typeorm" * operationId: "DeleteTaxRatesTaxRateShippingOptions" * summary: "Removes a Tax Rate from Product Types" * description: "Removes a Tax Rate from a list of Product Types" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - shipping_options + * properties: + * shipping_options: + * type: array + * description: "The IDs of the shipping options to remove association with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -22,9 +53,7 @@ import { EntityManager } from "typeorm" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator( diff --git a/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts b/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts index 3930afc311..2ed36a16e0 100644 --- a/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts +++ b/packages/medusa/src/api/routes/admin/tax-rates/update-tax-rate.ts @@ -1,21 +1,72 @@ -import { EntityManager } from "typeorm" -import { IsString, IsArray, IsOptional } from "class-validator" -import { omit } from "lodash" +import { IsArray, IsOptional, IsString } from "class-validator" +import { getRetrieveConfig, pickByConfig } from "./utils/get-query-config" -import { pickByConfig, getRetrieveConfig } from "./utils/get-query-config" +import { EntityManager } from "typeorm" +import { IsType } from "../../../../utils/validators/is-type" import { TaxRate } from "../../../.." import { TaxRateService } from "../../../../services" +import { omit } from "lodash" import { validator } from "../../../../utils/validator" -import { IsType } from "../../../../utils/validators/is-type" /** * @oas [post] /tax-rates/:id * operationId: "PostTaxRatesTaxRate" * summary: "Update a Tax Rate" * description: "Updates a Tax Rate" + * parameters: + * - in: query + * name: fields + * description: "Which fields should be included in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string + * - in: query + * name: expand + * description: "Which fields should be expanded and retrieved in the result." + * style: form + * explode: false + * schema: + * type: array + * items: + * type: string * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * properties: + * code: + * type: string + * description: "A code to identify the tax type by" + * name: + * type: string + * description: "A human friendly name for the tax" + * region_id: + * type: string + * description: "The ID of the Region that the rate belongs to" + * rate: + * type: number + * description: "The numeric rate to charge" + * products: + * type: array + * description: "The IDs of the products associated with this tax rate" + * items: + * type: string + * shipping_options: + * type: array + * description: "The IDs of the shipping options associated with this tax rate" + * items: + * type: string + * product_types: + * type: array + * description: "The IDs of the types of products associated with this tax rate" + * items: + * type: string * tags: - * - Tax Rates + * - Tax Rate * responses: * 200: * description: OK @@ -24,9 +75,7 @@ import { IsType } from "../../../../utils/validators/is-type" * schema: * properties: * tax_rate: - * type: array - * items: - * $ref: "#/components/schemas/tax_rate" + * $ref: "#/components/schemas/tax_rate" */ export default async (req, res) => { const value = await validator(AdminPostTaxRatesTaxRateReq, req.body) diff --git a/packages/medusa/src/api/routes/admin/uploads/create-upload.ts b/packages/medusa/src/api/routes/admin/uploads/create-upload.ts index 5c9f7e1ba1..174bf2bff4 100644 --- a/packages/medusa/src/api/routes/admin/uploads/create-upload.ts +++ b/packages/medusa/src/api/routes/admin/uploads/create-upload.ts @@ -1,13 +1,22 @@ import fs from "fs" /** - * @oas [post] / + * @oas [post] /uploads * operationId: "PostUploads" - * summary: "Uploads an array of files" - * description: "Uploads an array of files to the specific fileservice that is installed in medusa." + * summary: "Uploads a file" + * description: "Uploads a file to the specific fileservice that is installed in Medusa." * x-authenticated: true * tags: - * - Uploads + * - Upload + * requestBody: + * content: + * multipart/form-data: + * schema: + * type: object + * properties: + * files: + * type: string + * format: binary * responses: * 200: * description: OK @@ -15,7 +24,15 @@ import fs from "fs" * application/json: * schema: * properties: - * uploads + * uploads: + * type: array + * items: + * type: object + * properties: + * url: + * type: string + * description: The URL of the uploaded file. + * format: uri */ export default async (req, res) => { try { diff --git a/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts b/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts index 25be5f5d1d..0affea868a 100644 --- a/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts +++ b/packages/medusa/src/api/routes/admin/uploads/delete-upload.ts @@ -6,11 +6,36 @@ import { IsString } from "class-validator" * summary: "Removes an uploaded file" * description: "Removes an uploaded file using the installed fileservice" * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * required: + * - file_key + * properties: + * file_key: + * description: "key of the file to delete" + * type: string * tags: - * - Uploads + * - Upload * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * properties: + * id: + * type: string + * description: The file key of the upload deleted + * object: + * type: string + * description: The type of the object that was deleted. + * default: file + * deleted: + * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const validated = req.validatedBody as AdminDeleteUploadsReq diff --git a/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts b/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts index 44aa2b2e52..dc354361c3 100644 --- a/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts +++ b/packages/medusa/src/api/routes/admin/uploads/get-download-url.ts @@ -1,5 +1,5 @@ -import { IsString } from "class-validator" import { AbstractFileService } from "../../../../interfaces" +import { IsString } from "class-validator" /** * [post] /uploads/download-url @@ -17,12 +17,18 @@ import { AbstractFileService } from "../../../../interfaces" * file_key: * description: "key of the file to obtain the download link for" * type: string - * - (path) fileKey=* {string} key of the file to obtain the download link for. * tags: - * - Uploads + * - Upload * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * properties: + * download_url: + * type: string + * description: The Download URL of the file */ export default async (req, res) => { const fileService: AbstractFileService = req.scope.resolve("fileService") diff --git a/packages/medusa/src/api/routes/admin/users/create-user.ts b/packages/medusa/src/api/routes/admin/users/create-user.ts index 3c1b8f3ca7..1ed8d7e202 100644 --- a/packages/medusa/src/api/routes/admin/users/create-user.ts +++ b/packages/medusa/src/api/routes/admin/users/create-user.ts @@ -1,7 +1,8 @@ import { IsEmail, IsEnum, IsOptional, IsString } from "class-validator" -import _ from "lodash" + import { UserRoles } from "../../../../models/user" import UserService from "../../../../services/user" +import _ from "lodash" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -22,6 +23,7 @@ import { EntityManager } from "typeorm" * email: * description: "The Users email." * type: string + * format: email * first_name: * description: "The name of the User." * type: string @@ -31,11 +33,13 @@ import { EntityManager } from "typeorm" * role: * description: "Userrole assigned to the user." * type: string + * enum: [admin, member, developer] * password: * description: "The Users password." * type: string + * format: password * tags: - * - Users + * - User * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/users/delete-user.ts b/packages/medusa/src/api/routes/admin/users/delete-user.ts index aa8c9f94c4..a68ca5fe67 100644 --- a/packages/medusa/src/api/routes/admin/users/delete-user.ts +++ b/packages/medusa/src/api/routes/admin/users/delete-user.ts @@ -1,14 +1,14 @@ -import UserService from "../../../../services/user" import { EntityManager } from "typeorm" +import UserService from "../../../../services/user" /** - * @oas [delete] /users/{user_id} + * @oas [delete] /users/{id} * operationId: "DeleteUsersUser" * summary: "Delete a User" * description: "Deletes a User" * x-authenticated: true * parameters: - * - (path) user_id=* {string} The id of the User. + * - (path) id=* {string} The ID of the User. * tags: * - Users * responses: @@ -20,12 +20,15 @@ import { EntityManager } from "typeorm" * properties: * id: * type: string - * description: The id of the deleted Shipping Profile. + * description: The ID of the deleted user. * object: * type: string * description: The type of the object that was deleted. + * default: user * deleted: * type: boolean + * description: Whether or not the items were deleted. + * default: true */ export default async (req, res) => { const { user_id } = req.params diff --git a/packages/medusa/src/api/routes/admin/users/get-user.ts b/packages/medusa/src/api/routes/admin/users/get-user.ts index 4924803394..cddebaca94 100644 --- a/packages/medusa/src/api/routes/admin/users/get-user.ts +++ b/packages/medusa/src/api/routes/admin/users/get-user.ts @@ -7,9 +7,9 @@ import UserService from "../../../../services/user" * description: "Retrieves a User." * x-authenticated: true * parameters: - * - (path) id=* {string} The id of the User. + * - (path) id=* {string} The ID of the User. * tags: - * - Users + * - User * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/users/list-users.ts b/packages/medusa/src/api/routes/admin/users/list-users.ts index e160b7f68e..3e142a156a 100644 --- a/packages/medusa/src/api/routes/admin/users/list-users.ts +++ b/packages/medusa/src/api/routes/admin/users/list-users.ts @@ -7,7 +7,7 @@ import UserService from "../../../../services/user" * description: "Retrieves all users." * x-authenticated: true * tags: - * - Users + * - User * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/users/reset-password-token.ts b/packages/medusa/src/api/routes/admin/users/reset-password-token.ts index 108aa9dec1..5da2d96315 100644 --- a/packages/medusa/src/api/routes/admin/users/reset-password-token.ts +++ b/packages/medusa/src/api/routes/admin/users/reset-password-token.ts @@ -19,8 +19,9 @@ import { EntityManager } from "typeorm" * email: * description: "The Users email." * type: string + * format: email * tags: - * - Users + * - User * responses: * 204: * description: OK diff --git a/packages/medusa/src/api/routes/admin/users/reset-password.ts b/packages/medusa/src/api/routes/admin/users/reset-password.ts index df3c32238e..70c2da56c1 100644 --- a/packages/medusa/src/api/routes/admin/users/reset-password.ts +++ b/packages/medusa/src/api/routes/admin/users/reset-password.ts @@ -1,14 +1,15 @@ import { IsEmail, IsOptional, IsString } from "class-validator" -import jwt from "jsonwebtoken" -import _ from "lodash" + import { MedusaError } from "medusa-core-utils" import { User } from "../../../.." import UserService from "../../../../services/user" +import _ from "lodash" +import jwt from "jsonwebtoken" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" /** - * @oas [post] /users/password-token + * @oas [post] /users/reset-password * operationId: "PostUsersUserPassword" * summary: "Set the password for a User." * description: "Sets the password for a User given the correct token." @@ -18,21 +19,22 @@ import { EntityManager } from "typeorm" * application/json: * schema: * required: - * - email * - token * - password * properties: * email: * description: "The Users email." * type: string + * format: email * token: * description: "The token generated from the 'password-token' endpoint." * type: string * password: * description: "The Users new password." * type: string + * format: password * tags: - * - Users + * - User * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/users/update-user.ts b/packages/medusa/src/api/routes/admin/users/update-user.ts index 91ff090ae6..189af25cf3 100644 --- a/packages/medusa/src/api/routes/admin/users/update-user.ts +++ b/packages/medusa/src/api/routes/admin/users/update-user.ts @@ -1,23 +1,42 @@ import { IsEnum, IsObject, IsOptional, IsString } from "class-validator" + import { UserRoles } from "../../../../models/user" import UserService from "../../../../services/user" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" /** - * @oas [post] /users/{user_id} + * @oas [post] /users/{id} * operationId: "PostUsersUser" * summary: "Update a User" * description: "Updates a User" - * x-authenticated: true * parameters: - * - (path) user_id=* {string} The id of the User. - * - (body) first_name {string} The name of the User. - * - (body) last_name {string} The name of the User. - * - (body) role {string} The role of the User(admin, member, developer). - * - (body) api_token {string} The api_token of the User. + * - (path) id=* {string} The ID of the User. + * x-authenticated: true + * requestBody: + * content: + * application/json: + * schema: + * properties: + * first_name: + * description: "The name of the User." + * type: string + * last_name: + * description: "The name of the User." + * type: string + * role: + * description: "Userrole assigned to the user." + * type: string + * enum: [admin, member, developer] + * api_token: + * description: "The api token of the User." + * type: string + * metadata: + * description: An optional set of key-value pairs with additional information. + * type: object + * * tags: - * - Users + * - User * responses: * 200: * description: OK diff --git a/packages/medusa/src/api/routes/admin/variants/list-variants.ts b/packages/medusa/src/api/routes/admin/variants/list-variants.ts index b7366d790f..6af7f741a0 100644 --- a/packages/medusa/src/api/routes/admin/variants/list-variants.ts +++ b/packages/medusa/src/api/routes/admin/variants/list-variants.ts @@ -1,12 +1,13 @@ +import { IsInt, IsOptional, IsString } from "class-validator" import { defaultAdminVariantFields, defaultAdminVariantRelations } from "./" import { FilterableProductVariantProps } from "../../../../types/product-variant" import { FindConfig } from "../../../../types/common" import { ProductVariant } from "../../../../models/product-variant" import ProductVariantService from "../../../../services/product-variant" -import { validator } from "../../../../utils/validator" import { Type } from "class-transformer" -import { IsInt, IsOptional, IsString } from "class-validator" +import { validator } from "../../../../utils/validator" + /** * @oas [get] /variants * operationId: "GetVariants" @@ -15,8 +16,8 @@ import { IsInt, IsOptional, IsString } from "class-validator" * x-authenticated: true * parameters: * - (query) q {string} Query used for searching variants. - * - (query) offset {string} How many variants to skip in the result. - * - (query) limit {string} Limit the number of variants returned. + * - (query) offset=0 {integer} How many variants to skip in the result. + * - (query) limit=20 {integer} Limit the number of variants returned. * tags: * - Product Variant * responses: @@ -30,6 +31,15 @@ import { IsInt, IsOptional, IsString } from "class-validator" * type: array * items: * $ref: "#/components/schemas/product_variant" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const variantService: ProductVariantService = req.scope.resolve( diff --git a/packages/medusa/src/api/routes/store/auth/exists.ts b/packages/medusa/src/api/routes/store/auth/exists.ts index 980d1c835d..6baeda0b75 100644 --- a/packages/medusa/src/api/routes/store/auth/exists.ts +++ b/packages/medusa/src/api/routes/store/auth/exists.ts @@ -5,7 +5,13 @@ import CustomerService from "../../../../services/customer" * summary: "Check if email has account" * description: "Checks if a Customer with the given email has signed up." * parameters: - * - (path) email=* {string} The Customer's email. + * - in: path + * name: email + * schema: + * type: string + * format: email + * required: true + * description: The email to check if exists. * tags: * - Auth * responses: @@ -17,6 +23,7 @@ import CustomerService from "../../../../services/customer" * properties: * exists: * type: boolean + * description: Whether email exists or not. */ export default async (req, res) => { const { email } = req.params diff --git a/packages/medusa/src/api/routes/store/auth/get-session.ts b/packages/medusa/src/api/routes/store/auth/get-session.ts index eb3f842b96..af856a46f4 100644 --- a/packages/medusa/src/api/routes/store/auth/get-session.ts +++ b/packages/medusa/src/api/routes/store/auth/get-session.ts @@ -8,6 +8,8 @@ import CustomerService from "../../../../services/customer" * tags: * - Auth * responses: + * "401": + * description: Unauthorized * "200": * description: OK * content: diff --git a/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts b/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts index f891fcc8e7..e1471eb649 100644 --- a/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts +++ b/packages/medusa/src/api/routes/store/carts/add-shipping-method.ts @@ -1,9 +1,10 @@ import { IsOptional, IsString } from "class-validator" -import { EntityManager } from "typeorm" import { defaultStoreCartFields, defaultStoreCartRelations } from "." + import { CartService } from "../../../../services" -import { validator } from "../../../../utils/validator" +import { EntityManager } from "typeorm" import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" +import { validator } from "../../../../utils/validator" /** * @oas [post] /carts/{id}/shipping-methods @@ -13,12 +14,12 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * tags: * - Cart * parameters: - * - (path) id=* {String} The cart id. - * - (body) option_id=* {String} id of the shipping option to create the method from + * - (path) id=* {string} The cart ID. + * - (body) option_id=* {string} ID of the shipping option to create the method from * - (body) data {Object} Used to hold any data that the shipping method may need to process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send. * responses: * "200": - * description: "A successful response" + * description: OK * content: * application/json: * schema: diff --git a/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts b/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts index 53fdf80093..aa3e957eb6 100644 --- a/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts +++ b/packages/medusa/src/api/routes/store/carts/calculate-taxes.ts @@ -1,6 +1,7 @@ +import { CartService, IdempotencyKeyService } from "../../../../services" + import { EntityManager } from "typeorm" import { IdempotencyKey } from "../../../../models/idempotency-key" -import { CartService, IdempotencyKeyService } from "../../../../services" import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" /** @@ -10,20 +11,18 @@ import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" * description: "Calculates taxes for a cart. Depending on the cart's region * this may involve making 3rd party API calls to a Tax Provider service." * parameters: - * - (path) id=* {String} The Cart id. + * - (path) id=* {String} The Cart ID. * tags: * - Cart * responses: * 200: - * description: "A cart object with the tax_total field populated" + * description: OK * content: * application/json: * schema: - * oneOf: - * - type: object - * properties: - * cart: - * $ref: "#/components/schemas/cart" + * properties: + * cart: + * $ref: "#/components/schemas/cart" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/complete-cart.ts b/packages/medusa/src/api/routes/store/carts/complete-cart.ts index c23588515a..8d422e486a 100644 --- a/packages/medusa/src/api/routes/store/carts/complete-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/complete-cart.ts @@ -1,7 +1,7 @@ -import { ICartCompletionStrategy } from "../../../../interfaces" -import { IdempotencyKeyService } from "../../../../services" -import { IdempotencyKey } from "../../../../models/idempotency-key" import { EntityManager } from "typeorm"; +import { ICartCompletionStrategy } from "../../../../interfaces" +import { IdempotencyKey } from "../../../../models/idempotency-key" +import { IdempotencyKeyService } from "../../../../services" /** * @oas [post] /carts/{id}/complete @@ -26,19 +26,30 @@ import { EntityManager } from "typeorm"; * content: * application/json: * schema: - * oneOf: - * - type: object - * properties: - * order: - * $ref: "#/components/schemas/order" - * - type: object - * properties: - * cart: - * $ref: "#/components/schemas/cart" - * - type: object - * properties: - * cart: - * $ref: "#/components/schemas/swap" + * properties: + * type: + * type: string + * description: The type of the data property. + * enum: [order, cart, swap] + * data: + * type: object + * description: The data of the result object. Its type depends on the type field. + * oneOf: + * - type: object + * description: Cart was successfully authorized and order was placed successfully. + * properties: + * order: + * $ref: "#/components/schemas/order" + * - type: object + * description: Cart was successfully authorized but requires further actions. + * properties: + * cart: + * $ref: "#/components/schemas/cart" + * - type: object + * description: When cart is used for a swap and it has been completed successfully. + * properties: + * cart: + * $ref: "#/components/schemas/swap" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/carts/create-cart.ts b/packages/medusa/src/api/routes/store/carts/create-cart.ts index 852d8c0ffc..76786e31ef 100644 --- a/packages/medusa/src/api/routes/store/carts/create-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/create-cart.ts @@ -1,4 +1,4 @@ -import { Type } from "class-transformer" +import { CartService, LineItemService, RegionService } from "../../../../services" import { IsArray, IsBoolean, @@ -8,17 +8,17 @@ import { IsString, ValidateNested, } from "class-validator" -import { MedusaError } from "medusa-core-utils" -import reqIp from "request-ip" -import { EntityManager } from "typeorm" +import { defaultStoreCartFields, defaultStoreCartRelations, } from "." -import { defaultStoreCartFields, defaultStoreCartRelations, } from "." -import { CartService, LineItemService, RegionService } from "../../../../services" -import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" -import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"; +import { Cart } from "../../../../models"; +import { EntityManager } from "typeorm" import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators"; import { FlagRouter } from "../../../../utils/flag-router" -import { Cart } from "../../../../models"; +import { MedusaError } from "medusa-core-utils" +import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"; +import { Type } from "class-transformer" +import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" +import reqIp from "request-ip" /** * @oas [post] /carts @@ -35,17 +35,23 @@ import { Cart } from "../../../../models"; * properties: * region_id: * type: string - * description: The id of the Region to create the Cart in. - * sales_channel_id: + * description: The ID of the Region to create the Cart in. + * sales_channel_id: * type: string - * description: [EXPERIMENTAL] The id of the Sales channel to create the Cart in. + * description: "[EXPERIMENTAL] The ID of the Sales channel to create the Cart in." * country_code: * type: string * description: "The 2 character ISO country code to create the Cart in." + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * description: See a list of codes. * items: * description: "An optional array of `variant_id`, `quantity` pairs to generate Line Items from." * type: array * items: + * required: + * - variant_id + * - quantity * properties: * variant_id: * description: The id of the Product Variant to generate a Line Item from. @@ -56,6 +62,9 @@ import { Cart } from "../../../../models"; * context: * description: "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`" * type: object + * example: + * ip: "::1" + * user_agent: "Chrome" * tags: * - Cart * responses: diff --git a/packages/medusa/src/api/routes/store/carts/set-payment-session.ts b/packages/medusa/src/api/routes/store/carts/set-payment-session.ts index 4d31d49b07..8a8106e500 100644 --- a/packages/medusa/src/api/routes/store/carts/set-payment-session.ts +++ b/packages/medusa/src/api/routes/store/carts/set-payment-session.ts @@ -1,9 +1,10 @@ -import { IsString } from "class-validator" import { defaultStoreCartFields, defaultStoreCartRelations } from "." + import { CartService } from "../../../../services" -import { validator } from "../../../../utils/validator" -import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" import { EntityManager } from "typeorm"; +import { IsString } from "class-validator" +import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" +import { validator } from "../../../../utils/validator" /** * @oas [post] /carts/{id}/payment-session @@ -11,8 +12,8 @@ import { EntityManager } from "typeorm"; * summary: Select a Payment Session * description: "Selects a Payment Session as the session intended to be used towards the completion of the Cart." * parameters: - * - (path) id=* {string} The id of the Cart. - * - (body) provider_id=* {string} The id of the Payment Provider. + * - (path) id=* {string} The ID of the Cart. + * - (body) provider_id=* {string} The ID of the Payment Provider. * tags: * - Cart * responses: diff --git a/packages/medusa/src/api/routes/store/carts/update-cart.ts b/packages/medusa/src/api/routes/store/carts/update-cart.ts index 7a14cb902e..206dd22014 100644 --- a/packages/medusa/src/api/routes/store/carts/update-cart.ts +++ b/packages/medusa/src/api/routes/store/carts/update-cart.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsEmail, @@ -7,18 +6,20 @@ import { ValidateNested, } from "class-validator" import { defaultStoreCartFields, defaultStoreCartRelations } from "." -import { CartService } from "../../../../services" + import { AddressPayload } from "../../../../types/common" -import { IsType } from "../../../../utils/validators/is-type" -import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" +import { CartService } from "../../../../services" import { EntityManager } from "typeorm"; import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators"; +import { IsType } from "../../../../utils/validators/is-type" import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"; +import { Type } from "class-transformer" +import { decorateLineItemsWithTotals } from "./decorate-line-items-with-totals" /** - * @oas [post] /store/carts/{id} + * @oas [post] /carts/{id} * operationId: PostCartsCart - * summary: Update a Cart" + * summary: Update a Cart * description: "Updates a Cart." * parameters: * - (path) id=* {string} The id of the Cart. @@ -33,20 +34,30 @@ import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-cha * country_code: * type: string * description: "The 2 character ISO country code to create the Cart in." + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * description: See a list of codes. * email: * type: string * description: "An email to be used on the Cart." - * sales_channel_id: + * format: email + * sales_channel_id: * type: string - * description: The id of the Sales channel to update the Cart with. + * description: The ID of the Sales channel to update the Cart with. * billing_address: * description: "The Address to be used for billing purposes." * anyOf: * - $ref: "#/components/schemas/address" + * description: A full billing address object. + * - type: string + * description: The billing address ID * shipping_address: * description: "The Address to be used for shipping." * anyOf: * - $ref: "#/components/schemas/address" + * description: A full shipping address object. + * - type: string + * description: The shipping address ID * gift_cards: * description: "An array of Gift Card codes to add to the Cart." * type: array @@ -68,11 +79,14 @@ import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-cha * description: "The code that a Discount is identifed by." * type: string * customer_id: - * description: "The id of the Customer to associate the Cart with." + * description: "The ID of the Customer to associate the Cart with." * type: string * context: * description: "An optional object to provide context to the Cart." * type: object + * example: + * ip: "::1" + * user_agent: "Chrome" * tags: * - Cart * responses: diff --git a/packages/medusa/src/api/routes/store/collections/list-collections.ts b/packages/medusa/src/api/routes/store/collections/list-collections.ts index f4e94f4758..975eb21096 100644 --- a/packages/medusa/src/api/routes/store/collections/list-collections.ts +++ b/packages/medusa/src/api/routes/store/collections/list-collections.ts @@ -1,8 +1,9 @@ -import { Type } from "class-transformer" -import { ValidateNested, IsOptional, IsInt } from "class-validator" -import ProductCollectionService from "../../../../services/product-collection" -import { validator } from "../../../../utils/validator" +import { IsInt, IsOptional, ValidateNested } from "class-validator" + import { DateComparisonOperator } from "../../../../types/common" +import ProductCollectionService from "../../../../services/product-collection" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" /** * @oas [get] /collections @@ -12,6 +13,50 @@ import { DateComparisonOperator } from "../../../../types/common" * parameters: * - (query) offset=0 {integer} The number of collections to skip before starting to collect the collections set * - (query) limit=10 {integer} The number of collections to return + * - in: query + * name: created_at + * description: Date comparison for when resulting collections were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting collections were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: * - Collection * responses: @@ -21,8 +66,19 @@ import { DateComparisonOperator } from "../../../../types/common" * application/json: * schema: * properties: - * collection: - * $ref: "#/components/schemas/product_collection" + * collections: + * type: array + * items: + * $ref: "#/components/schemas/product_collection" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const validated = await validator(StoreGetCollectionsParams, req.query) diff --git a/packages/medusa/src/api/routes/store/customers/create-address.ts b/packages/medusa/src/api/routes/store/customers/create-address.ts index 3b7a7d78b6..a0c2c488ea 100644 --- a/packages/medusa/src/api/routes/store/customers/create-address.ts +++ b/packages/medusa/src/api/routes/store/customers/create-address.ts @@ -15,9 +15,9 @@ import { EntityManager } from "typeorm" * requestBody: * content: * application/json: - * required: - * - address * schema: + * required: + * - address * properties: * address: * description: "The Address to add to the Customer." diff --git a/packages/medusa/src/api/routes/store/customers/create-customer.ts b/packages/medusa/src/api/routes/store/customers/create-customer.ts index 3280532f89..2bf26a9533 100644 --- a/packages/medusa/src/api/routes/store/customers/create-customer.ts +++ b/packages/medusa/src/api/routes/store/customers/create-customer.ts @@ -1,8 +1,9 @@ import { IsEmail, IsOptional, IsString } from "class-validator" -import jwt from "jsonwebtoken" import { defaultStoreCustomersFields, defaultStoreCustomersRelations } from "." + import { Customer } from "../../../.." import CustomerService from "../../../../services/customer" +import jwt from "jsonwebtoken" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -11,12 +12,33 @@ import { EntityManager } from "typeorm" * operationId: PostCustomers * summary: Create a Customer * description: "Creates a Customer account." - * parameters: - * - (body) email=* {string} The Customer's email address. - * - (body) first_name=* {string} The Customer's first name. - * - (body) last_name=* {string} The Customer's last name. - * - (body) password=* {string} The Customer's password for login. - * - (body) phone {string} The Customer's phone number. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - first_name + * - last_name + * - email + * - password + * properties: + * first_name: + * description: "The Customer's first name." + * type: string + * last_name: + * description: "The Customer's last name." + * type: string + * email: + * description: "The email of the customer." + * type: string + * format: email + * password: + * description: "The Customer's password." + * type: string + * format: password + * phone: + * description: "The Customer's phone number." + * type: string * tags: * - Customer * responses: @@ -28,6 +50,25 @@ import { EntityManager } from "typeorm" * properties: * customer: * $ref: "#/components/schemas/customer" + * 422: + * description: A customer with the same email exists + * content: + * application/json: + * schema: + * properties: + * code: + * type: string + * description: The error code + * type: + * type: string + * description: The type of error + * message: + * type: string + * description: Human-readable message with details about the error + * example: + * code: "invalid_request_error" + * type: "duplicate_error" + * message: "A customer with the given email already has an account. Log in instead" */ export default async (req, res) => { const validated = await validator(StorePostCustomersReq, req.body) diff --git a/packages/medusa/src/api/routes/store/customers/delete-address.ts b/packages/medusa/src/api/routes/store/customers/delete-address.ts index 7083e0d516..f42f7f3623 100644 --- a/packages/medusa/src/api/routes/store/customers/delete-address.ts +++ b/packages/medusa/src/api/routes/store/customers/delete-address.ts @@ -1,4 +1,5 @@ import { defaultStoreCustomersFields, defaultStoreCustomersRelations } from "." + import CustomerService from "../../../../services/customer" import { EntityManager } from "typeorm" @@ -6,7 +7,7 @@ import { EntityManager } from "typeorm" * @oas [delete] /customers/me/addresses/{address_id} * operationId: DeleteCustomersCustomerAddressesAddress * summary: Delete an Address - * description: "Removes an Address from the Customer's saved addresse." + * description: "Removes an Address from the Customer's saved addresses." * x-authenticated: true * parameters: * - (path) address_id=* {string} The id of the Address to remove. diff --git a/packages/medusa/src/api/routes/store/customers/list-orders.ts b/packages/medusa/src/api/routes/store/customers/list-orders.ts index bf3b7543cb..642f52d761 100644 --- a/packages/medusa/src/api/routes/store/customers/list-orders.ts +++ b/packages/medusa/src/api/routes/store/customers/list-orders.ts @@ -1,7 +1,4 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString } from "class-validator" -import OrderService from "../../../../services/order" -import { validator } from "../../../../utils/validator" import { allowedStoreOrdersFields, allowedStoreOrdersRelations, @@ -9,6 +6,10 @@ import { import { FindConfig } from "../../../../types/common" import { Order } from "../../../../models" +import OrderService from "../../../../services/order" +import { Type } from "class-transformer" +import { validator } from "../../../../utils/validator" + /** * @oas [get] /customers/me/orders * operationId: GetCustomersCustomerOrders @@ -16,10 +17,10 @@ import { Order } from "../../../../models" * description: "Retrieves a list of a Customer's Orders." * x-authenticated: true * parameters: - * - (query) limit {integer} How many addresses to return. - * - (query) offset {integer} The offset in the resulting addresses. - * - (query) fields {string} (Comma separated string) Which fields should be included in the resulting addresses. - * - (query) expand {string} (Comma separated string) Which relations should be expanded in the resulting addresses. + * - (query) limit=10 {integer} How many orders to return. + * - (query) offset=0 {integer} The offset in the resulting orders. + * - (query) fields {string} (Comma separated string) Which fields should be included in the resulting orders. + * - (query) expand {string} (Comma separated string) Which relations should be expanded in the resulting orders. * tags: * - Customer * responses: @@ -29,19 +30,19 @@ import { Order } from "../../../../models" * application/json: * schema: * properties: - * count: - * description: The total number of Orders. - * type: integer - * offset: - * description: The offset for pagination. - * type: integer - * limit: - * description: The maxmimum number of Orders to return, - * type: integer * orders: * type: array * items: - * $ref: "#/components/schemas/orders" + * $ref: "#/components/schemas/order" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const id: string = req.user.customer_id diff --git a/packages/medusa/src/api/routes/store/customers/reset-password-token.ts b/packages/medusa/src/api/routes/store/customers/reset-password-token.ts index f692ff32d3..26de59e6d2 100644 --- a/packages/medusa/src/api/routes/store/customers/reset-password-token.ts +++ b/packages/medusa/src/api/routes/store/customers/reset-password-token.ts @@ -1,5 +1,5 @@ -import { IsEmail } from "class-validator" import CustomerService from "../../../../services/customer" +import { IsEmail } from "class-validator" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -8,8 +8,17 @@ import { EntityManager } from "typeorm" * operationId: PostCustomersCustomerPasswordToken * summary: Creates a reset password token * description: "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned." - * parameters: - * - (body) email=* {string} Email of the user whose password should be reset. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - email + * properties: + * email: + * description: "The email of the customer." + * type: string + * format: email * tags: * - Customer * responses: diff --git a/packages/medusa/src/api/routes/store/customers/reset-password.ts b/packages/medusa/src/api/routes/store/customers/reset-password.ts index 6520983704..9af27db335 100644 --- a/packages/medusa/src/api/routes/store/customers/reset-password.ts +++ b/packages/medusa/src/api/routes/store/customers/reset-password.ts @@ -1,18 +1,35 @@ import { IsEmail, IsString } from "class-validator" import jwt, { JwtPayload } from "jsonwebtoken" + import CustomerService from "../../../../services/customer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" /** - * @oas [post] /customers/reset-password + * @oas [post] /customers/password-reset * operationId: PostCustomersResetPassword * summary: Resets Customer password * description: "Resets a Customer's password using a password token created by a previous /password-token request." - * parameters: - * - (body) email=* {string} The Customer's email. - * - (body) token=* {string} The password token created by a /password-token request. - * - (body) password=* {string} The new password to set for the Customer. + * requestBody: + * content: + * application/json: + * schema: + * required: + * - email + * - password + * - token + * properties: + * email: + * description: "The email of the customer." + * type: string + * format: email + * password: + * description: "The Customer's password." + * type: string + * format: password + * token: + * description: "The reset password token" + * type: string * tags: * - Customer * responses: diff --git a/packages/medusa/src/api/routes/store/customers/update-address.ts b/packages/medusa/src/api/routes/store/customers/update-address.ts index fd07cb2936..fbbc809189 100644 --- a/packages/medusa/src/api/routes/store/customers/update-address.ts +++ b/packages/medusa/src/api/routes/store/customers/update-address.ts @@ -1,6 +1,7 @@ import { defaultStoreCustomersFields, defaultStoreCustomersRelations } from "." -import CustomerService from "../../../../services/customer" + import { AddressPayload } from "../../../../types/common" +import CustomerService from "../../../../services/customer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -16,11 +17,8 @@ import { EntityManager } from "typeorm" * content: * application/json: * schema: - * properties: - * address: - * description: "The updated Address." - * anyOf: - * - $ref: "#/components/schemas/address" + * anyOf: + * - $ref: "#/components/schemas/address" * tags: * - Customer * responses: diff --git a/packages/medusa/src/api/routes/store/customers/update-customer.ts b/packages/medusa/src/api/routes/store/customers/update-customer.ts index 598200e8e4..7f93d52bd2 100644 --- a/packages/medusa/src/api/routes/store/customers/update-customer.ts +++ b/packages/medusa/src/api/routes/store/customers/update-customer.ts @@ -1,7 +1,8 @@ import { IsEmail, IsObject, IsOptional, IsString } from "class-validator" import { defaultStoreCustomersFields, defaultStoreCustomersRelations } from "." -import CustomerService from "../../../../services/customer" + import { AddressPayload } from "../../../../types/common" +import CustomerService from "../../../../services/customer" import { IsType } from "../../../../utils/validators/is-type" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm" @@ -27,6 +28,9 @@ import { EntityManager } from "typeorm" * description: "The Address to be used for billing purposes." * anyOf: * - $ref: "#/components/schemas/address" + * description: The full billing address object + * - type: string + * description: The ID of an existing billing address * password: * description: "The Customer's password." * type: string diff --git a/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts b/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts index be96e75ea8..1b4b2e8b7d 100644 --- a/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts +++ b/packages/medusa/src/api/routes/store/gift-cards/get-gift-card.ts @@ -1,4 +1,5 @@ import { defaultStoreGiftCardFields, defaultStoreGiftCardRelations } from "." + import GiftCardService from "../../../../services/gift-card" /** @@ -17,16 +18,8 @@ import GiftCardService from "../../../../services/gift-card" * application/json: * schema: * properties: - * id: - * description: The id of the Gift Card - * code: - * description: The code of the Gift Card - * value: - * description: The original value of the Gift Card. - * balance: - * description: The current balanace of the Gift Card - * region: - * $ref: "#/components/schemas/region" + * gift_card: + * $ref: "#/components/schemas/gift_card" */ export default async (req, res) => { const { code } = req.params diff --git a/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts b/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts index 4ddae453f4..7dd63384bd 100644 --- a/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts +++ b/packages/medusa/src/api/routes/store/orders/get-order-by-cart.ts @@ -1,4 +1,5 @@ import { defaultStoreOrdersFields, defaultStoreOrdersRelations } from "." + import { OrderService } from "../../../../services" /** @@ -7,7 +8,7 @@ import { OrderService } from "../../../../services" * summary: Retrieves Order by Cart id * description: "Retrieves an Order by the id of the Cart that was used to create the Order." * parameters: - * - (path) cart_id=* {string} The id of Cart. + * - (path) cart_id=* {string} The ID of Cart. * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/store/orders/get-order.ts b/packages/medusa/src/api/routes/store/orders/get-order.ts index 6135f6b9f4..fb4218bc47 100644 --- a/packages/medusa/src/api/routes/store/orders/get-order.ts +++ b/packages/medusa/src/api/routes/store/orders/get-order.ts @@ -1,6 +1,7 @@ -import { OrderService } from "../../../../services" import { defaultStoreOrdersFields, defaultStoreOrdersRelations } from "./index" +import { OrderService } from "../../../../services" + /** * @oas [get] /orders/{id} * operationId: GetOrdersOrder @@ -17,8 +18,8 @@ import { defaultStoreOrdersFields, defaultStoreOrdersRelations } from "./index" * application/json: * schema: * properties: - * customer: - * $ref: "#/components/schemas/customer" + * order: + * $ref: "#/components/schemas/order" */ export default async (req, res) => { const { id } = req.params diff --git a/packages/medusa/src/api/routes/store/orders/lookup-order.ts b/packages/medusa/src/api/routes/store/orders/lookup-order.ts index ae445ba5ae..2efb40b718 100644 --- a/packages/medusa/src/api/routes/store/orders/lookup-order.ts +++ b/packages/medusa/src/api/routes/store/orders/lookup-order.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsEmail, IsNumber, @@ -7,17 +6,38 @@ import { ValidateNested, } from "class-validator" import { defaultStoreOrdersFields, defaultStoreOrdersRelations } from "." + import { OrderService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** * @oas [get] /orders * operationId: "GetOrders" * summary: "Look Up an Order" - * description: "Looks for an Order with a given `display_id`, `email` pair. The `display_id`, `email` pair must match in order for the Order to be returned." + * description: "Look up an order using filters." * parameters: * - (query) display_id=* {number} The display id given to the Order. - * - (query) email=* {string} The email of the Order with the given display_id. + * - in: query + * name: email + * style: form + * explode: false + * description: The email associated with this order. + * required: true + * schema: + * type: string + * format: email + * - in: query + * name: shipping_address + * style: form + * explode: false + * description: The shipping address associated with this order. + * schema: + * type: object + * properties: + * postal_code: + * type: string + * description: The postal code of the shipping address * tags: * - Order * responses: diff --git a/packages/medusa/src/api/routes/store/products/list-products.ts b/packages/medusa/src/api/routes/store/products/list-products.ts index 586ac505f4..0ac75ac931 100644 --- a/packages/medusa/src/api/routes/store/products/list-products.ts +++ b/packages/medusa/src/api/routes/store/products/list-products.ts @@ -1,4 +1,8 @@ -import { Transform, Type } from "class-transformer" +import { + CartService, + ProductService, + RegionService, +} from "../../../../services" import { IsArray, IsBoolean, @@ -7,20 +11,17 @@ import { IsString, ValidateNested, } from "class-validator" +import { Transform, Type } from "class-transformer" import { omit, pickBy } from "lodash" -import { defaultStoreProductsRelations } from "." -import { - ProductService, - RegionService, - CartService, -} from "../../../../services" -import PricingService from "../../../../services/pricing" + import { DateComparisonOperator } from "../../../../types/common" -import { PriceSelectionParams } from "../../../../types/price-selection" -import { validator } from "../../../../utils/validator" import { IsType } from "../../../../utils/validators/is-type" -import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean" +import { PriceSelectionParams } from "../../../../types/price-selection" +import PricingService from "../../../../services/pricing" import { Product } from "../../../../models" +import { defaultStoreProductsRelations } from "." +import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean" +import { validator } from "../../../../utils/validator" /** * @oas [get] /products @@ -28,20 +29,89 @@ import { Product } from "../../../../models" * summary: List Products * description: "Retrieves a list of Products." * parameters: - * - (query) q {string} Query used for searching products. - * - (query) id {string} Id of the product to search for. - * - (query) collection_id {string[]} Collection ids to search for. - * - (query) tags {string[]} Tags to search for. - * - (query) title {string} to search for. - * - (query) description {string} to search for. - * - (query) handle {string} to search for. - * - (query) is_giftcard {string} Search for giftcards using is_giftcard=true. - * - (query) type {string} to search for. - * - (query) created_at {DateComparisonOperator} Date comparison for when resulting products was created, i.e. less than, greater than etc. - * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting products was updated, i.e. less than, greater than etc. - * - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting products was deleted, i.e. less than, greater than etc. - * - (query) offset {string} How many products to skip in the result. - * - (query) limit {string} Limit the number of products returned. + * - (query) q {string} Query used for searching products by title, description, variant's title, variant's sku, and collection's title + * - in: query + * name: id + * style: form + * explode: false + * description: product IDs to search for. + * schema: + * oneOf: + * - type: string + * - type: array + * items: + * type: string + * - in: query + * name: collection_id + * style: form + * explode: false + * description: Collection IDs to search for + * schema: + * type: array + * items: + * type: string + * - in: query + * name: tags + * style: form + * explode: false + * description: Tag IDs to search for + * schema: + * type: array + * items: + * type: string + * - (query) title {string} title to search for. + * - (query) description {string} description to search for. + * - (query) handle {string} handle to search for. + * - (query) is_giftcard {boolean} Search for giftcards using is_giftcard=true. + * - (query) type {string} type to search for. + * - in: query + * name: created_at + * description: Date comparison for when resulting products were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting products were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - (query) offset=0 {integer} How many products to skip in the result. + * - (query) limit=100 {integer} Limit the number of products returned. + * - (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. * tags: * - Product * responses: @@ -51,19 +121,19 @@ import { Product } from "../../../../models" * application/json: * schema: * properties: - * count: - * description: The total number of Products. - * type: integer - * offset: - * description: The offset for pagination. - * type: integer - * limit: - * description: The maxmimum number of Products to return, - * type: integer * products: * type: array * items: * $ref: "#/components/schemas/product" + * count: + * type: integer + * description: The total number of items available + * offset: + * type: integer + * description: The number of items skipped before these items + * limit: + * type: integer + * description: The number of items per page */ export default async (req, res) => { const productService: ProductService = req.scope.resolve("productService") diff --git a/packages/medusa/src/api/routes/store/products/search.ts b/packages/medusa/src/api/routes/store/products/search.ts index b7a0a137d7..d8d61e1448 100644 --- a/packages/medusa/src/api/routes/store/products/search.ts +++ b/packages/medusa/src/api/routes/store/products/search.ts @@ -1,9 +1,33 @@ -import { Type } from "class-transformer" import { IsNumber, IsOptional, IsString } from "class-validator" -import { SearchService } from "../../../../services" + import ProductService from "../../../../services/product" +import { SearchService } from "../../../../services" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" +/** + * @oas [get] /products/search + * operationId: GetProductsSearch + * summary: Search Products + * description: "Run a search query on products using the search engine installed on Medusa" + * parameters: + * - (query) q=* {string} The query to run the search with. + * - (query) offset {integer} How many products to skip in the result. + * - (query) limit {integer} Limit the number of products returned. + * - (query) filter {} Filter based on the search engine. + * tags: + * - Product + * responses: + * 200: + * description: OK + * content: + * application/json: + * schema: + * properties: + * hits: + * type: array + * description: Array of results. The format of the items depends on the search engine installed on the server. + */ export default async (req, res) => { // As we want to allow wildcards, we pass a config allowing this const validated = await validator(StorePostSearchReq, req.body, { diff --git a/packages/medusa/src/api/routes/store/regions/list-regions.ts b/packages/medusa/src/api/routes/store/regions/list-regions.ts index 2bb2a69a7e..ffdf84a351 100644 --- a/packages/medusa/src/api/routes/store/regions/list-regions.ts +++ b/packages/medusa/src/api/routes/store/regions/list-regions.ts @@ -1,15 +1,63 @@ +import { IsInt, IsOptional, ValidateNested } from "class-validator" + +import { DateComparisonOperator } from "../../../../types/common" +import RegionService from "../../../../services/region" import { Type } from "class-transformer" import { omit } from "lodash" -import { ValidateNested, IsInt, IsOptional } from "class-validator" -import RegionService from "../../../../services/region" import { validator } from "../../../../utils/validator" -import { DateComparisonOperator } from "../../../../types/common" /** * @oas [get] /regions * operationId: GetRegions * summary: List Regions * description: "Retrieves a list of Regions." + * parameters: + * - (query) offset=0 {integer} How many regions to skip in the result. + * - (query) limit=100 {integer} Limit the number of regions returned. + * - in: query + * name: created_at + * description: Date comparison for when resulting regions were created. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date + * - in: query + * name: updated_at + * description: Date comparison for when resulting regions were updated. + * schema: + * type: object + * properties: + * lt: + * type: string + * description: filter by dates less than this date + * format: date + * gt: + * type: string + * description: filter by dates greater than this date + * format: date + * lte: + * type: string + * description: filter by dates less than or equal to this date + * format: date + * gte: + * type: string + * description: filter by dates greater than or equal to this date + * format: date * tags: * - Region * responses: @@ -19,15 +67,6 @@ import { DateComparisonOperator } from "../../../../types/common" * application/json: * schema: * properties: - * count: - * description: The total number of regions. - * type: integer - * offset: - * description: The offset for pagination. - * type: integer - * limit: - * description: The maxmimum number of regions to return, - * type: integer * regions: * type: array * items: diff --git a/packages/medusa/src/api/routes/store/returns/create-return.ts b/packages/medusa/src/api/routes/store/returns/create-return.ts index f280a82361..600c802f76 100644 --- a/packages/medusa/src/api/routes/store/returns/create-return.ts +++ b/packages/medusa/src/api/routes/store/returns/create-return.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsNotEmpty, @@ -8,11 +7,13 @@ import { Min, ValidateNested, } from "class-validator" -import { MedusaError } from "medusa-core-utils" + import EventBusService from "../../../../services/event-bus" import IdempotencyKeyService from "../../../../services/idempotency-key" +import { MedusaError } from "medusa-core-utils" import OrderService from "../../../../services/order" import ReturnService from "../../../../services/return" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" import { EntityManager } from "typeorm"; @@ -25,36 +26,42 @@ import { EntityManager } from "typeorm"; * content: * application/json: * schema: + * required: + * - order_id + * - items * properties: * order_id: * type: string - * description: The id of the Order to create the Return from. + * description: The ID of the Order to create the Return from. * items: * description: "The items to include in the Return." * type: array * items: + * required: + * - item_id + * - quantity * properties: * item_id: - * description: The id of the Line Item from the Order. + * description: The ID of the Line Item from the Order. * type: string * quantity: * description: The quantity to return. * type: integer - * required: - * - item_id - * - quantity + * reason_id: + * description: The ID of the return reason. + * type: string + * note: + * description: A note to add to the item returned. + * type: string * return_shipping: * description: If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves. * type: object + * required: + * - option_id * properties: * option_id: * type: string - * description: The id of the Shipping Option to create the Shipping Method from. - * required: - * - option_id - * required: - * - order_id - * - items + * description: The ID of the Shipping Option to create the Shipping Method from. * tags: * - Return * responses: diff --git a/packages/medusa/src/api/routes/store/swaps/create-swap.ts b/packages/medusa/src/api/routes/store/swaps/create-swap.ts index 366b1ae794..1877753b49 100644 --- a/packages/medusa/src/api/routes/store/swaps/create-swap.ts +++ b/packages/medusa/src/api/routes/store/swaps/create-swap.ts @@ -1,4 +1,3 @@ -import { Type } from "class-transformer" import { IsArray, IsNotEmpty, @@ -8,14 +7,16 @@ import { Min, ValidateNested, } from "class-validator" -import { MedusaError } from "medusa-core-utils" import { defaultStoreSwapFields, defaultStoreSwapRelations } from "." + +import { EntityManager } from "typeorm" import IdempotencyKeyService from "../../../../services/idempotency-key" +import { MedusaError } from "medusa-core-utils" import OrderService from "../../../../services/order" import ReturnService from "../../../../services/return" import SwapService from "../../../../services/swap" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" -import { EntityManager } from "typeorm" /** * @oas [post] /swaps @@ -33,7 +34,7 @@ import { EntityManager } from "typeorm" * properties: * order_id: * type: string - * description: The id of the Order to create the Swap for. + * description: The ID of the Order to create the Swap for. * return_items: * description: "The items to include in the Return." * type: array @@ -43,20 +44,20 @@ import { EntityManager } from "typeorm" * - quantity * properties: * item_id: - * description: The id of the Line Item from the Order. + * description: The ID of the Line Item from the Order. * type: string * quantity: - * description: The quantity to return. + * description: The quantity to swap. * type: integer * reason_id: - * description: The id of the reason of this return + * description: The ID of the reason of this return. * type: string - * note_id: - * description: The id of the note + * note: + * description: The note to add to the item being swapped. * type: string * return_shipping_option: * type: string - * description: The id of the Shipping Option to create the Shipping Method from. + * description: The ID of the Shipping Option to create the Shipping Method from. * additional_items: * description: "The items to exchange the returned items to." * type: array @@ -66,15 +67,11 @@ import { EntityManager } from "typeorm" * - quantity * properties: * variant_id: - * description: The id of the Product Variant to send. + * description: The ID of the Product Variant to send. * type: string * quantity: * description: The quantity to send of the variant. * type: integer - * required: - * - order_id - * - return_items - * - additional_items * tags: * - Swap * responses: diff --git a/packages/medusa/src/api/routes/store/variants/get-variant.ts b/packages/medusa/src/api/routes/store/variants/get-variant.ts index 2c3442dc75..da5634678f 100644 --- a/packages/medusa/src/api/routes/store/variants/get-variant.ts +++ b/packages/medusa/src/api/routes/store/variants/get-variant.ts @@ -1,11 +1,12 @@ -import { defaultStoreVariantRelations } from "." import { CartService, - RegionService, - ProductVariantService, PricingService, + ProductVariantService, + RegionService, } from "../../../../services" + import { PriceSelectionParams } from "../../../../types/price-selection" +import { defaultStoreVariantRelations } from "." import { validator } from "../../../../utils/validator" /** @@ -15,6 +16,18 @@ import { validator } from "../../../../utils/validator" * description: "Retrieves a Product Variant by id" * parameters: * - (path) variant_id=* {string} The id of the Product Variant. + * - (query) cart_id {string} The id of the Cart to set prices based on. + * - (query) region_id {string} The id of the Region to set prices based on. + * - in: query + * name: currency_code + * style: form + * explode: false + * description: The 3 character ISO currency code to set prices based on. + * schema: + * type: string + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * tags: * - Product Variant * responses: diff --git a/packages/medusa/src/api/routes/store/variants/list-variants.ts b/packages/medusa/src/api/routes/store/variants/list-variants.ts index f57eb240b7..75bfdff6c8 100644 --- a/packages/medusa/src/api/routes/store/variants/list-variants.ts +++ b/packages/medusa/src/api/routes/store/variants/list-variants.ts @@ -1,18 +1,19 @@ -import { Type } from "class-transformer" -import { omit } from "lodash" -import { IsInt, IsOptional, IsString } from "class-validator" -import { defaultStoreVariantRelations } from "." -import { FilterableProductVariantProps } from "../../../../types/product-variant" import { CartService, - RegionService, - ProductVariantService, PricingService, + ProductVariantService, + RegionService, } from "../../../../services" -import { validator } from "../../../../utils/validator" +import { IsInt, IsOptional, IsString } from "class-validator" + +import { FilterableProductVariantProps } from "../../../../types/product-variant" import { IsType } from "../../../../utils/validators/is-type" import { NumericalComparisonOperator } from "../../../../types/common" import { PriceSelectionParams } from "../../../../types/price-selection" +import { Type } from "class-transformer" +import { defaultStoreVariantRelations } from "." +import { omit } from "lodash" +import { validator } from "../../../../utils/validator" /** * @oas [get] /variants @@ -22,8 +23,43 @@ import { PriceSelectionParams } from "../../../../types/price-selection" * parameters: * - (query) ids {string} A comma separated list of Product Variant ids to filter by. * - (query) expand {string} A comma separated list of Product Variant relations to load. - * - (query) offset {number} - * - (query) limit {number} Maximum number of Product Variants to return. + * - (query) offset=0 {number} How many product variants to skip in the result. + * - (query) limit=100 {number} Maximum number of Product Variants to return. + * - in: query + * name: title + * style: form + * explode: false + * description: product variant title to search for. + * schema: + * oneOf: + * - type: string + * description: a single title to search by + * - type: array + * description: multiple titles to search by + * items: + * type: string + * - in: query + * name: inventory_quantity + * description: Filter by available inventory quantity + * schema: + * oneOf: + * - type: number + * description: a specific number to search by. + * - type: object + * description: search using less and greater than comparisons. + * properties: + * lt: + * type: number + * description: filter by inventory quantity less than this number + * gt: + * type: number + * description: filter by inventory quantity greater than this number + * lte: + * type: number + * description: filter by inventory quantity less than or equal to this number + * gte: + * type: number + * description: filter by inventory quantity greater than or equal to this number * tags: * - Product Variant * responses: diff --git a/packages/medusa/src/models/address.ts b/packages/medusa/src/models/address.ts index 7edc6dd86b..d0883fea6d 100644 --- a/packages/medusa/src/models/address.ts +++ b/packages/medusa/src/models/address.ts @@ -6,24 +6,80 @@ * properties: * id: * type: string + * description: ID of the address + * example: addr_01G8ZC9VS1XVE149MGH2J7QSSH * customer_id: * type: string + * description: ID of the customer this address belongs to + * example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + * customer: + * description: Available if the relation `customer` is expanded. + * type: array + * items: + * type: object + * description: A customer object. * company: * type: string + * description: Company name + * example: Acme * first_name: * type: string + * description: First name + * example: Arno * last_name: * type: string + * description: Last name + * example: Willms * address_1: * type: string + * description: Address line 1 + * example: 14433 Kemmer Court * address_2: * type: string + * description: Address line 2 + * example: Suite 369 * city: * type: string + * description: City + * example: South Geoffreyview * country_code: * type: string + * description: The 2 character ISO code of the country in lower case + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * description: See a list of codes. + * example: st * country: - * $ref: "#/components/schemas/country" + * description: A country object. Available if the relation `country` is expanded. + * type: object + * province: + * type: string + * description: Province + * example: Kentucky + * postal_code: + * type: string + * description: Postal Code + * example: 72093 + * phone: + * type: string + * description: Phone Number + * example: 16128234334802 + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ import { @@ -35,10 +91,10 @@ import { ManyToOne, } from "typeorm" -import { Customer } from "./customer" import { Country } from "./country" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" +import { Customer } from "./customer" import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() diff --git a/packages/medusa/src/models/batch-job.ts b/packages/medusa/src/models/batch-job.ts index ec5781d7a7..b7f7509600 100644 --- a/packages/medusa/src/models/batch-job.ts +++ b/packages/medusa/src/models/batch-job.ts @@ -12,9 +12,10 @@ import { BatchJobStatus, } from "../types/batch-job" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { generateEntityId } from "../utils/generate-entity-id" import { User } from "./user" +import { generateEntityId } from "../utils/generate-entity-id" @Entity() export class BatchJob extends SoftDeletableEntity { @@ -106,65 +107,138 @@ export class BatchJob extends SoftDeletableEntity { * title: "Batch Job" * description: "A Batch Job." * x-resourceId: batch_job + * required: + * - type * properties: * id: + * type: string * description: "The unique identifier for the batch job." - * type: string + * example: batch_01G8T782965PYFG0751G0Z38B4 * type: + * type: string * description: "The type of batch job." - * type: string * enum: - * - product_import - * - product_export + * - product-import + * - product-export * status: - * description: "The status of the batch job." * type: string + * description: "The status of the batch job." * enum: * - created * - pre_processed + * - confirmed * - processing * - completed * - canceled * - failed + * default: created * created_by: - * description: "The unique identifier of the user that created the batch job." * type: string - * context: - * description: "The context of the batch job, the type of the batch job determines what the context should contain." + * description: "The unique identifier of the user that created the batch job." + * example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + * created_by_user: + * description: A user object. Available if the relation `created_by_user` is expanded. * type: object + * context: + * type: object + * description: "The context of the batch job, the type of the batch job determines what the context should contain." + * example: + * shape: + * prices: + * - region: null + * currency_code: "eur" + * dynamicImageColumnCount: 4 + * dynamicOptionColumnCount: 2 + * list_config: + * skip: 0 + * take: 50 + * order: + * created_at: "DESC" + * relations: + * - variants + * - variant.prices + * - images * dry_run: - * description: "Specify if the job must apply the modifications or not." * type: boolean + * description: "Specify if the job must apply the modifications or not." * default: false * result: - * description: "The result of the batch job." * type: object + * description: "The result of the batch job." + * properties: + * count: + * type: number + * advancement_count: + * type: number + * progress: + * type: number + * errors: + * type: object + * properties: + * message: + * type: string + * code: + * oneOf: + * - type: string + * - type: number + * err: + * type: array + * stat_descriptors: + * type: object + * properties: + * key: + * type: string + * name: + * type: string + * message: + * type: string + * file_key: + * type: string + * file_size: + * type: number + * example: + * errors: + * - err: [] + * code: "unknown" + * message: "Method not implemented." + * stat_descriptors: + * - key: "product-export-count" + * name: "Product count to export" + * message: "There will be 8 products exported by this action" * pre_processed_at: - * description: "The date from which the job has been pre processed." * type: string + * description: "The date from which the job has been pre processed." + * format: date-time + * processing_at: + * type: string + * description: "The date the job is processing at." * format: date-time * confirmed_at: - * description: "The date when the confirmation has been done." * type: string + * description: "The date when the confirmation has been done." * format: date-time * completed_at: - * description: "The date of the completion." * type: string + * description: "The date of the completion." * format: date-time * canceled_at: - * description: "The date of the concellation." * type: string + * description: "The date of the concellation." + * format: date-time + * failed_at: + * type: string + * description: "The date when the job failed." * format: date-time * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was last updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time */ diff --git a/packages/medusa/src/models/cart.ts b/packages/medusa/src/models/cart.ts index 26cab6cc0e..cd4727a998 100644 --- a/packages/medusa/src/models/cart.ts +++ b/packages/medusa/src/models/cart.ts @@ -6,80 +6,166 @@ * properties: * id: * type: string + * description: The cart's ID + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 * email: * type: string + * description: The email associated with the cart + * format: email * billing_address_id: * type: string + * description: The billing address's ID + * example: addr_01G8ZH853YPY9B94857DY91YGW * billing_address: + * description: Available if the relation `billing_address` is expanded. * $ref: "#/components/schemas/address" * shipping_address_id: * type: string + * description: The shipping address's ID + * example: addr_01G8ZH853YPY9B94857DY91YGW * shipping_address: + * description: Available if the relation `shipping_address` is expanded. * $ref: "#/components/schemas/address" * items: + * description: Available if the relation `items` is expanded. * type: array * items: * $ref: "#/components/schemas/line_item" * region_id: * type: string + * description: The region's ID + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * region: - * $ref: "#/components/schemas/region" + * description: A region object. Available if the relation `region` is expanded. + * type: object * discounts: * type: array + * description: Available if the relation `discounts` is expanded. * items: - * $ref: "#/components/schemas/region" + * type: object + * description: A discount object. * gift_cards: * type: array + * description: Available if the relation `gift_cards` is expanded. * items: - * $ref: "#/components/schemas/gift_card" + * type: object + * description: A gift card object. * customer_id: * type: string + * description: The customer's ID + * example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * customer: - * $ref: "#/components/schemas/customer" + * description: A customer object. Available if the relation `customer` is expanded. + * type: object * payment_session: + * description: The selected payment session in the cart. * $ref: "#/components/schemas/payment_session" * payment_sessions: * type: array + * description: The payment sessions created on the cart. * items: * $ref: "#/components/schemas/payment_session" + * payment_id: + * type: string + * description: The payment's ID if available + * example: pay_01G8ZCC5W42ZNY842124G7P5R9 * payment: + * description: Available if the relation `payment` is expanded. * $ref: "#/components/schemas/payment" * shipping_methods: * type: array + * description: The shipping methods added to the cart. * items: * $ref: "#/components/schemas/shipping_method" * type: * type: string + * description: The cart's type. * enum: * - default * - swap + * - draft_order * - payment_link + * - claim + * default: default * completed_at: * type: string + * description: "The date with timezone at which the cart was completed." * format: date-time + * payment_authorized_at: + * type: string + * description: "The date with timezone at which the payment was authorized." + * format: date-time + * idempotency_key: + * type: string + * description: Randomly generated key used to continue the completion of a cart in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * context: + * type: object + * description: "The context of the cart which can include info like IP or user agent." + * example: + * ip: "::1" + * user_agent: "PostmanRuntime/7.29.2" + * sales_channel_id: + * type: string + * description: The sales channel ID the cart is associated with. + * example: null + * sales_channel: + * description: A sales channel object. Available if the relation `sales_channel` is expanded. + * type: object * created_at: * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} * shipping_total: * type: integer + * description: The total of shipping + * example: 1000 * discount_total: * type: integer + * description: The total of discount + * example: 800 * tax_total: * type: integer + * description: The total of tax + * example: 0 + * refunded_total: + * type: integer + * description: The total amount refunded if the order associated with this cart is returned. + * example: 0 + * total: + * type: integer + * description: The total amount of the cart + * example: 8200 * subtotal: * type: integer + * description: The subtotal of the cart + * example: 8000 * refundable_amount: * type: integer + * description: The amount that can be refunded + * example: 8200 * gift_card_total: * type: integer + * description: The total of gift cards + * example: 0 + * gift_card_tax_total: + * type: integer + * description: The total of gift cards with taxes + * example: 0 */ import { @@ -96,6 +182,11 @@ import { OneToOne, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" +import { + FeatureFlagColumn, + FeatureFlagDecorators, +} from "../utils/feature-flag-decorators" + import { Address } from "./address" import { Customer } from "./customer" import { Discount } from "./discount" @@ -104,14 +195,10 @@ import { LineItem } from "./line-item" import { Payment } from "./payment" import { PaymentSession } from "./payment-session" import { Region } from "./region" +import { SalesChannel } from "./sales-channel" import { ShippingMethod } from "./shipping-method" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" -import { - FeatureFlagColumn, - FeatureFlagDecorators, -} from "../utils/feature-flag-decorators" -import { SalesChannel } from "./sales-channel" export enum CartType { DEFAULT = "default", diff --git a/packages/medusa/src/models/claim-image.ts b/packages/medusa/src/models/claim-image.ts index a75bb167d5..e599dc5469 100644 --- a/packages/medusa/src/models/claim-image.ts +++ b/packages/medusa/src/models/claim-image.ts @@ -6,9 +6,10 @@ import { JoinColumn, ManyToOne, } from "typeorm" + import { ClaimItem } from "./claim-item" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -38,22 +39,38 @@ export class ClaimImage extends SoftDeletableEntity { * title: "Claim Image" * description: "Represents photo documentation of a claim." * x-resourceId: claim_image + * required: + * - claim_item_id + * - url * properties: * id: * type: string + * description: The claim image's ID + * example: cimg_01G8ZH853Y6TFXWPG5EYE81X63 * claim_item_id: * type: string + * description: The ID of the claim item associated with the image + * claim_item: + * description: A claim item object. Available if the relation `claim_item` is expanded. + * type: object * url: * type: string + * description: The URL of the image + * format: uri * created_at: * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/claim-item.ts b/packages/medusa/src/models/claim-item.ts index f4aba4ff5e..cfa25b0ac6 100644 --- a/packages/medusa/src/models/claim-item.ts +++ b/packages/medusa/src/models/claim-item.ts @@ -9,12 +9,12 @@ import { ManyToOne, OneToMany, } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { LineItem } from "./line-item" import { ClaimImage } from "./claim-image" -import { ClaimTag } from "./claim-tag" import { ClaimOrder } from "./claim-order" +import { ClaimTag } from "./claim-tag" +import { DbAwareColumn } from "../utils/db-aware-column" +import { LineItem } from "./line-item" import { ProductVariant } from "./product-variant" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -94,25 +94,42 @@ export class ClaimItem extends SoftDeletableEntity { * title: "Claim Item" * description: "Represents a claimed item along with information about the reasons for the claim." * x-resourceId: claim_item + * required: + * - claim_order_id + * - item_id + * - variant_id + * - reason + * - quantity * properties: * id: * type: string + * description: The claim item's ID + * example: citm_01G8ZH853Y6TFXWPG5EYE81X63 * images: * type: array + * description: Available if the relation `images` is expanded. * items: * $ref: "#/components/schemas/claim_image" * claim_order_id: + * description: The ID of the claim this item is associated with. * type: string + * claim_order: + * description: A claim order object. Available if the relation `claim_order` is expanded. + * type: object * item_id: + * description: The ID of the line item that the claim item refers to. * type: string + * example: item_01G8ZM25TN49YV9EQBE2NC27KC * item: - * description: "The Line Item that the claim refers to" + * description: Available if the relation `item` is expanded. * $ref: "#/components/schemas/line_item" * variant_id: + * description: "The ID of the product variant that is claimed." * type: string + * example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 * variant: - * description: "The Product Variant that is claimed." - * $ref: "#/components/schemas/product_variant" + * description: A variant object. Available if the relation `variant` is expanded. + * type: object * reason: * description: "The reason for the claim" * type: string @@ -124,23 +141,30 @@ export class ClaimItem extends SoftDeletableEntity { * note: * description: "An optional note about the claim, for additional information" * type: string + * example: "I don't like it." * quantity: * description: "The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order." * type: integer + * example: 1 * tags: - * description: "User defined tags for easy filtering and grouping." + * description: "User defined tags for easy filtering and grouping. Available if the relation 'tags' is expanded." * type: array * items: * $ref: "#/components/schemas/claim_tag" * created_at: * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/claim-order.ts b/packages/medusa/src/models/claim-order.ts index b64190d091..f079abead4 100644 --- a/packages/medusa/src/models/claim-order.ts +++ b/packages/medusa/src/models/claim-order.ts @@ -13,13 +13,13 @@ import { } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" +import { Address } from "./address" +import { ClaimItem } from "./claim-item" import { Fulfillment } from "./fulfillment" import { LineItem } from "./line-item" -import { ClaimItem } from "./claim-item" import { Order } from "./order" import { Return } from "./return" import { ShippingMethod } from "./shipping-method" -import { Address } from "./address" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -135,9 +135,14 @@ export class ClaimOrder extends SoftDeletableEntity { * title: "Claim Order" * description: "Claim Orders represent a group of faulty or missing items. Each claim order consists of a subset of items associated with an original order, and can contain additional information about fulfillments and returns." * x-resourceId: claim_order + * required: + * - type + * - order_id * properties: * id: * type: string + * description: The claim's ID + * example: claim_01G8ZH853Y6TFXWPG5EYE81X63 * type: * type: string * enum: @@ -145,10 +150,12 @@ export class ClaimOrder extends SoftDeletableEntity { * - replace * payment_status: * type: string + * description: The status of the claim's payment * enum: * - na * - not_refunded * - refunded + * default: na * fulfillment_status: * type: string * enum: @@ -161,6 +168,7 @@ export class ClaimOrder extends SoftDeletableEntity { * - returned * - canceled * - requires_action + * default: not_fulfilled * claim_items: * description: "The items that have been claimed" * type: array @@ -172,16 +180,21 @@ export class ClaimOrder extends SoftDeletableEntity { * items: * $ref: "#/components/schemas/line_item" * order_id: - * description: "The id of the order that the claim comes from." + * description: "The ID of the order that the claim comes from." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * return_order: - * description: "Holds information about the return if the claim is to be returned" - * $ref: "#/components/schemas/return" + * description: "A return object. Holds information about the return if the claim is to be returned. Available if the relation 'return_order' is expanded" + * type: object * shipping_address_id: - * description: "The id of the address that the new items should be shipped to" + * description: "The ID of the address that the new items should be shipped to" * type: string + * example: addr_01G8ZH853YPY9B94857DY91YGW * shipping_address: - * description: "The address that the new items should be shipped to" + * description: Available if the relation `shipping_address` is expanded. * $ref: "#/components/schemas/address" * shipping_methods: * description: "The shipping methods that the claim order will be shipped with." @@ -196,22 +209,35 @@ export class ClaimOrder extends SoftDeletableEntity { * refund_amount: * description: "The amount that will be refunded in conjunction with the claim" * type: integer + * example: 1000 * canceled_at: - * description: "The date with timezone at which the Swap was canceled." + * description: "The date with timezone at which the claim was canceled." * type: string * format: date-time * created_at: * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} * no_notification: * description: "Flag for describing whether or not notifications related to this should be send." * type: boolean - * metadata: - * type: object + * example: false + * idempotency_key: + * type: string + * description: Randomly generated key used to continue the completion of the cart associated with the claim in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. */ diff --git a/packages/medusa/src/models/claim-tag.ts b/packages/medusa/src/models/claim-tag.ts index 356776a2fe..df905fa954 100644 --- a/packages/medusa/src/models/claim-tag.ts +++ b/packages/medusa/src/models/claim-tag.ts @@ -1,6 +1,7 @@ import { BeforeInsert, Column, Entity, Index } from "typeorm" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" + import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -23,26 +24,31 @@ export class ClaimTag extends SoftDeletableEntity { * title: "Claim Tag" * description: "Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping." * x-resourceId: claim_tag + * required: + * - value * properties: * id: - * description: "The id of the claim tag. Will be prefixed by `ctag_`." * type: string + * description: The claim tag's ID + * example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4 * value: * description: "The value that the claim tag holds" * type: string + * example: Damaged * created_at: + * type: string * description: "The date with timezone at which the resource was created." - * type: string * format: date-time - * update_at: - * description: "The date with timezone at which the resource was last updated." + * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/country.ts b/packages/medusa/src/models/country.ts index 8f71104bac..3ab7d59c02 100644 --- a/packages/medusa/src/models/country.ts +++ b/packages/medusa/src/models/country.ts @@ -6,6 +6,7 @@ import { ManyToOne, PrimaryGeneratedColumn, } from "typeorm" + import { Region } from "./region" @Entity() @@ -43,23 +44,51 @@ export class Country { * title: "Country" * description: "Country details" * x-resourceId: country + * required: + * - iso_2 + * - iso_3 + * - num_code + * - name + * - display_name * properties: - * id: - * description: "The database id of the country" - * type: integer - * iso_2: - * description: "The 2 character ISO code for the country." - * type: string - * iso_3: - * description: "The 3 character ISO code for the country." - * type: string - * num_code: - * description: "The numerical ISO code for the country." - * type: string - * name: - * description: "The normalized country name; in upper case." - * type: string - * display_name: - * description: "The country name appropriate for display." - * type: string + * id: + * type: string + * description: The country's ID + * example: 109 + * iso_2: + * type: string + * description: The 2 character ISO code of the country in lower case + * example: it + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements + * description: See a list of codes. + * iso_3: + * type: string + * description: The 2 character ISO code of the country in lower case + * example: ita + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements + * description: See a list of codes. + * num_code: + * description: "The numerical ISO code for the country." + * type: string + * example: 380 + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements + * description: See a list of codes. + * name: + * description: "The normalized country name in upper case." + * type: string + * example: ITALY + * display_name: + * description: "The country name appropriate for display." + * type: string + * example: Italy + * region_id: + * type: string + * description: The region ID this country is associated with. + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + * region: + * description: A region object. Available if the relation `region` is expanded. + * type: object */ diff --git a/packages/medusa/src/models/currency.ts b/packages/medusa/src/models/currency.ts index 1bcfad6228..66add3bd5d 100644 --- a/packages/medusa/src/models/currency.ts +++ b/packages/medusa/src/models/currency.ts @@ -20,17 +20,29 @@ export class Currency { * title: "Currency" * description: "Currency" * x-resourceId: currency + * required: + * - code + * - symbol + * - symbol_native + * - name * properties: * code: * description: "The 3 character ISO code for the currency." * type: string + * example: usd + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. * symbol: * description: "The symbol used to indicate the currency." * type: string + * example: $ * symbol_native: * description: "The native symbol used to indicate the currency." * type: string + * example: $ * name: * description: "The written name of the currency" * type: string + * example: US Dollar */ diff --git a/packages/medusa/src/models/custom-shipping-option.ts b/packages/medusa/src/models/custom-shipping-option.ts index cd8859ed60..eba1bf6432 100644 --- a/packages/medusa/src/models/custom-shipping-option.ts +++ b/packages/medusa/src/models/custom-shipping-option.ts @@ -7,10 +7,11 @@ import { ManyToOne, Unique, } from "typeorm" + import { Cart } from "./cart" +import { DbAwareColumn } from "../utils/db-aware-column" import { ShippingOption } from "./shipping-option" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -49,34 +50,46 @@ export class CustomShippingOption extends SoftDeletableEntity { * title: "Custom Shipping Option" * description: "Custom Shipping Options are 'overriden' Shipping Options. Store managers can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option" * x-resourceId: custom_shipping_option + * required: + * - price + * - shipping_option_id * properties: * id: - * description: "The id of the Custom Shipping Option. This value will be prefixed with `cso_`." * type: string + * description: The custom shipping option's ID + * example: cso_01G8X99XNB77DMFBJFWX6DN9V9 * price: * description: "The custom price set that will override the shipping option's original price" * type: integer + * example: 1000 * shipping_option_id: - * description: "The id of the Shipping Option that the custom shipping option overrides" - * anyOf: - * - $ref: "#/components/schemas/shipping_option" - * cart_id: - * description: "The id of the Cart that the custom shipping option is attached to" - * anyOf: - * - $ref: "#/components/schemas/cart" - * created_at: - * description: "The date with timezone at which the resource was created." + * description: "The ID of the Shipping Option that the custom shipping option overrides" * type: string + * example: so_01G1G5V27GYX4QXNARRQCW1N8T + * shipping_option: + * description: A shipping option object. Available if the relation `shipping_option` is expanded. + * type: object + * cart_id: + * description: "The ID of the Cart that the custom shipping option is attached to" + * type: string + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/customer-group.ts b/packages/medusa/src/models/customer-group.ts index 6318c72b92..1a6f8b0f18 100644 --- a/packages/medusa/src/models/customer-group.ts +++ b/packages/medusa/src/models/customer-group.ts @@ -1,8 +1,9 @@ import { BeforeInsert, Column, Entity, Index, ManyToMany } from "typeorm" + import { Customer } from "./customer" +import { DbAwareColumn } from "../utils/db-aware-column" import { PriceList } from "./price-list" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -29,3 +30,48 @@ export class CustomerGroup extends SoftDeletableEntity { this.id = generateEntityId(this.id, "cgrp") } } +/** + * @schema customer_group + * title: "Customer Group" + * description: "Represents a customer group" + * x-resourceId: customer_group + * required: + * - name + * properties: + * id: + * type: string + * description: The customer group's ID + * example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 + * name: + * type: string + * description: The name of the customer group + * example: VIP + * customers: + * type: array + * description: The customers that belong to the customer group. Available if the relation `customers` is expanded. + * items: + * type: object + * description: A customer object. + * price_lists: + * type: array + * description: The price lists that are associated with the customer group. Available if the relation `price_lists` is expanded. + * items: + * $ref: "#/components/schemas/price_list" + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} + */ + diff --git a/packages/medusa/src/models/customer.ts b/packages/medusa/src/models/customer.ts index 042939fae1..7346d96015 100644 --- a/packages/medusa/src/models/customer.ts +++ b/packages/medusa/src/models/customer.ts @@ -12,9 +12,9 @@ import { import { Address } from "./address" import { CustomerGroup } from "./customer-group" +import { DbAwareColumn } from "../utils/db-aware-column" import { Order } from "./order" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -82,38 +82,70 @@ export class Customer extends SoftDeletableEntity { * title: "Customer" * description: "Represents a customer" * x-resourceId: customer + * required: + * - email * properties: * id: * type: string + * description: The customer's ID + * example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * email: * type: string + * description: The customer's email + * format: email + * first_name: + * type: string + * description: The customer's first name + * example: Arno + * last_name: + * type: string + * description: The customer's first name + * example: Willms * billing_address_id: * type: string + * description: The customer's billing address ID + * example: addr_01G8ZH853YPY9B94857DY91YGW * billing_address: - * description: "The Customer's billing address." - * anyOf: - * - $ref: "#/components/schemas/address" + * description: Available if the relation `billing_address` is expanded. + * $ref: "#/components/schemas/address" * shipping_addresses: + * description: Available if the relation `shipping_addresses` is expanded. * type: array * items: * $ref: "#/components/schemas/address" - * first_name: - * type: string - * last_name: - * type: string * phone: * type: string + * description: The customer's phone number + * example: 16128234334802 * has_account: * type: boolean + * description: Whether the customer has an account or not + * default: false + * orders: + * description: Available if the relation `orders` is expanded. + * type: array + * items: + * type: object + * description: An order object. + * groups: + * description: The customer groups the customer belongs to. Available if the relation `groups` is expanded. + * type: array + * items: + * $ref: "#/components/schemas/customer_group" * created_at: * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-condition-customer-group.ts b/packages/medusa/src/models/discount-condition-customer-group.ts index b648ea01bd..c1a704b4fe 100644 --- a/packages/medusa/src/models/discount-condition-customer-group.ts +++ b/packages/medusa/src/models/discount-condition-customer-group.ts @@ -7,6 +7,7 @@ import { UpdateDateColumn, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { CustomerGroup } from "./customer-group" import { DiscountCondition } from "./discount-condition" @@ -41,26 +42,34 @@ export class DiscountConditionCustomerGroup { * title: "Product Tag Discount Condition" * description: "Associates a discount condition with a customer group" * x-resourceId: discount_condition_customer_group + * required: + * - customer_group_id + * - condition_id * properties: * customer_group_id: - * description: "The id of the Product Tag" + * description: "The ID of the Product Tag" * type: string + * example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63 * condition_id: - * description: "The id of the Discount Condition" + * description: "The ID of the Discount Condition" * type: string + * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + * customer_group: + * description: Available if the relation `customer_group` is expanded. + * $ref: "#/components/schemas/customer_group" + * discount_condition: + * description: Available if the relation `discount_condition` is expanded. + * $ref: "#/components/schemas/discount_condition" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-condition-product-collection.ts b/packages/medusa/src/models/discount-condition-product-collection.ts index 4391ff1d19..7f0555e0d5 100644 --- a/packages/medusa/src/models/discount-condition-product-collection.ts +++ b/packages/medusa/src/models/discount-condition-product-collection.ts @@ -7,6 +7,7 @@ import { UpdateDateColumn, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { DiscountCondition } from "./discount-condition" import { ProductCollection } from "./product-collection" @@ -41,26 +42,34 @@ export class DiscountConditionProductCollection { * title: "Product Collection Discount Condition" * description: "Associates a discount condition with a product collection" * x-resourceId: discount_condition_product_collection + * required: + * - product_collection_id + * - condition_id * properties: * product_collection_id: - * description: "The id of the Product Collection" + * description: "The ID of the Product Collection" * type: string + * example: pcol_01F0YESBFAZ0DV6V831JXWH0BG * condition_id: - * description: "The id of the Discount Condition" + * description: "The ID of the Discount Condition" * type: string + * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + * product_collection: + * description: Available if the relation `product_collection` is expanded. + * $ref: "#/components/schemas/product_collection" + * discount_condition: + * description: Available if the relation `discount_condition` is expanded. + * $ref: "#/components/schemas/discount_condition" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-condition-product-tag.ts b/packages/medusa/src/models/discount-condition-product-tag.ts index ae64f67525..0999497b11 100644 --- a/packages/medusa/src/models/discount-condition-product-tag.ts +++ b/packages/medusa/src/models/discount-condition-product-tag.ts @@ -7,6 +7,7 @@ import { UpdateDateColumn, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { DiscountCondition } from "./discount-condition" import { ProductTag } from "./product-tag" @@ -41,26 +42,34 @@ export class DiscountConditionProductTag { * title: "Product Tag Discount Condition" * description: "Associates a discount condition with a product tag" * x-resourceId: discount_condition_product_tag + * required: + * - product_tag_id + * - condition_id * properties: * product_tag_id: - * description: "The id of the Product Tag" + * description: "The ID of the Product Tag" * type: string + * example: ptag_01F0YESHPZYY3H4SJ3A5918SBN * condition_id: - * description: "The id of the Discount Condition" + * description: "The ID of the Discount Condition" * type: string + * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + * product_tag: + * description: Available if the relation `product_tag` is expanded. + * $ref: "#/components/schemas/product_tag" + * discount_condition: + * description: Available if the relation `discount_condition` is expanded. + * $ref: "#/components/schemas/discount_condition" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-condition-product-type.ts b/packages/medusa/src/models/discount-condition-product-type.ts index 1b951fa419..3d418b696f 100644 --- a/packages/medusa/src/models/discount-condition-product-type.ts +++ b/packages/medusa/src/models/discount-condition-product-type.ts @@ -7,6 +7,7 @@ import { UpdateDateColumn, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { DiscountCondition } from "./discount-condition" import { ProductType } from "./product-type" @@ -41,26 +42,34 @@ export class DiscountConditionProductType { * title: "Product Type Discount Condition" * description: "Associates a discount condition with a product type" * x-resourceId: discount_condition_product + * required: + * - product_type_id + * - condition_id * properties: * product_type_id: - * description: "The id of the Product Type" + * description: "The ID of the Product Tag" * type: string + * example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A * condition_id: - * description: "The id of the Discount Condition" + * description: "The ID of the Discount Condition" * type: string + * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + * product_type: + * description: Available if the relation `product_type` is expanded. + * $ref: "#/components/schemas/product_type" + * discount_condition: + * description: Available if the relation `discount_condition` is expanded. + * $ref: "#/components/schemas/discount_condition" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-condition-product.ts b/packages/medusa/src/models/discount-condition-product.ts index 5d66f55d8c..66621dbe3c 100644 --- a/packages/medusa/src/models/discount-condition-product.ts +++ b/packages/medusa/src/models/discount-condition-product.ts @@ -7,6 +7,7 @@ import { UpdateDateColumn, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { DiscountCondition } from "./discount-condition" import { Product } from "./product" @@ -41,26 +42,34 @@ export class DiscountConditionProduct { * title: "Product Discount Condition" * description: "Associates a discount condition with a product" * x-resourceId: discount_condition_product + * required: + * - product_id + * - condition_id * properties: * product_id: - * description: "The id of the Product" + * description: "The ID of the Product Tag" * type: string + * example: prod_01G1G5V2MBA328390B5AXJ610F * condition_id: - * description: "The id of the Discount Condition" + * description: "The ID of the Discount Condition" * type: string + * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A + * product: + * description: Available if the relation `product` is expanded. + * $ref: "#/components/schemas/product" + * discount_condition: + * description: Available if the relation `discount_condition` is expanded. + * $ref: "#/components/schemas/discount_condition" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-condition.ts b/packages/medusa/src/models/discount-condition.ts index ef8e8da815..67e9ac2c4a 100644 --- a/packages/medusa/src/models/discount-condition.ts +++ b/packages/medusa/src/models/discount-condition.ts @@ -9,8 +9,9 @@ import { ManyToOne, Unique, } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" + import { CustomerGroup } from "./customer-group" +import { DbAwareColumn } from "../utils/db-aware-column" import { DiscountRule } from "./discount-rule" import { Product } from "./product" import { ProductCollection } from "./product-collection" @@ -139,10 +140,15 @@ export class DiscountCondition extends SoftDeletableEntity { * title: "Discount Condition" * description: "Holds rule conditions for when a discount is applicable" * x-resourceId: discount_condition + * required: + * - type + * - operator + * - discount_rule_id * properties: * id: - * description: "The id of the Discount Condition. Will be prefixed by `discon_`." * type: string + * description: The discount condition's ID + * example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A * type: * description: "The type of the Condition" * type: string @@ -152,19 +158,63 @@ export class DiscountCondition extends SoftDeletableEntity { * - product_collections * - product_tags * - customer_groups + * operator: + * description: "The operator of the Condition" + * type: string + * enum: + * - in + * - not_in + * discount_rule_id: + * type: string + * description: The ID of the discount rule associated with the condition + * example: dru_01F0YESMVK96HVX7N419E3CJ7C + * discount_rule: + * description: Available if the relation `discount_rule` is expanded. + * $ref: "#/components/schemas/discount_rule" + * products: + * description: products associated with this condition if type = products. Available if the relation `products` is expanded. + * type: array + * items: + * type: object + * description: A product object. + * product_types: + * description: product types associated with this condition if type = product_types. Available if the relation `product_types` is expanded. + * type: array + * items: + * type: object + * description: A product type object. + * product_tags: + * description: product tags associated with this condition if type = product_tags. Available if the relation `product_tags` is expanded. + * type: array + * items: + * type: object + * description: A product tag object. + * product_collections: + * description: product collections associated with this condition if type = product_collections. Available if the relation `product_collections` is expanded. + * type: array + * items: + * type: object + * description: A product collection object. + * customer_groups: + * description: customer groups associated with this condition if type = customer_groups. Available if the relation `customer_groups` is expanded. + * type: array + * items: + * type: object + * description: A customer group object. * created_at: + * type: string * description: "The date with timezone at which the resource was created." - * type: string * format: date-time - * update_at: - * description: "The date with timezone at which the resource was last updated." + * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount-rule.ts b/packages/medusa/src/models/discount-rule.ts index bed3b48ca6..ddc16ba13f 100644 --- a/packages/medusa/src/models/discount-rule.ts +++ b/packages/medusa/src/models/discount-rule.ts @@ -1,4 +1,5 @@ import { BeforeInsert, Column, Entity, OneToMany } from "typeorm" + import { DbAwareColumn } from "../utils/db-aware-column" import { DiscountCondition } from "./discount-condition" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" @@ -53,10 +54,14 @@ export class DiscountRule extends SoftDeletableEntity { * title: "Discount Rule" * description: "Holds the rules that governs how a Discount is calculated when applied to a Cart." * x-resourceId: discount_rule + * required: + * - type + * - value * properties: * id: - * description: "The id of the Discount Rule. Will be prefixed by `dru_`." * type: string + * description: The discount rule's ID + * example: dru_01F0YESMVK96HVX7N419E3CJ7C * type: * description: "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers." * type: string @@ -64,36 +69,42 @@ export class DiscountRule extends SoftDeletableEntity { * - fixed * - percentage * - free_shipping + * example: percentage * description: * description: "A short description of the discount" * type: string + * example: 10 Percent * value: * description: "The value that the discount represents; this will depend on the type of the discount" * type: integer + * example: 10 * allocation: * description: "The scope that the discount should apply to." * type: string * enum: * - total * - item + * example: total * conditions: - * description: "A set of conditions that can be used to limit when the discount can be used" + * description: A set of conditions that can be used to limit when the discount can be used. Available if the relation `conditions` is expanded. * type: array * items: - * $ref: "#/components/schemas/discount_condition" + * type: object + * description: A discount condition object. * created_at: + * type: string * description: "The date with timezone at which the resource was created." - * type: string * format: date-time - * update_at: - * description: "The date with timezone at which the resource was last updated." + * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/discount.ts b/packages/medusa/src/models/discount.ts index 0220b40618..4cbeaec97c 100644 --- a/packages/medusa/src/models/discount.ts +++ b/packages/medusa/src/models/discount.ts @@ -9,6 +9,7 @@ import { ManyToOne, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { DiscountRule } from "./discount-rule" import { Region } from "./region" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" @@ -90,26 +91,40 @@ export class Discount extends SoftDeletableEntity { * title: "Discount" * description: "Represents a discount that can be applied to a cart for promotional purposes." * x-resourceId: discount + * required: + * - code + * - is_dynamic * properties: * id: - * description: "The id of the Discount. Will be prefixed by `disc_`." * type: string + * description: The discount's ID + * example: disc_01F0YESMW10MGHWJKZSDDMN0VN * code: * description: "A unique code for the discount - this will be used by the customer to apply the discount" * type: string + * example: 10DISC * is_dynamic: * description: "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts" * type: boolean - * rule: + * example: false + * rule_id: + * type: string * description: "The Discount Rule that governs the behaviour of the Discount" - * anyOf: - * - $ref: "#/components/schemas/discount_rule" + * example: dru_01F0YESMVK96HVX7N419E3CJ7C + * rule: + * description: Available if the relation `rule` is expanded. + * $ref: "#/components/schemas/discount_rule" * is_disabled: * description: "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts" * type: boolean + * example: false * parent_discount_id: - * description: "The Discount that the discount was created from. This will always be a dynamic discount" * type: string + * description: "The Discount that the discount was created from. This will always be a dynamic discount" + * example: disc_01G8ZH853YPY9B94857DY91YGW + * parent_discount: + * description: Available if the relation `parent_discount` is expanded. + * $ref: "#/components/schemas/discount" * starts_at: * description: "The time at which the discount can be used." * type: string @@ -118,30 +133,39 @@ export class Discount extends SoftDeletableEntity { * description: "The time at which the discount can no longer be used." * type: string * format: date-time + * valid_duration: + * type: string + * description: Duration the discount runs between + * example: P3Y6M4DT12H30M5S * regions: - * description: "The Regions in which the Discount can be used" + * description: The Regions in which the Discount can be used. Available if the relation `regions` is expanded. * type: array * items: - * $ref: "#/components/schemas/region" + * type: object + * description: A region object. * usage_limit: * description: "The maximum number of times that a discount can be used." * type: integer + * example: 100 * usage_count: * description: "The number of times a discount has been used." * type: integer + * example: 50 + * default: 0 * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/draft-order.ts b/packages/medusa/src/models/draft-order.ts index 54c44f42b9..d933c0211a 100644 --- a/packages/medusa/src/models/draft-order.ts +++ b/packages/medusa/src/models/draft-order.ts @@ -7,16 +7,17 @@ import { JoinColumn, OneToOne, } from "typeorm" -import { BaseEntity } from "../interfaces/models/base-entity" import { DbAwareColumn, resolveDbGenerationStrategy, resolveDbType, } from "../utils/db-aware-column" -import { manualAutoIncrement } from "../utils/manual-auto-increment" + +import { BaseEntity } from "../interfaces/models/base-entity" import { Cart } from "./cart" import { Order } from "./order" import { generateEntityId } from "../utils/generate-entity-id" +import { manualAutoIncrement } from "../utils/manual-auto-increment" export enum DraftOrderStatus { OPEN = "open", @@ -86,42 +87,65 @@ export class DraftOrder extends BaseEntity { * properties: * id: * type: string + * description: The draft order's ID + * example: dorder_01G8TJFKBG38YYFQ035MSVG03C * status: * type: string + * description: The status of the draft order * enum: * - open * - completed + * default: open * display_id: * type: string + * description: The draft order's display ID + * example: 2 * cart_id: * type: string + * description: "The ID of the cart associated with the draft order." + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 * cart: - * anyOf: - * - $ref: "#/components/schemas/cart" + * description: A cart object. Available if the relation `cart` is expanded. + * type: object * order_id: * type: string + * description: "The ID of the order associated with the draft order." + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * order: - * anyOf: - * - $ref: "#/components/schemas/order" + * description: An order object. Available if the relation `order` is expanded. + * type: object * canceled_at: * type: string - * format: date-time - * created_at: - * type: string - * format: date-time - * update_at: - * type: string - * format: date-time - * deleted_at: - * type: string + * description: The date the draft order was canceled at. * format: date-time * completed_at: * type: string + * description: The date the draft order was completed at. * format: date-time * no_notification_order: * type: boolean - * metadata: - * type: object + * description: Whether to send the customer notifications regarding order updates. + * example: false * idempotency_key: * type: string + * description: Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/fulfillment-item.ts b/packages/medusa/src/models/fulfillment-item.ts index e3dd3c2da7..f91952aa62 100644 --- a/packages/medusa/src/models/fulfillment-item.ts +++ b/packages/medusa/src/models/fulfillment-item.ts @@ -28,18 +28,27 @@ export class FulfillmentItem { * title: "Fulfillment Item" * description: "Correlates a Line Item with a Fulfillment, keeping track of the quantity of the Line Item." * x-resourceId: fulfillment_item + * required: + * - fulfillment_id + * - item_id + * - quantity * properties: * fulfillment_id: * description: "The id of the Fulfillment that the Fulfillment Item belongs to." * type: string + * example: ful_01G8ZRTMQCA76TXNAT81KPJZRF * item_id: * description: "The id of the Line Item that the Fulfillment Item references." * type: string + * example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + * fulfillment: + * description: A fulfillment object. Available if the relation `fulfillment` is expanded. + * type: object * item: - * description: "The Line Item that the Fulfillment Item references." - * anyOf: - * - $ref: "#/components/schemas/line_item" + * description: Available if the relation `item` is expanded. + * $ref: "#/components/schemas/line_item" * quantity: * description: "The quantity of the Line Item that is included in the Fulfillment." * type: integer + * example: 1 */ diff --git a/packages/medusa/src/models/fulfillment-provider.ts b/packages/medusa/src/models/fulfillment-provider.ts index daa09ce087..e4420a1402 100644 --- a/packages/medusa/src/models/fulfillment-provider.ts +++ b/packages/medusa/src/models/fulfillment-provider.ts @@ -18,7 +18,9 @@ export class FulfillmentProvider { * id: * description: "The id of the fulfillment provider as given by the plugin." * type: string + * example: manual * is_installed: * description: "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`." * type: boolean + * example: true */ diff --git a/packages/medusa/src/models/fulfillment.ts b/packages/medusa/src/models/fulfillment.ts index f1057fee9d..5a983319ad 100644 --- a/packages/medusa/src/models/fulfillment.ts +++ b/packages/medusa/src/models/fulfillment.ts @@ -9,13 +9,13 @@ import { } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" -import { Order } from "./order" -import { FulfillmentProvider } from "./fulfillment-provider" -import { FulfillmentItem } from "./fulfillment-item" -import { Swap } from "./swap" -import { ClaimOrder } from "./claim-order" -import { TrackingLink } from "./tracking-link" import { BaseEntity } from "../interfaces/models/base-entity" +import { ClaimOrder } from "./claim-order" +import { FulfillmentItem } from "./fulfillment-item" +import { FulfillmentProvider } from "./fulfillment-provider" +import { Order } from "./order" +import { Swap } from "./swap" +import { TrackingLink } from "./tracking-link" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -95,38 +95,61 @@ export class Fulfillment extends BaseEntity { * title: "Fulfillment" * description: "Fulfillments are created once store operators can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a provider, which is typically an external shipping aggregator, shipping partner og 3PL, most plugins will have asynchronous communications with these providers through webhooks in order to automatically update and synchronize the state of Fulfillments." * x-resourceId: fulfillment + * required: + * - provider_id * properties: * id: - * description: "The id of the Fulfillment. This value will be prefixed by `ful_`." * type: string + * description: The cart's ID + * example: ful_01G8ZRTMQCA76TXNAT81KPJZRF * claim_order_id: * description: "The id of the Claim that the Fulfillment belongs to." * type: string + * example: null + * claim_order: + * description: A claim order object. Available if the relation `claim_order` is expanded. + * type: object * swap_id: * description: "The id of the Swap that the Fulfillment belongs to." * type: string + * example: null + * swap: + * description: A swap object. Available if the relation `swap` is expanded. + * type: object * order_id: * description: "The id of the Order that the Fulfillment belongs to." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * provider_id: * description: "The id of the Fulfillment Provider responsible for handling the fulfillment" * type: string + * example: manual + * provider: + * description: Available if the relation `provider` is expanded. + * $ref: "#/components/schemas/fulfillment_provider" * items: - * description: "The Fulfillment Items in the Fulfillment - these hold information about how many of each Line Item has been fulfilled." + * description: The Fulfillment Items in the Fulfillment - these hold information about how many of each Line Item has been fulfilled. Available if the relation `items` is expanded. * type: array * items: * $ref: "#/components/schemas/fulfillment_item" * tracking_links: - * description: "The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment Provider." + * description: The Tracking Links that can be used to track the status of the Fulfillment, these will usually be provided by the Fulfillment Provider. Available if the relation `tracking_links` is expanded. * type: array * items: * $ref: "#/components/schemas/tracking_link" * tracking_numbers: * deprecated: true - * description: "The tracking numbers that can be used to track the status of the fulfillment." + * description: The tracking numbers that can be used to track the status of the fulfillment. * type: array * items: * type: string + * data: + * description: This contains all the data necessary for the Fulfillment provider to handle the fulfillment. + * type: object + * example: {} * shipped_at: * description: "The date with timezone at which the Fulfillment was shipped." * type: string @@ -134,19 +157,31 @@ export class Fulfillment extends BaseEntity { * no_notification: * description: "Flag for describing whether or not notifications related to this should be send." * type: boolean + * example: false * canceled_at: * description: "The date with timezone at which the Fulfillment was canceled." * type: string * format: date-time - * created_at: - * description: "The date with timezone at which the resource was created." + * idempotency_key: * type: string + * description: Randomly generated key used to continue the completion of the fulfillment in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/gift-card-transaction.ts b/packages/medusa/src/models/gift-card-transaction.ts index 5f0d0871b6..6de6ea20fa 100644 --- a/packages/medusa/src/models/gift-card-transaction.ts +++ b/packages/medusa/src/models/gift-card-transaction.ts @@ -9,11 +9,11 @@ import { PrimaryColumn, Unique, } from "typeorm" -import { resolveDbType } from "../utils/db-aware-column" import { GiftCard } from "./gift-card" import { Order } from "./order" import { generateEntityId } from "../utils/generate-entity-id" +import { resolveDbType } from "../utils/db-aware-column" @Unique("gcuniq", ["gift_card_id", "order_id"]) @Entity() @@ -59,25 +59,42 @@ export class GiftCardTransaction { * title: "Gift Card Transaction" * description: "Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order" * x-resourceId: gift_card_transaction + * required: + * - gift_card_id + * - amount * properties: * id: - * description: "The id of the Gift Card Transaction. This value will be prefixed by `gct_`." * type: string + * description: The gift card transaction's ID + * example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A * gift_card_id: - * description: "The id of the Gift Card that was used in the transaction." + * description: "The ID of the Gift Card that was used in the transaction." * type: string + * example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ * gift_card: - * description: "The Gift Card that was used in the transaction." - * anyOf: - * - $ref: "#/components/schemas/gift_card" + * description: A gift card object. Available if the relation `gift_card` is expanded. + * type: object * order_id: - * description: "The id of the Order that the Gift Card was used to pay for." + * description: "The ID of the Order that the Gift Card was used to pay for." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * amount: * description: "The amount that was used from the Gift Card." * type: integer + * example: 10 * created_at: * description: "The date with timezone at which the resource was created." * type: string * format: date-time + * is_taxable: + * description: "Whether the transaction is taxable or not." + * type: boolean + * example: false + * tax_rate: + * description: "The tax rate of the transaction" + * type: number + * example: 0 */ diff --git a/packages/medusa/src/models/gift-card.ts b/packages/medusa/src/models/gift-card.ts index 5598accafe..10d12426c6 100644 --- a/packages/medusa/src/models/gift-card.ts +++ b/packages/medusa/src/models/gift-card.ts @@ -8,8 +8,8 @@ import { } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" -import { Region } from "./region" import { Order } from "./order" +import { Region } from "./region" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -64,49 +64,64 @@ export class GiftCard extends SoftDeletableEntity { * title: "Gift Card" * description: "Gift Cards are redeemable and represent a value that can be used towards the payment of an Order." * x-resourceId: gift_card + * required: + * - code + * - value + * - balance + * - region_id * properties: * id: - * description: "The id of the Gift Card. This value will be prefixed by `gift_`." * type: string + * description: The cart's ID + * example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ * code: * description: "The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card." * type: string + * example: 3RFT-MH2C-Y4YZ-XMN4 * value: * description: "The value that the Gift Card represents." * type: integer + * example: 10 * balance: * description: "The remaining value on the Gift Card." * type: integer + * example: 10 * region_id: + * type: string * description: "The id of the Region in which the Gift Card is available." - * type: string + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * region: - * description: "The Region in which the Gift Card is available." - * anyOf: - * - $ref: "#/components/schemas/region" + * description: A region object. Available if the relation `region` is expanded. + * type: object * order_id: - * description: "The id of the Order that the Gift Card was purchased in." * type: string + * description: "The id of the Order that the Gift Card was purchased in." + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * is_disabled: * description: "Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts." * type: boolean + * example: false * ends_at: * description: "The time at which the Gift Card can no longer be used." * type: string * format: date-time * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/idempotency-key.ts b/packages/medusa/src/models/idempotency-key.ts index 3a188e6434..c41160abea 100644 --- a/packages/medusa/src/models/idempotency-key.ts +++ b/packages/medusa/src/models/idempotency-key.ts @@ -7,6 +7,7 @@ import { PrimaryColumn, } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" + import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -47,3 +48,57 @@ export class IdempotencyKey { this.id = generateEntityId(this.id, "ikey") } } + +/** + * @schema idempotency_key + * title: "Idempotency Key" + * description: "Idempotency Key is used to continue a process in case of any failure that might occur." + * x-resourceId: idempotency_key + * required: + * - idempotency_key + * properties: + * id: + * type: string + * description: The idempotency key's ID + * example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A + * idempotency_key: + * description: "The unique randomly generated key used to determine the state of a process." + * type: string + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * created_at: + * description: Date which the idempotency key was locked. + * type: string + * format: date-time + * locked_at: + * description: Date which the idempotency key was locked. + * type: string + * format: date-time + * request_method: + * description: "The method of the request" + * type: string + * example: POST + * request_params: + * type: object + * description: "The parameters passed to the request" + * example: + * id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * request_path: + * description: "The request's path" + * type: string + * example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete + * response_code: + * type: string + * description: "The response's code." + * example: 200 + * response_body: + * type: object + * description: "The response's body" + * example: + * id: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * recovery_point: + * type: string + * description: "Where to continue from." + * default: started + */ \ No newline at end of file diff --git a/packages/medusa/src/models/image.ts b/packages/medusa/src/models/image.ts index 99181445fc..5523012535 100644 --- a/packages/medusa/src/models/image.ts +++ b/packages/medusa/src/models/image.ts @@ -1,6 +1,7 @@ import { BeforeInsert, Column, Entity } from "typeorm" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" + import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -22,26 +23,31 @@ export class Image extends SoftDeletableEntity { * title: "Image" * description: "Images holds a reference to a URL at which the image file can be found." * x-resourceId: image + * required: + * - url * properties: * id: - * description: "The id of the Image. This value will be prefixed by `img_`." * type: string + * description: The image's ID + * example: img_01G749BFYR6T8JTVW6SGW3K3E6 * url: * description: "The URL at which the image file can be found." * type: string + * format: uri * created_at: + * type: string * description: "The date with timezone at which the resource was created." - * type: string * format: date-time - * update_at: - * description: "The date with timezone at which the resource was last updated." + * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/invite.ts b/packages/medusa/src/models/invite.ts index fd612b146b..6c1f0cbb05 100644 --- a/packages/medusa/src/models/invite.ts +++ b/packages/medusa/src/models/invite.ts @@ -1,7 +1,8 @@ import { BeforeInsert, Column, CreateDateColumn, Entity, Index } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" -import { UserRoles } from "./user" + import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" +import { UserRoles } from "./user" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -35,3 +36,57 @@ export class Invite extends SoftDeletableEntity { this.id = generateEntityId(this.id, "invite") } } + +/** + * @schema invite + * title: "Invite" + * description: "Represents an invite" + * x-resourceId: invite + * required: + * - user_email + * properties: + * id: + * type: string + * description: The invite's ID + * example: invite_01G8TKE4XYCTHSCK2GDEP47RE1 + * user_email: + * type: string + * description: The email of the user being invited. + * format: email + * role: + * type: string + * description: The user's role. + * enum: + * - admin + * - member + * - developer + * default: member + * accepted: + * type: boolean + * description: Whether the invite was accepted or not. + * example: false + * token: + * type: string + * description: The token used to accept the invite. + * expores_at: + * type: string + * description: The date the invite expires at. + * format: date-time + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} + */ + diff --git a/packages/medusa/src/models/line-item-adjustment.ts b/packages/medusa/src/models/line-item-adjustment.ts index c57d71a132..6f9f666faa 100644 --- a/packages/medusa/src/models/line-item-adjustment.ts +++ b/packages/medusa/src/models/line-item-adjustment.ts @@ -1,12 +1,13 @@ import { - Entity, BeforeInsert, - Index, Column, - ManyToOne, + Entity, + Index, JoinColumn, + ManyToOne, PrimaryColumn, } from "typeorm" + import { DbAwareColumn } from "../utils/db-aware-column" import { Discount } from "./discount" import { LineItem } from "./line-item" @@ -51,3 +52,45 @@ export class LineItemAdjustment { this.id = generateEntityId(this.id, "lia") } } + +/** + * @schema line_item_adjustment + * title: "Line Item Adjustment" + * description: "Represents an Line Item Adjustment" + * x-resourceId: line_item_adjustment + * required: + * - item_id + * - description + * - amount + * properties: + * id: + * type: string + * description: The invite's ID + * example: lia_01G8TKE4XYCTHSCK2GDEP47RE1 + * item_id: + * type: string + * description: The ID of the line item + * example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + * item: + * description: Available if the relation `item` is expanded. + * $ref: "#/components/schemas/line_item" + * description: + * type: string + * description: The line item's adjustment description + * example: Adjusted item's price. + * discount_id: + * type: string + * description: The ID of the discount associated with the adjustment + * example: disc_01F0YESMW10MGHWJKZSDDMN0VN + * discount: + * description: Available if the relation `discount` is expanded. + * $ref: "#/components/schemas/discount" + * amount: + * type: number + * description: The adjustment amount + * example: 1000 + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} + */ diff --git a/packages/medusa/src/models/line-item-tax-line.ts b/packages/medusa/src/models/line-item-tax-line.ts index 9203b21d39..69b588ddef 100644 --- a/packages/medusa/src/models/line-item-tax-line.ts +++ b/packages/medusa/src/models/line-item-tax-line.ts @@ -8,8 +8,8 @@ import { Unique, } from "typeorm" -import { TaxLine } from "./tax-line" import { LineItem } from "./line-item" +import { TaxLine } from "./tax-line" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -28,3 +28,50 @@ export class LineItemTaxLine extends TaxLine { this.id = generateEntityId(this.id, "litl") } } + +/** + * @schema line_item_tax_line + * title: "Line Item Tax Line" + * description: "Represents an Line Item Tax Line" + * x-resourceId: line_item_tax_line + * required: + * - item_id + * - rate + * - name + * properties: + * id: + * type: string + * description: The line item tax line's ID + * example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + * item_id: + * type: string + * description: The ID of the line item + * example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN + * item: + * description: Available if the relation `item` is expanded. + * $ref: "#/components/schemas/line_item" + * code: + * description: "A code to identify the tax type by" + * type: string + * example: tax01 + * name: + * description: "A human friendly name for the tax" + * type: string + * example: Tax Example + * rate: + * description: "The numeric rate to charge tax by" + * type: number + * example: 10 + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} + */ diff --git a/packages/medusa/src/models/line-item.ts b/packages/medusa/src/models/line-item.ts index 2f92981cec..4d94ee7471 100644 --- a/packages/medusa/src/models/line-item.ts +++ b/packages/medusa/src/models/line-item.ts @@ -8,16 +8,16 @@ import { ManyToOne, OneToMany, } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { LineItemTaxLine } from "./line-item-tax-line" -import { Swap } from "./swap" -import { Cart } from "./cart" -import { Order } from "./order" -import { ClaimOrder } from "./claim-order" -import { ProductVariant } from "./product-variant" -import { LineItemAdjustment } from "./line-item-adjustment" import { BaseEntity } from "../interfaces/models/base-entity" +import { Cart } from "./cart" +import { ClaimOrder } from "./claim-order" +import { DbAwareColumn } from "../utils/db-aware-column" +import { LineItemAdjustment } from "./line-item-adjustment" +import { LineItemTaxLine } from "./line-item-tax-line" +import { Order } from "./order" +import { ProductVariant } from "./product-variant" +import { Swap } from "./swap" import { generateEntityId } from "../utils/generate-entity-id" @Check(`"fulfilled_quantity" <= "quantity"`) @@ -136,74 +136,155 @@ export class LineItem extends BaseEntity { * title: "Line Item" * description: "Line Items represent purchasable units that can be added to a Cart for checkout. When Line Items are purchased they will get copied to the resulting order and can eventually be referenced in Fulfillments and Returns. Line Items may also be created when processing Swaps and Claims." * x-resourceId: line_item + * required: + * - title + * - unit_price + * - quantity * properties: * id: - * description: "The id of the Line Item. This value will be prefixed by `item_`." * type: string + * description: The cart's ID + * example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN * cart_id: - * description: "The id of the Cart that the Line Item belongs to." + * description: "The ID of the Cart that the Line Item belongs to." * type: string + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object * order_id: - * description: "The id of the Order that the Line Item belongs to." + * description: "The ID of the Order that the Line Item belongs to." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * swap_id: * description: "The id of the Swap that the Line Item belongs to." * type: string + * example: null + * swap: + * description: A swap object. Available if the relation `swap` is expanded. + * type: object * claim_order_id: * description: "The id of the Claim that the Line Item belongs to." * type: string + * example: null + * claim_order: + * description: A claim order object. Available if the relation `claim_order` is expanded. + * type: object + * tax_lines: + * description: Available if the relation `tax_lines` is expanded. + * type: array + * items: + * $ref: "#/components/schemas/line_item_tax_line" + * adjustments: + * description: Available if the relation `adjustments` is expanded. + * type: array + * items: + * $ref: "#/components/schemas/line_item_adjustment" * title: * description: "The title of the Line Item, this should be easily identifiable by the Customer." * type: string + * example: Medusa Coffee Mug * description: * description: "A more detailed description of the contents of the Line Item." * type: string + * example: One Size * thumbnail: * description: "A URL string to a small image of the contents of the Line Item." * type: string + * format: uri + * example: https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png + * is_return: + * description: "Is the item being returned" + * type: boolean + * example: false * is_giftcard: * description: "Flag to indicate if the Line Item is a Gift Card." * type: boolean + * example: false * should_merge: * description: "Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item." * type: boolean + * example: false * allow_discounts: * description: "Flag to indicate if the Line Item should be included when doing discount calculations." * type: boolean + * example: false + * has_shipping: + * description: "Flag to indicate if the Line Item has fulfillment associated with it." + * type: boolean + * example: false * unit_price: * description: "The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to." * type: boolean + * example: 8000 * variant_id: * description: "The id of the Product Variant contained in the Line Item." * type: string + * example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 * variant: - * description: "The Product Variant contained in the Line Item." - * anyOf: - * - $ref: "#/components/schemas/product_variant" + * description: A product variant object. The Product Variant contained in the Line Item. Available if the relation `variant` is expanded. + * type: object * quantity: * description: "The quantity of the content in the Line Item." * type: integer + * example: 1 * fulfilled_quantity: * description: "The quantity of the Line Item that has been fulfilled." * type: integer + * example: 0 * returned_quantity: * description: "The quantity of the Line Item that has been returned." * type: integer + * example: 0 * shipped_quantity: * description: "The quantity of the Line Item that has been shipped." * type: integer - * created_at: - * description: "The date with timezone at which the resource was created." - * type: string - * format: date-time - * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * metadata: - * description: "An optional key-value map with additional information." - * type: object + * example: 0 * refundable: * description: "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration." * type: integer + * example: 0 + * subtotal: + * type: integer + * description: The subtotal of the line item + * example: 8000 + * tax_total: + * type: integer + * description: The total of tax of the line item + * example: 0 + * total: + * type: integer + * description: The total amount of the line item + * example: 8000 + * original_total: + * type: integer + * description: The original total amount of the line item + * example: 8000 + * original_tax_total: + * type: integer + * description: The original tax total amount of the line item + * example: 0 + * discount_total: + * type: integer + * description: The total of discount of the line item + * example: 0 + * gift_card_total: + * type: integer + * description: The total of the gift card of the line item + * example: 0 + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/money-amount.ts b/packages/medusa/src/models/money-amount.ts index 7d724bfc3a..646ec92328 100644 --- a/packages/medusa/src/models/money-amount.ts +++ b/packages/medusa/src/models/money-amount.ts @@ -6,6 +6,7 @@ import { JoinColumn, ManyToOne, } from "typeorm" + import { Currency } from "./currency" import { PriceList } from "./price-list" import { ProductVariant } from "./product-variant" @@ -70,42 +71,71 @@ export class MoneyAmount extends SoftDeletableEntity { * title: "Money Amount" * description: "Money Amounts represents an amount that a given Product Variant can be purcased for. Each Money Amount either has a Currency or Region associated with it to indicate the pricing in a given Currency or, for fully region-based pricing, the given price in a specific Region. If region-based pricing is used the amount will be in the currency defined for the Reigon." * x-resourceId: money_amount + * required: + * - currency_code + * - amount * properties: * id: - * description: "The id of the Money Amount. This value will be prefixed by `ma_`." * type: string + * description: The money amount's ID + * example: ma_01F0YESHRFQNH5S8Q0PK84YYZN * currency_code: * description: "The 3 character currency code that the Money Amount is given in." * type: string + * example: usd + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * currency: + * description: Available if the relation `currency` is expanded. + * $ref: "#/components/schemas/currency" * amount: * description: "The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost." * type: integer + * example: 100 * min_quantity: * description: "The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities." * type: integer + * example: 1 * max_quantity: * description: "The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities." * type: integer + * example: 1 + * price_list_id: + * type: string + * description: The ID of the price list associated with the money amount + * example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + * price_list: + * description: Available if the relation `price_list` is expanded. + * $ref: "#/components/schemas/price_list" * variant_id: - * description: "The id of the Product Variant that the Money Amount belongs to." + * description: "The id of the Product Variant contained in the Line Item." * type: string + * example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + * variant: + * description: The Product Variant contained in the Line Item. Available if the relation `variant` is expanded. + * type: object * region_id: - * description: "The id of the Region that the Money Amount is defined for." * type: string + * description: The region's ID + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * region: - * description: "The Region that the Money Amount is defined for." - * anyOf: - * - $ref: "#/components/schemas/region" + * description: A region object. Available if the relation `region` is expanded. + * type: object * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/note.ts b/packages/medusa/src/models/note.ts index dba0fca4e9..7fe459aaca 100644 --- a/packages/medusa/src/models/note.ts +++ b/packages/medusa/src/models/note.ts @@ -6,9 +6,10 @@ import { JoinColumn, ManyToOne, } from "typeorm" -import { User } from "./user" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" + import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" +import { User } from "./user" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -45,36 +46,48 @@ export class Note extends SoftDeletableEntity { * title: "Note" * description: "Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these." * x-resourceId: note + * required: + * - value + * - resource_type + * - resource_id * properties: * id: - * description: "The id of the Note. This value will be prefixed by `note_`." * type: string + * description: The note's ID + * example: note_01G8TM8ENBMC7R90XRR1G6H26Q * resource_type: * description: "The type of resource that the Note refers to." * type: string + * example: order * resource_id: - * description: "The id of the resource that the Note refers to." + * description: "The ID of the resource that the Note refers to." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * value: * description: "The contents of the note." * type: string - * author: - * description: "The author of the note." - * anyOf: - * - $ref: "#/components/schemas/user" - * created_at: - * description: "The date with timezone at which the resource was created." + * example: This order must be fulfilled on Monday + * author_id: * type: string + * description: The ID of the author (user) + * example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V + * author: + * description: Available if the relation `author` is expanded. + * $ref: "#/components/schemas/user" + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/notification-provider.ts b/packages/medusa/src/models/notification-provider.ts index eb0dd58da5..fe35201082 100644 --- a/packages/medusa/src/models/notification-provider.ts +++ b/packages/medusa/src/models/notification-provider.ts @@ -14,11 +14,15 @@ export class NotificationProvider { * title: "Notification Provider" * description: "Represents a notification provider plugin and holds its installation status." * x-resourceId: notification_provider + * required: + * - id * properties: * id: * description: "The id of the notification provider as given by the plugin." * type: string + * example: sendgrid * is_installed: * description: "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`." * type: boolean + * default: true */ diff --git a/packages/medusa/src/models/notification.ts b/packages/medusa/src/models/notification.ts index 550925756c..2bc26339b5 100644 --- a/packages/medusa/src/models/notification.ts +++ b/packages/medusa/src/models/notification.ts @@ -7,10 +7,10 @@ import { ManyToOne, OneToMany, } from "typeorm" -import { BaseEntity } from "../interfaces/models/base-entity" -import { DbAwareColumn } from "../utils/db-aware-column" +import { BaseEntity } from "../interfaces/models/base-entity" import { Customer } from "./customer" +import { DbAwareColumn } from "../utils/db-aware-column" import { NotificationProvider } from "./notification-provider" import { generateEntityId } from "../utils/generate-entity-id" @@ -69,35 +69,42 @@ export class Notification extends BaseEntity { * title: "Notification" * description: "Notifications a communications sent via Notification Providers as a reaction to internal events such as `order.placed`. Notifications can be used to show a chronological timeline for communications sent to a Customer regarding an Order, and enables resends." * x-resourceId: notification + * required: + * - resource_type + * - resource_id + * - to * properties: * id: - * description: "The id of the Notification. This value will be prefixed by `noti_`." * type: string + * description: The notification's ID + * example: noti_01G53V9Y6CKMCGBM1P0X7C28RX * event_name: * description: "The name of the event that the notification was sent for." * type: string + * example: order.placed * resource_type: * description: "The type of resource that the Notification refers to." * type: string + * example: order * resource_id: - * description: "The id of the resource that the Notification refers to." + * description: "The ID of the resource that the Notification refers to." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * customer_id: - * description: "The id of the Customer that the Notification was sent to." + * description: "The ID of the Customer that the Notification was sent to." * type: string + * example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * customer: - * description: "The Customer that the Notification was sent to." - * anyOf: - * - $ref: "#/components/schemas/customer" + * description: A customer object. Available if the relation `customer` is expanded. + * type: object * to: * description: "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" * type: string + * example: "user@example.com" * data: * description: "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend." * type: object - * parent_id: - * description: "The id of the Notification that was originally sent." - * type: string + * example: {} * resends: * description: "The resends that have been completed after the original Notification." * type: array @@ -106,13 +113,17 @@ export class Notification extends BaseEntity { * provider_id: * description: "The id of the Notification Provider that handles the Notification." * type: string + * example: sengrid + * provider: + * description: Available if the relation `provider` is expanded. + * $ref: "#/components/schemas/notification_provider" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time */ @@ -123,35 +134,56 @@ export class Notification extends BaseEntity { * x-resourceId: notification_resend * properties: * id: - * description: "The id of the Notification. This value will be prefixed by `noti_`." + * description: The notification resend's ID * type: string + * example: noti_01F0YET45G9NHP08Z66CE4QKBS * event_name: * description: "The name of the event that the notification was sent for." * type: string + * example: order.placed * resource_type: * description: "The type of resource that the Notification refers to." * type: string + * example: order * resource_id: - * description: "The id of the resource that the Notification refers to." + * description: "The ID of the resource that the Notification refers to." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * customer_id: + * description: "The ID of the Customer that the Notification was sent to." + * type: string + * example: cus_01G2SG30J8C85S4A5CHM2S1NS2 + * customer: + * description: A customer object. Available if the relation `customer` is expanded. + * type: object * to: * description: "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" * type: string + * example: "user@example.com" * data: * description: "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend." * type: object + * example: {} * parent_id: - * description: "The id of the Notification that was originally sent." + * description: "The ID of the Notification that was originally sent." * type: string + * example: noti_01G53V9Y6CKMCGBM1P0X7C28RX + * parent_notification: + * description: Available if the relation `parent_notification` is expanded. + * $ref: "#/components/schemas/notification" * provider_id: - * description: "The id of the Notification Provider that handles the Notification." + * description: "The ID of the Notification Provider that handles the Notification." * type: string + * example: sengrid + * provider: + * description: Available if the relation `provider` is expanded. + * $ref: "#/components/schemas/notification_provider" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time */ diff --git a/packages/medusa/src/models/oauth.ts b/packages/medusa/src/models/oauth.ts index fc74730643..e0cae3beff 100644 --- a/packages/medusa/src/models/oauth.ts +++ b/packages/medusa/src/models/oauth.ts @@ -1,4 +1,5 @@ import { BeforeInsert, Column, Entity, Index, PrimaryColumn } from "typeorm" + import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @@ -28,3 +29,39 @@ export class Oauth { this.id = generateEntityId(this.id, "oauth") } } + +/** + * @schema OAuth + * title: "OAuth" + * description: "Represent an OAuth app" + * x-resourceId: OAuth + * required: + * - id + * - display_name + * - application_name + * properties: + * id: + * type: string + * description: The app's ID + * example: example_app + * display_name: + * type: string + * description: The app's display name + * example: Example app + * application_name: + * type: string + * description: The app's name + * example: example + * install_url: + * type: string + * description: The URL to install the app + * format: uri + * uninstall_url: + * type: string + * description: The URL to uninstall the app + * format: uri + * data: + * type: object + * description: Any data necessary to the app. + * example: {} + */ diff --git a/packages/medusa/src/models/order.ts b/packages/medusa/src/models/order.ts index 43abfeb176..39c17a2a39 100644 --- a/packages/medusa/src/models/order.ts +++ b/packages/medusa/src/models/order.ts @@ -11,14 +11,18 @@ import { OneToMany, OneToOne, } from "typeorm" -import { BaseEntity } from "../interfaces/models/base-entity" import { DbAwareColumn, resolveDbGenerationStrategy, resolveDbType, } from "../utils/db-aware-column" -import { manualAutoIncrement } from "../utils/manual-auto-increment" +import { + FeatureFlagColumn, + FeatureFlagDecorators, +} from "../utils/feature-flag-decorators" + import { Address } from "./address" +import { BaseEntity } from "../interfaces/models/base-entity" import { Cart } from "./cart" import { ClaimOrder } from "./claim-order" import { Currency } from "./currency" @@ -33,14 +37,11 @@ import { Payment } from "./payment" import { Refund } from "./refund" import { Region } from "./region" import { Return } from "./return" +import { SalesChannel } from "./sales-channel" import { ShippingMethod } from "./shipping-method" import { Swap } from "./swap" import { generateEntityId } from "../utils/generate-entity-id" -import { - FeatureFlagColumn, - FeatureFlagDecorators, -} from "../utils/feature-flag-decorators" -import { SalesChannel } from "./sales-channel" +import { manualAutoIncrement } from "../utils/manual-auto-increment" export enum OrderStatus { PENDING = "pending", @@ -270,19 +271,29 @@ export class Order extends BaseEntity { * title: "Order" * description: "Represents an order" * x-resourceId: order + * required: + * - customer_id + * - email + * - region_id + * - currency_code * properties: * id: * type: string + * description: The order's ID + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * status: * type: string + * description: The order's status * enum: * - pending * - completed * - archived * - canceled * - requires_action + * default: pending * fulfillment_status: * type: string + * description: The order's fulfillment status * enum: * - not_fulfilled * - partially_fulfilled @@ -293,8 +304,10 @@ export class Order extends BaseEntity { * - returned * - canceled * - requires_action + * default: not_fulfilled * payment_status: * type: string + * description: The order's payment status * enum: * - not_paid * - awaiting @@ -303,116 +316,195 @@ export class Order extends BaseEntity { * - refuneded * - canceled * - requires_action + * default: not_paid * display_id: * type: integer + * description: The order's display ID + * example: 2 * cart_id: * type: string - * currency_code: - * type: string - * tax_rate: - * type: number - * discounts: - * type: array - * items: - * $ref: "#/components/schemas/discount" - * email: - * type: string - * billing_address_id: - * type: string - * billing_address: - * anyOf: - * - $ref: "#/components/schemas/address" - * shipping_address_id: - * type: string - * shipping_address: - * anyOf: - * - $ref: "#/components/schemas/address" - * items: - * type: array - * items: - * $ref: "#/components/schemas/line_item" - * region_id: - * type: string - * region: - * anyOf: - * - $ref: "#/components/schemas/region" - * gift_cards: - * type: array - * items: - * $ref: "#/components/schemas/gift_card" + * description: The ID of the cart associated with the order + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object * customer_id: * type: string + * description: The ID of the customer associated with the order + * example: cus_01G2SG30J8C85S4A5CHM2S1NS2 * customer: - * anyOf: - * - $ref: "#/components/schemas/customer" - * payment_session: - * anyOf: - * - $ref: "#/components/schemas/payment_session" - * payment_sessions: + * description: A customer object. Available if the relation `customer` is expanded. + * type: object + * email: + * description: The email associated with the order + * type: string + * format: email + * billing_address_id: + * type: string + * description: The ID of the billing address associated with the order + * example: addr_01G8ZH853YPY9B94857DY91YGW + * billing_address: + * description: Available if the relation `billing_address` is expanded. + * $ref: "#/components/schemas/address" + * shipping_address_id: + * type: string + * description: The ID of the shipping address associated with the order + * example: addr_01G8ZH853YPY9B94857DY91YGW + * shipping_address: + * description: Available if the relation `shipping_address` is expanded. + * $ref: "#/components/schemas/address" + * region_id: + * type: string + * description: The region's ID + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + * region: + * description: A region object. Available if the relation `region` is expanded. + * type: object + * currency_code: + * description: "The 3 character currency code that is used in the order" + * type: string + * example: usd + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * currency: + * description: Available if the relation `currency` is expanded. + * $ref: "#/components/schemas/currency" + * tax_rate: + * description: The order's tax rate + * type: number + * example: 0 + * discounts: * type: array + * description: The discounts used in the order. Available if the relation `discounts` is expanded. * items: - * $ref: "#/components/schemas/payment_session" - * payments: + * type: object + * description: A discount object. + * gift_cards: * type: array + * description: The gift cards used in the order. Available if the relation `gift_cards` is expanded. * items: - * $ref: "#/components/schemas/payment" + * type: object + * description: A gift card object. * shipping_methods: * type: array + * description: The shipping methods used in the order. Available if the relation `shipping_methods` is expanded. * items: * $ref: "#/components/schemas/shipping_method" + * payments: + * type: array + * description: The payments used in the order. Available if the relation `payments` is expanded. + * items: + * $ref: "#/components/schemas/payment" * fulfillments: * type: array + * description: The fulfillments used in the order. Available if the relation `fulfillments` is expanded. * items: * $ref: "#/components/schemas/fulfillment" * returns: * type: array + * description: The returns associated with the order. Available if the relation `returns` is expanded. * items: - * $ref: "#/components/schemas/return" + * type: object + * description: A return object. * claims: * type: array + * description: The claims associated with the order. Available if the relation `claims` is expanded. * items: - * $ref: "#/components/schemas/claim_order" + * type: object + * description: A claim order object. * refunds: * type: array + * description: The refunds associated with the order. Available if the relation `refunds` is expanded. * items: - * $ref: "#/components/schemas/refund" + * type: object + * description: A refund object. * swaps: * type: array + * description: The swaps associated with the order. Available if the relation `swaps` is expanded. * items: - * $ref: "#/components/schemas/refund" + * type: object + * description: A swap object. + * draft_order_id: + * type: string + * description: The ID of the draft order this order is associated with. + * example: null + * draft_order: + * description: A draft order object. Available if the relation `draft_order` is expanded. + * type: object + * items: + * type: array + * description: The line items that belong to the order. Available if the relation `items` is expanded. + * items: + * $ref: "#/components/schemas/line_item" * gift_card_transactions: * type: array + * description: The gift card transactions used in the order. Available if the relation `gift_card_transactions` is expanded. * items: * $ref: "#/components/schemas/gift_card_transaction" * canceled_at: * type: string + * description: The date the order was canceled on. * format: date-time - * created_at: - * type: string - * format: date-time - * update_at: - * type: string - * format: date-time - * deleted_at: - * type: string - * format: date-time - * metadata: - * type: object - * shipping_total: - * type: integer - * discount_total: - * type: integer - * tax_total: - * type: integer - * subtotal: - * type: integer - * refundable_amount: - * type: integer - * gift_card_total: - * type: integer - * paid_total: - * type: integer * no_notification: * description: "Flag for describing whether or not notifications related to this should be send." * type: boolean + * example: false + * idempotency_key: + * type: string + * description: Randomly generated key used to continue the processing of the order in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * external_id: + * description: The ID of an external order. + * type: string + * example: null + * sales_channel_id: + * type: string + * description: The ID of the sales channel this order is associated with. + * example: null + * sales_channel: + * description: A sales channel object. Available if the relation `sales_channel` is expanded. + * type: object + * shipping_total: + * type: integer + * description: The total of shipping + * example: 1000 + * discount_total: + * type: integer + * description: The total of discount + * example: 800 + * tax_total: + * type: integer + * description: The total of tax + * example: 0 + * refunded_total: + * type: integer + * description: The total amount refunded if the order is returned. + * example: 0 + * total: + * type: integer + * description: The total amount of the order + * example: 8200 + * subtotal: + * type: integer + * description: The subtotal of the order + * example: 8000 + * paid_total: + * type: integer + * description: The total amount paid + * example: 8000 + * refundable_amount: + * type: integer + * description: The amount that can be refunded + * example: 8200 + * gift_card_total: + * type: integer + * description: The total of gift cards + * example: 0 + * gift_card_tax_total: + * type: integer + * description: The total of gift cards with taxes + * example: 0 */ diff --git a/packages/medusa/src/models/payment-provider.ts b/packages/medusa/src/models/payment-provider.ts index b94e361f45..d213ef9820 100644 --- a/packages/medusa/src/models/payment-provider.ts +++ b/packages/medusa/src/models/payment-provider.ts @@ -14,11 +14,15 @@ export class PaymentProvider { * title: "Payment Provider" * description: "Represents a Payment Provider plugin and holds its installation status." * x-resourceId: payment_provider + * required: + * - id * properties: * id: * description: "The id of the payment provider as given by the plugin." * type: string + * example: manual * is_installed: * description: "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`." * type: boolean + * default: true */ diff --git a/packages/medusa/src/models/payment-session.ts b/packages/medusa/src/models/payment-session.ts index dbcdbffe35..b458b26892 100644 --- a/packages/medusa/src/models/payment-session.ts +++ b/packages/medusa/src/models/payment-session.ts @@ -7,9 +7,10 @@ import { ManyToOne, Unique, } from "typeorm" + import { BaseEntity } from "../interfaces" -import { DbAwareColumn } from "../utils/db-aware-column" import { Cart } from "./cart" +import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils" export enum PaymentSessionStatus { @@ -58,19 +59,30 @@ export class PaymentSession extends BaseEntity { * title: "Payment Session" * description: "Payment Sessions are created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, who is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for capture/refunds/etc." * x-resourceId: payment_session + * required: + * - cart_id + * - provider_id + * - status * properties: * id: - * description: "The id of the Payment Session. This value will be prefixed with `ps_`." * type: string + * description: The payment session's ID + * example: ps_01G901XNSRM2YS3ASN9H5KG3FZ * cart_id: * description: "The id of the Cart that the Payment Session is created for." * type: string + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object * provider_id: * description: "The id of the Payment Provider that is responsible for the Payment Session" * type: string + * example: manual * is_selected: * description: "A flag to indicate if the Payment Session has been selected as the method that will be used to complete the purchase." * type: boolean + * example: true * status: * description: "Indicates the status of the Payment Session. Will default to `pending`, and will eventually become `authorized`. Payment Sessions may have the status of `requires_more` to indicate that further actions are to be completed by the Customer." * type: string @@ -80,15 +92,23 @@ export class PaymentSession extends BaseEntity { * - requires_more * - error * - canceled + * example: pending * data: * description: "The data required for the Payment Provider to identify, modify and process the Payment Session. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state." * type: object - * created_at: - * description: "The date with timezone at which the resource was created." + * example: {} + * idempotency_key: * type: string + * description: Randomly generated key used to continue the completion of a cart in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time */ diff --git a/packages/medusa/src/models/payment.ts b/packages/medusa/src/models/payment.ts index 7ce67831c6..607e9a0a40 100644 --- a/packages/medusa/src/models/payment.ts +++ b/packages/medusa/src/models/payment.ts @@ -9,11 +9,11 @@ import { } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" -import { Swap } from "./swap" -import { Currency } from "./currency" -import { Cart } from "./cart" -import { Order } from "./order" import { BaseEntity } from "../interfaces/models/base-entity" +import { Cart } from "./cart" +import { Currency } from "./currency" +import { Order } from "./order" +import { Swap } from "./swap" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -85,34 +85,61 @@ export class Payment extends BaseEntity { * title: "Payment" * description: "Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded." * x-resourceId: payment + * required: + * - amount + * - currency_code + * - provider_id * properties: * id: - * description: "The id of the Payment. This value will be prefixed with `pay_`." * type: string + * description: The payment's ID + * example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE * swap_id: - * description: "The id of the Swap that the Payment is used for." - * type: string - * order_id: - * description: "The id of the Order that the Payment is used for." + * description: "The ID of the Swap that the Payment is used for." * type: string + * example: null + * swap: + * description: A swap object. Available if the relation `swap` is expanded. + * type: object * cart_id: * description: "The id of the Cart that the Payment Session is created for." * type: string + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object + * order_id: + * description: "The ID of the Order that the Payment is used for." + * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * amount: * description: "The amount that the Payment has been authorized for." * type: integer + * example: 100 * currency_code: * description: "The 3 character ISO currency code that the Payment is completed in." * type: string + * example: usd + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * currency: + * description: Available if the relation `currency` is expanded. + * $ref: "#/components/schemas/currency" * amount_refunded: * description: "The amount of the original Payment amount that has been refunded back to the Customer." * type: integer + * example: 0 * provider_id: * description: "The id of the Payment Provider that is responsible for the Payment" * type: string + * example: manual * data: * description: "The data required for the Payment Provider to identify, modify and process the Payment. Typically this will be an object that holds an id to the external payment session, but can be an empty object if the Payment Provider doesn't hold any state." * type: object + * example: {} * captured_at: * description: "The date with timezone at which the Payment was captured." * type: string @@ -121,15 +148,22 @@ export class Payment extends BaseEntity { * description: "The date with timezone at which the Payment was canceled." * type: string * format: date-time - * created_at: - * description: "The date with timezone at which the resource was created." + * idempotency_key: * type: string + * description: Randomly generated key used to continue the completion of a payment in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/price-list.ts b/packages/medusa/src/models/price-list.ts index 86daaa5b96..f3dd85f402 100644 --- a/packages/medusa/src/models/price-list.ts +++ b/packages/medusa/src/models/price-list.ts @@ -6,8 +6,9 @@ import { ManyToMany, OneToMany, } from "typeorm" -import { PriceListStatus, PriceListType } from "../types/price-list" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" +import { PriceListStatus, PriceListType } from "../types/price-list" + import { CustomerGroup } from "./customer-group" import { MoneyAmount } from "./money-amount" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" @@ -68,37 +69,65 @@ export class PriceList extends SoftDeletableEntity { * title: "Price List" * description: "Price Lists represents a set of prices that overrides the default price for one or more product variants." * x-resourceId: price_list + * required: + * - name + * - description * properties: * id: - * description: "The id of the Price List. This value will be prefixed by `pl_`." * type: string + * description: The price list's ID + * example: pl_01G8X3CKJXCG5VXVZ87H9KC09W + * name: + * type: string + * description: The price list's name + * example: VIP Prices + * description: + * type: string + * description: The price list's description + * example: Prices for VIP customers * type: * description: "The type of Price List. This can be one of either `sale` or `override`." * type: string * enum: * - sale * - override + * default: sale + * status: + * description: "The status of the Price List" + * type: string + * enum: + * - active + * - draft + * default: draft * starts_at: * description: "The date with timezone that the Price List starts being valid." - * type: date-time + * type: string + * format: date-time * ends_at: * description: "The date with timezone that the Price List stops being valid." - * type: date-time + * type: string + * format: date-time * customer_groups: - * description: "The Customer Groups that the Price List applies to." + * description: The Customer Groups that the Price List applies to. Available if the relation `customer_groups` is expanded. * type: array * items: - * $ref: "#/components/schemas/customer_group" + * type: object + * description: A customer group object. + * prices: + * description: The Money Amounts that are associated with the Price List. Available if the relation `prices` is expanded. + * type: array + * items: + * $ref: "#/components/schemas/money_amount" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time */ diff --git a/packages/medusa/src/models/product-collection.ts b/packages/medusa/src/models/product-collection.ts index e09a58d978..6cd57df78a 100644 --- a/packages/medusa/src/models/product-collection.ts +++ b/packages/medusa/src/models/product-collection.ts @@ -1,9 +1,9 @@ import { BeforeInsert, Column, Entity, Index, OneToMany } from "typeorm" -import _ from "lodash" +import { DbAwareColumn } from "../utils/db-aware-column" import { Product } from "./product" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" +import _ from "lodash" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -37,34 +37,41 @@ export class ProductCollection extends SoftDeletableEntity { * title: "Product Collection" * description: "Product Collections represents a group of Products that are related." * x-resourceId: product_collection + * required: + * - title * properties: * id: - * description: "The id of the Product Collection. This value will be prefixed with `pcol_`." * type: string + * description: The product collection's ID + * example: pcol_01F0YESBFAZ0DV6V831JXWH0BG * title: * description: "The title that the Product Collection is identified by." * type: string + * example: Summer Collection * handle: * description: "A unique string that identifies the Product Collection - can for example be used in slug structures." * type: string + * example: summer-collection * products: - * description: "The Products contained in the Product Collection." + * description: The Products contained in the Product Collection. Available if the relation `products` is expanded. * type: array * items: * type: object + * description: A product collection object. * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-option-value.ts b/packages/medusa/src/models/product-option-value.ts index bcb37106a4..849a9bda95 100644 --- a/packages/medusa/src/models/product-option-value.ts +++ b/packages/medusa/src/models/product-option-value.ts @@ -6,10 +6,11 @@ import { JoinColumn, ManyToOne, } from "typeorm" + +import { DbAwareColumn } from "../utils/db-aware-column" import { ProductOption } from "./product-option" import { ProductVariant } from "./product-variant" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -49,32 +50,47 @@ export class ProductOptionValue extends SoftDeletableEntity { * title: "Product Option Value" * description: "A value given to a Product Variant's option set. Product Variant have a Product Option Value for each of the Product Options defined on the Product." * x-resourceId: product_option_value + * required: + * - value + * - option_id + * - variant_id * properties: * id: - * description: "The id of the Product Option Value. This value will be prefixed with `optval_`." * type: string + * description: The product option value's ID + * example: optval_01F0YESHR7S6ECD03RF6W12DSJ * value: * description: "The value that the Product Variant has defined for the specific Product Option (e.g. if the Product Option is \"Size\" this value could be \"Small\", \"Medium\" or \"Large\")." * type: string + * example: large * option_id: - * description: "The id of the Product Option that the Product Option Value is defined for." + * description: "The ID of the Product Option that the Product Option Value is defined for." * type: string + * example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 + * option: + * description: Available if the relation `option` is expanded. + * $ref: "#/components/schemas/product_option" * variant_id: - * description: "The id of the Product Variant that the Product Option Value is defined for." + * description: "The ID of the Product Variant that the Product Option Value is defined for." * type: string + * example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 + * variant: + * description: Available if the relation `variant` is expanded. + * $ref: "#/components/schemas/product_variant" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-option.ts b/packages/medusa/src/models/product-option.ts index 758d994d98..e81a1da6f8 100644 --- a/packages/medusa/src/models/product-option.ts +++ b/packages/medusa/src/models/product-option.ts @@ -7,10 +7,10 @@ import { OneToMany, } from "typeorm" +import { DbAwareColumn } from "../utils/db-aware-column" import { Product } from "./product" import { ProductOptionValue } from "./product-option-value" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -42,34 +42,44 @@ export class ProductOption extends SoftDeletableEntity { * title: "Product Option" * description: "Product Options define properties that may vary between different variants of a Product. Common Product Options are \"Size\" and \"Color\", but Medusa doesn't limit what Product Options that can be defined." * x-resourceId: product_option + * required: + * - title + * - product_id * properties: * id: - * description: "The id of the Product Option. This value will be prefixed with `opt_`." * type: string + * description: The product option's ID + * example: opt_01F0YESHQBZVKCEXJ24BS6PCX3 * title: * description: "The title that the Product Option is defined by (e.g. \"Size\")." * type: string + * example: Size * values: - * description: "The Product Option Values that are defined for the Product Option." + * description: The Product Option Values that are defined for the Product Option. Available if the relation `values` is expanded. * type: array * items: * $ref: "#/components/schemas/product_option_value" * product_id: - * description: "The id of the Product that the Product Option is defined for." + * description: "The ID of the Product that the Product Option is defined for." * type: string + * example: prod_01G1G5V2MBA328390B5AXJ610F + * product: + * description: A product object. Available if the relation `product` is expanded. + * type: object * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-tag.ts b/packages/medusa/src/models/product-tag.ts index 97d0df52ab..ea2066620f 100644 --- a/packages/medusa/src/models/product-tag.ts +++ b/packages/medusa/src/models/product-tag.ts @@ -1,6 +1,7 @@ import { BeforeInsert, Column, Entity } from "typeorm" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" + import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -22,26 +23,31 @@ export class ProductTag extends SoftDeletableEntity { * title: "Product Tag" * description: "Product Tags can be added to Products for easy filtering and grouping." * x-resourceId: product_tag + * required: + * - value * properties: * id: - * description: "The id of the Product Tag. This value will be prefixed with `ptag_`." * type: string + * description: The product tag's ID + * example: ptag_01G8K2MTMG9168F2B70S1TAVK3 * value: - * description: "The value that the Product Tag represents (e.g. \"Pants\")." + * description: "The value that the Product Tag represents" * type: string + * example: Pants * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-tax-rate.ts b/packages/medusa/src/models/product-tax-rate.ts index ca8357224b..085ffcc8f9 100644 --- a/packages/medusa/src/models/product-tax-rate.ts +++ b/packages/medusa/src/models/product-tax-rate.ts @@ -1,12 +1,12 @@ import { - Entity, CreateDateColumn, - UpdateDateColumn, - ManyToOne, + Entity, JoinColumn, + ManyToOne, PrimaryColumn, + UpdateDateColumn, } from "typeorm" -import { resolveDbType, DbAwareColumn } from "../utils/db-aware-column" +import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" import { Product } from "./product" import { TaxRate } from "./tax-rate" @@ -43,26 +43,34 @@ export class ProductTaxRate { * title: "Product Tax Rate" * description: "Associates a tax rate with a product to indicate that the product is taxed in a certain way" * x-resourceId: product_tax_rate + * required: + * - product_id + * - rate_id * properties: * product_id: - * description: "The id of the Product" + * description: "The ID of the Product" * type: string + * example: prod_01G1G5V2MBA328390B5AXJ610F + * product: + * description: Available if the relation `product` is expanded. + * $ref: "#/components/schemas/product" * rate_id: - * description: "The id of the Tax Rate" + * description: "The ID of the Tax Rate" * type: string + * example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + * tax_rate: + * description: Available if the relation `tax_rate` is expanded. + * $ref: "#/components/schemas/tax_rate" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-type-tax-rate.ts b/packages/medusa/src/models/product-type-tax-rate.ts index d21374c4c8..c99b297452 100644 --- a/packages/medusa/src/models/product-type-tax-rate.ts +++ b/packages/medusa/src/models/product-type-tax-rate.ts @@ -42,26 +42,34 @@ export class ProductTypeTaxRate { * title: "Product Type Tax Rate" * description: "Associates a tax rate with a product type to indicate that the product type is taxed in a certain way" * x-resourceId: product_type_tax_rate + * required: + * - product_type_id + * - rate_id * properties: * product_type_id: - * description: "The id of the Product type" + * description: "The ID of the Product type" * type: string + * example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + * product_type: + * description: Available if the relation `product_type` is expanded. + * $ref: "#/components/schemas/product_type" * rate_id: * description: "The id of the Tax Rate" * type: string + * example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + * tax_rate: + * description: Available if the relation `tax_rate` is expanded. + * $ref: "#/components/schemas/tax_rate" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-type.ts b/packages/medusa/src/models/product-type.ts index 372c59a12f..f8ba32986c 100644 --- a/packages/medusa/src/models/product-type.ts +++ b/packages/medusa/src/models/product-type.ts @@ -1,6 +1,7 @@ import { BeforeInsert, Column, Entity } from "typeorm" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" + import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -22,26 +23,31 @@ export class ProductType extends SoftDeletableEntity { * title: "Product Type" * description: "Product Type can be added to Products for filtering and reporting purposes." * x-resourceId: product_type + * required: + * - value * properties: * id: - * description: "The id of the Product Type. This value will be prefixed with `ptyp_`." * type: string + * description: The product type's ID + * example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A * value: - * description: "The value that the Product Type represents (e.g. \"Clothing\")." + * description: "The value that the Product Type represents." * type: string + * example: Clothing * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product-variant.ts b/packages/medusa/src/models/product-variant.ts index ff8a6131fc..2045e6c648 100644 --- a/packages/medusa/src/models/product-variant.ts +++ b/packages/medusa/src/models/product-variant.ts @@ -8,11 +8,11 @@ import { OneToMany, } from "typeorm" -import { Product } from "./product" +import { DbAwareColumn } from "../utils/db-aware-column" import { MoneyAmount } from "./money-amount" +import { Product } from "./product" import { ProductOptionValue } from "./product-option-value" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -105,84 +105,114 @@ export class ProductVariant extends SoftDeletableEntity { * title: "Product Variant" * description: "Product Variants represent a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations." * x-resourceId: product_variant + * required: + * - title + * - product_id + * - inventory_quantity * properties: * id: - * description: "The id of the Product Variant. This value will be prefixed with `variant_`." * type: string + * description: The product variant's ID + * example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6 * title: * description: "A title that can be displayed for easy identification of the Product Variant." * type: string + * example: Small * product_id: - * description: "The id of the Product that the Product Variant belongs to." + * description: "The ID of the Product that the Product Variant belongs to." * type: string + * example: prod_01G1G5V2MBA328390B5AXJ610F + * product: + * description: A product object. Available if the relation `product` is expanded. + * type: object * prices: - * description: "The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region." + * description: The Money Amounts defined for the Product Variant. Each Money Amount represents a price in a given currency or a price in a specific Region. Available if the relation `prices` is expanded. * type: array * items: * $ref: "#/components/schemas/money_amount" * sku: * description: "The unique stock keeping unit used to identify the Product Variant. This will usually be a unqiue identifer for the item that is to be shipped, and can be referenced across multiple systems." * type: string + * example: shirt-123 * barcode: * description: "A generic field for a GTIN number that can be used to identify the Product Variant." * type: string + * example: null * ean: * description: "An EAN barcode number that can be used to identify the Product Variant." * type: string + * example: null * upc: * description: "A UPC barcode number that can be used to identify the Product Variant." * type: string + * example: null + * variant_rank: + * description: The ranking of this variant + * type: number + * default: 0 * inventory_quantity: * description: "The current quantity of the item that is stocked." * type: integer + * example: 100 * allow_backorder: * description: "Whether the Product Variant should be purchasable when `inventory_quantity` is 0." * type: boolean + * default: false * manage_inventory: * description: "Whether Medusa should manage inventory for the Product Variant." * type: boolean + * default: true * hs_code: * description: "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * origin_country: * description: "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * mid_code: * description: "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * material: * description: "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * weight: * description: "The weight of the Product Variant. May be used in shipping rate calculations." - * type: string + * type: number + * example: null * height: * description: "The height of the Product Variant. May be used in shipping rate calculations." - * type: string + * type: number + * example: null * width: * description: "The width of the Product Variant. May be used in shipping rate calculations." - * type: string + * type: number + * example: null * length: * description: "The length of the Product Variant. May be used in shipping rate calculations." - * type: string + * type: number + * example: null * options: - * description: "The Product Option Values specified for the Product Variant." + * description: The Product Option Values specified for the Product Variant. Available if the relation `options` is expanded. * type: array * items: * $ref: "#/components/schemas/product_option_value" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/product.ts b/packages/medusa/src/models/product.ts index 08414bfc07..e679bcd122 100644 --- a/packages/medusa/src/models/product.ts +++ b/packages/medusa/src/models/product.ts @@ -1,4 +1,3 @@ -import _ from "lodash" import { BeforeInsert, Column, @@ -10,18 +9,20 @@ import { ManyToOne, OneToMany, } from "typeorm" + import { DbAwareColumn } from "../utils/db-aware-column" +import { FeatureFlagDecorators } from "../utils/feature-flag-decorators" import { Image } from "./image" import { ProductCollection } from "./product-collection" import { ProductOption } from "./product-option" import { ProductTag } from "./product-tag" import { ProductType } from "./product-type" import { ProductVariant } from "./product-variant" +import { SalesChannel } from "./sales-channel" import { ShippingProfile } from "./shipping-profile" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" +import _ from "lodash" import { generateEntityId } from "../utils/generate-entity-id" -import { FeatureFlagDecorators } from "../utils/feature-flag-decorators" -import { SalesChannel } from "./sales-channel" export enum ProductStatus { DRAFT = "draft", @@ -177,99 +178,147 @@ export class Product extends SoftDeletableEntity { * title: "Product" * description: "Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by." * x-resourceId: product + * required: + * - title + * - profile_id * properties: * id: - * description: "The id of the Product. This value will be prefixed with `prod_`." * type: string + * description: The product's ID + * example: prod_01G1G5V2MBA328390B5AXJ610F * title: * description: "A title that can be displayed for easy identification of the Product." * type: string + * example: Medusa Coffee Mug * subtitle: * description: "An optional subtitle that can be used to further specify the Product." * type: string * description: * description: "A short description of the Product." * type: string + * example: Every programmer's best friend. * handle: * description: "A unique identifier for the Product (e.g. for slug structure)." * type: string + * example: coffee-mug * is_giftcard: * description: "Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased." * type: boolean - * discountable: - * description: "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`." - * type: boolean + * default: false + * status: + * description: The status of the product + * type: string + * enum: + * - draft + * - proposed + * - published + * - rejected + * default: draft * images: - * description: "Images of the Product" + * description: Images of the Product. Available if the relation `images` is expanded. * type: array * items: * $ref: "#/components/schemas/image" * thumbnail: * description: "A URL to an image file that can be used to identify the Product." * type: string + * format: uri * options: - * description: "The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product Option Values." + * description: The Product Options that are defined for the Product. Product Variants of the Product will have a unique combination of Product Option Values. Available if the relation `options` is expanded. * type: array * items: * $ref: "#/components/schemas/product_option" * variants: - * description: "The Product Variants that belong to the Product. Each will have a unique combination of Product Option Values." + * description: The Product Variants that belong to the Product. Each will have a unique combination of Product Option Values. Available if the relation `variants` is expanded. * type: array * items: * $ref: "#/components/schemas/product_variant" * profile_id: - * description: "The id of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products." + * description: "The ID of the Shipping Profile that the Product belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products." * type: string + * example: sp_01G1G5V239ENSZ5MV4JAR737BM + * profile: + * description: Available if the relation `profile` is expanded. + * $ref: "#/components/schemas/shipping_profile" + * weight: + * description: "The weight of the Product Variant. May be used in shipping rate calculations." + * type: number + * example: null + * height: + * description: "The height of the Product Variant. May be used in shipping rate calculations." + * type: number + * example: null + * width: + * description: "The width of the Product Variant. May be used in shipping rate calculations." + * type: number + * example: null + * length: + * description: "The length of the Product Variant. May be used in shipping rate calculations." + * type: number + * example: null * hs_code: * description: "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * origin_country: * description: "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * mid_code: * description: "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string + * example: null * material: * description: "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers." * type: string - * weight: - * description: "The weight of the Product Variant. May be used in shipping rate calculations." + * example: null + * collection_id: * type: string - * height: - * description: "The height of the Product Variant. May be used in shipping rate calculations." - * type: string - * width: - * description: "The width of the Product Variant. May be used in shipping rate calculations." - * type: string - * length: - * description: "The length of the Product Variant. May be used in shipping rate calculations." - * type: string - * type: - * description: "The Product Type of the Product (e.g. \"Clothing\")" - * anyOf: - * - $ref: "#/components/schemas/product_type" + * description: The Product Collection that the Product belongs to + * example: pcol_01F0YESBFAZ0DV6V831JXWH0BG * collection: - * description: "The Product Collection that the Product belongs to (e.g. \"SS20\")" - * anyOf: - * - $ref: "#/components/schemas/product_collection" + * description: A product collection object. Available if the relation `collection` is expanded. + * type: object + * type_id: + * type: string + * description: The Product type that the Product belongs to + * example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A + * type: + * description: Available if the relation `type` is expanded. + * $ref: "#/components/schemas/product_type" * tags: - * description: "The Product Tags assigned to the Product." + * description: The Product Tags assigned to the Product. Available if the relation `tags` is expanded. * type: array * items: * $ref: "#/components/schemas/product_tag" - * created_at: - * description: "The date with timezone at which the resource was created." + * discountable: + * description: "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`." + * type: boolean + * default: true + * external_id: + * description: The external ID of the product * type: string + * example: null + * sales_channels: + * description: The sales channels the product is associated with. Available if the relation `sales_channels` is expanded. + * type: array + * items: + * type: object + * description: A sales channel object. + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/refund.ts b/packages/medusa/src/models/refund.ts index 293e40ea90..1d50b608b7 100644 --- a/packages/medusa/src/models/refund.ts +++ b/packages/medusa/src/models/refund.ts @@ -1,14 +1,14 @@ import { - Entity, BeforeInsert, Column, + Entity, Index, - ManyToOne, JoinColumn, + ManyToOne, } from "typeorm" + import { BaseEntity } from "../interfaces/models/base-entity" import { DbAwareColumn } from "../utils/db-aware-column" - import { Order } from "./order" import { generateEntityId } from "../utils/generate-entity-id" @@ -56,19 +56,26 @@ export class Refund extends BaseEntity { * title: "Refund" * description: "Refund represent an amount of money transfered back to the Customer for a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by a store operator." * x-resourceId: refund + * required: + * - order_id + * - amount * properties: * id: - * description: "The id of the Refund. This value will be prefixed with `ref_`." * type: string + * description: The refund's ID + * example: ref_01G1G5V27GYX4QXNARRQCW1N8T * order_id: * description: "The id of the Order that the Refund is related to." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK * amount: * description: "The amount that has be refunded to the Customer." * type: integer + * example: 1000 * note: * description: "An optional note explaining why the amount was refunded." * type: string + * example: I didn't like it * reason: * description: "The reason given for the Refund, will automatically be set when processed as part of a Swap, Claim or Return." * type: string @@ -78,15 +85,27 @@ export class Refund extends BaseEntity { * - swap * - claim * - other - * created_at: - * description: "The date with timezone at which the resource was created." + * example: return + * idempotency_key: * type: string + * description: Randomly generated key used to continue the completion of the refund in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/region.ts b/packages/medusa/src/models/region.ts index 956f8e3c39..af65466600 100644 --- a/packages/medusa/src/models/region.ts +++ b/packages/medusa/src/models/region.ts @@ -9,14 +9,14 @@ import { OneToMany, } from "typeorm" -import { Currency } from "./currency" -import { TaxRate } from "./tax-rate" import { Country } from "./country" -import { PaymentProvider } from "./payment-provider" -import { FulfillmentProvider } from "./fulfillment-provider" -import { TaxProvider } from "./tax-provider" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" +import { Currency } from "./currency" import { DbAwareColumn } from "../utils/db-aware-column" +import { FulfillmentProvider } from "./fulfillment-provider" +import { PaymentProvider } from "./payment-provider" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" +import { TaxProvider } from "./tax-provider" +import { TaxRate } from "./tax-rate" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -104,50 +104,86 @@ export class Region extends SoftDeletableEntity { * title: "Region" * description: "Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. A Region can consist of multiple countries to accomodate common shopping settings across countries." * x-resourceId: region + * required: + * - name + * - currency_code + * - tax_rate * properties: * id: - * description: "The id of the Region. This value will be prefixed with `reg_`." * type: string + * description: The cart's ID + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * name: * description: "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name." * type: string + * example: EU * currency_code: - * description: "The 3 character ISO currency code that Customers will shop in in the Region." + * description: "The 3 character currency code that the Region uses." * type: string + * example: usd + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * currency: + * description: Available if the relation `currency` is expanded. + * $ref: "#/components/schemas/currency" * tax_rate: * description: "The tax rate that should be charged on purchases in the Region." * type: number + * example: 0 + * tax_rates: + * description: The tax rates that are included in the Region. Available if the relation `tax_rates` is expanded. + * type: array + * items: + * $ref: "#/components/schemas/tax_rate" * tax_code: * description: "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes." * type: string + * example: null + * gift_cards_taxable: + * description: Whether the gift cards are taxable or not in this region. + * type: boolean + * default: true + * automatic_taxes: + * description: Whether taxes should be automated in this region. + * type: boolean + * default: true * countries: - * description: "The countries that are included in the Region." + * description: The countries that are included in the Region. Available if the relation `countries` is expanded. * type: array * items: * $ref: "#/components/schemas/country" + * tax_provider_id: + * type: string + * description: The ID of the tax provider used in this region + * example: null + * tax_provider: + * description: Available if the relation `tax_provider` is expanded. + * $ref: "#/components/schemas/tax_provider" * payment_providers: - * description: "The Payment Providers that can be used to process Payments in the Region." + * description: The Payment Providers that can be used to process Payments in the Region. Available if the relation `payment_providers` is expanded. * type: array * items: * $ref: "#/components/schemas/payment_provider" * fulfillment_providers: - * description: "The Fulfillment Providers that can be used to fulfill orders in the Region." + * description: The Fulfillment Providers that can be used to fulfill orders in the Region. Available if the relation `payment_providers` is expanded. * type: array * items: * $ref: "#/components/schemas/fulfillment_provider" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/return-item.ts b/packages/medusa/src/models/return-item.ts index 607521b6b7..4f77b7f773 100644 --- a/packages/medusa/src/models/return-item.ts +++ b/packages/medusa/src/models/return-item.ts @@ -1,9 +1,9 @@ import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { ReturnReason } from "./return-reason" -import { Return } from "./return" +import { DbAwareColumn } from "../utils/db-aware-column" import { LineItem } from "./line-item" +import { Return } from "./return" +import { ReturnReason } from "./return-reason" @Entity() export class ReturnItem { @@ -52,37 +52,53 @@ export class ReturnItem { * title: "Return Item" * description: "Correlates a Line Item with a Return, keeping track of the quantity of the Line Item that will be returned." * x-resourceId: return_item + * required: + * - return_id + * - item_id * properties: * return_id: * description: "The id of the Return that the Return Item belongs to." * type: string + * example: ret_01F0YET7XPCMF8RZ0Y151NZV2V + * return_order: + * description: Available if the relation `return_order` is expanded. + * $ref: "#/components/schemas/return" * item_id: * description: "The id of the Line Item that the Return Item references." * type: string + * example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN * item: - * description: "The Line Item that the Return Item references." - * anyOf: - * - $ref: "#/components/schemas/line_item" + * description: Available if the relation `item` is expanded. + * $ref: "#/components/schemas/line_item" * quantity: * description: "The quantity of the Line Item that is included in the Return." * type: integer + * example: 1 * is_requested: * description: "Whether the Return Item was requested initially or received unexpectedly in the warehouse." * type: boolean + * default: true * requested_quantity: * description: "The quantity that was originally requested to be returned." * type: integer + * example: 1 * recieved_quantity: * description: "The quantity that was received in the warehouse." * type: integer + * example: 1 + * reason_id: + * description: The ID of the reason for returning the item. + * type: string + * example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ * reason: - * description: "The reason for returning the item." - * anyOf: - * - $ref: "#/components/schemas/return_reason" + * description: Available if the relation `reason` is expanded. + * $ref: "#/components/schemas/return_reason" * note: * description: "An optional note with additional details about the Return." * type: string + * example: I didn't like it. * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/return-reason.ts b/packages/medusa/src/models/return-reason.ts index 9668ddd28b..88597ba284 100644 --- a/packages/medusa/src/models/return-reason.ts +++ b/packages/medusa/src/models/return-reason.ts @@ -7,8 +7,9 @@ import { ManyToOne, OneToMany, } from "typeorm" -import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" + import { DbAwareColumn } from "../utils/db-aware-column" +import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -51,32 +52,50 @@ export class ReturnReason extends SoftDeletableEntity { * title: "Return Reason" * description: "A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned." * x-resourceId: return_reason + * required: + * - value + * - label * properties: * id: - * description: "The id of the Return Reason will start with `rr_`." * type: string + * description: The cart's ID + * example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ * description: * description: "A description of the Reason." * type: string + * example: Items that are damaged * label: * description: "A text that can be displayed to the Customer as a reason." * type: string + * example: Damaged goods * value: * description: "The value to identify the reason by." * type: string - * created_at: - * description: "The date with timezone at which the resource was created." + * example: damaged + * parent_return_reason_id: * type: string + * description: The ID of the parent reason. + * example: null + * parent_return_reason: + * description: Available if the relation `parent_return_reason` is expanded. + * $ref: "#/components/schemas/return_reason" + * return_reason_children: + * description: Available if the relation `return_reason_children` is expanded. + * $ref: "#/components/schemas/return_reason" + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/return.ts b/packages/medusa/src/models/return.ts index c6f25fb385..e4edc35cc4 100644 --- a/packages/medusa/src/models/return.ts +++ b/packages/medusa/src/models/return.ts @@ -10,12 +10,12 @@ import { } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" -import { Order } from "./order" -import { Swap } from "./swap" +import { BaseEntity } from "../interfaces/models/base-entity" import { ClaimOrder } from "./claim-order" +import { Order } from "./order" import { ReturnItem } from "./return-item" import { ShippingMethod } from "./shipping-method" -import { BaseEntity } from "../interfaces/models/base-entity" +import { Swap } from "./swap" import { generateEntityId } from "../utils/generate-entity-id" export enum ReturnStatus { @@ -98,10 +98,13 @@ export class Return extends BaseEntity { * title: "Return" * description: "Return orders hold information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can be used as part of a Swap." * x-resourceId: return + * required: + * - refund_amount * properties: * id: - * description: "The id of the Return. This value will be prefixed with `ret_`." * type: string + * description: The return's ID + * example: ret_01F0YET7XPCMF8RZ0Y151NZV2V * status: * description: "Status of the Return." * type: string @@ -109,46 +112,71 @@ export class Return extends BaseEntity { * - requested * - received * - requires_action + * - canceled + * default: requested * items: - * description: "The Return Items that will be shipped back to the warehouse. + * description: The Return Items that will be shipped back to the warehouse. Available if the relation `items` is expanded. * type: array * items: * $ref: "#/components/schemas/return_item" * swap_id: - * description: "The id of the Swap that the Return is a part of." + * description: "The ID of the Swap that the Return is a part of." * type: string + * example: null + * swap: + * description: A swap object. Available if the relation `swap` is expanded. + * type: object * order_id: - * description: "The id of the Order that the Return is made from." + * description: "The ID of the Order that the Return is made from." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * claim_order_id: - * description: "The id of the Claim that the Return is a part of." + * description: "The ID of the Claim that the Return is a part of." * type: string + * example: null + * claim_order: + * description: A claim order object. Available if the relation `claim_order` is expanded. + * type: object * shipping_method: - * description: "The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves." - * anyOf: - * - $ref: "#/components/schemas/shipping_method" + * description: The Shipping Method that will be used to send the Return back. Can be null if the Customer facilitates the return shipment themselves. Available if the relation `shipping_method` is expanded. + * type: array + * items: + * $ref: "#/components/schemas/shipping_method" * shipping_data: * description: "Data about the return shipment as provided by the Fulfilment Provider that handles the return shipment." * type: object + * example: {} * refund_amount: * description: "The amount that should be refunded as a result of the return." * type: integer + * example: 1000 + * no_notification: + * description: "When set to true, no notification will be sent related to this return." + * type: boolean + * example: false + * idempotency_key: + * type: string + * description: Randomly generated key used to continue the completion of the return in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. * received_at: * description: "The date with timezone at which the return was received." * type: string * format: date-time * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time - * no_notification: - * description: "When set to true, no notification will be sent related to this return." - * type: boolean * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/sales-channel.ts b/packages/medusa/src/models/sales-channel.ts index e4b9cf5f98..7fdaecd984 100644 --- a/packages/medusa/src/models/sales-channel.ts +++ b/packages/medusa/src/models/sales-channel.ts @@ -1,7 +1,7 @@ import { BeforeInsert, Column } from "typeorm" -import { SoftDeletableEntity } from "../interfaces" import { FeatureFlagEntity } from "../utils/feature-flag-decorators" +import { SoftDeletableEntity } from "../interfaces" import { generateEntityId } from "../utils" @FeatureFlagEntity("sales_channels") @@ -20,3 +20,41 @@ export class SalesChannel extends SoftDeletableEntity { this.id = generateEntityId(this.id, "sc") } } + +/** + * @schema sales_channel + * title: "Sales Channel" + * description: "A Sales Channel" + * x-resourceId: sales_channel + * required: + * - name + * properties: + * id: + * type: string + * description: The sales channel's ID + * example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A + * name: + * description: "The name of the sales channel." + * type: string + * example: Market + * description: + * description: "The description of the sales channel." + * type: string + * example: Multi-vendor market + * is_disabled: + * description: "Specify if the sales channel is enabled or disabled." + * type: boolean + * default: false + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time + */ \ No newline at end of file diff --git a/packages/medusa/src/models/shipping-method-tax-line.ts b/packages/medusa/src/models/shipping-method-tax-line.ts index 864f2ac8f0..d25159c6c6 100644 --- a/packages/medusa/src/models/shipping-method-tax-line.ts +++ b/packages/medusa/src/models/shipping-method-tax-line.ts @@ -8,8 +8,8 @@ import { Unique, } from "typeorm" -import { TaxLine } from "./tax-line" import { ShippingMethod } from "./shipping-method" +import { TaxLine } from "./tax-line" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -28,3 +28,50 @@ export class ShippingMethodTaxLine extends TaxLine { this.id = generateEntityId(this.id, "smtl") } } + +/** + * @schema sales_channel_tax_line + * title: "Sales Channel" + * description: "A Sales Channel" + * x-resourceId: sales_channel_tax_line + * required: + * - shipping_method_id + * - rate + * - name + * properties: + * id: + * type: string + * description: The line item tax line's ID + * example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 + * shipping_method_id: + * type: string + * description: The ID of the line item + * example: sm_01F0YET7DR2E7CYVSDHM593QG2 + * shipping_method: + * description: Available if the relation `shipping_method` is expanded. + * $ref: "#/components/schemas/shipping_method" + * code: + * description: "A code to identify the tax type by" + * type: string + * example: tax01 + * name: + * description: "A human friendly name for the tax" + * type: string + * example: Tax Example + * rate: + * description: "The numeric rate to charge tax by" + * type: number + * example: 10 + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} + */ \ No newline at end of file diff --git a/packages/medusa/src/models/shipping-method.ts b/packages/medusa/src/models/shipping-method.ts index 698a0223b9..9c7ad36d7a 100644 --- a/packages/medusa/src/models/shipping-method.ts +++ b/packages/medusa/src/models/shipping-method.ts @@ -10,15 +10,15 @@ import { OneToOne, PrimaryColumn, } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { ClaimOrder } from "./claim-order" -import { Order } from "./order" import { Cart } from "./cart" -import { Swap } from "./swap" +import { ClaimOrder } from "./claim-order" +import { DbAwareColumn } from "../utils/db-aware-column" +import { Order } from "./order" import { Return } from "./return" -import { ShippingOption } from "./shipping-option" import { ShippingMethodTaxLine } from "./shipping-method-tax-line" +import { ShippingOption } from "./shipping-option" +import { Swap } from "./swap" import { generateEntityId } from "../utils/generate-entity-id" @Check( @@ -100,36 +100,67 @@ export class ShippingMethod { * title: "Shipping Method" * description: "Shipping Methods represent a way in which an Order or Return can be shipped. Shipping Methods are built from a Shipping Option, but may contain additional details, that can be necessary for the Fulfillment Provider to handle the shipment." * x-resourceId: shipping_method + * required: + * - shipping_option_id + * - price * properties: * id: - * description: "The id of the Shipping Method. This value will be prefixed with `sm_`." * type: string + * description: The shipping method's ID + * example: sm_01F0YET7DR2E7CYVSDHM593QG2 * shipping_option_id: * description: "The id of the Shipping Option that the Shipping Method is built from." * type: string + * example: so_01G1G5V27GYX4QXNARRQCW1N8T * shipping_option: - * description: "The Shipping Option that the Shipping Method is built from." - * anyOf: - * - $ref: "#/components/schemas/shipping_option" + * description: Available if the relation `shipping_option` is expanded. + * $ref: "#/components/schemas/shipping_option" * order_id: * description: "The id of the Order that the Shipping Method is used on." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * return_id: * description: "The id of the Return that the Shipping Method is used on." * type: string + * example: null + * return_order: + * description: A return object. Available if the relation `return_order` is expanded. + * type: object * swap_id: * description: "The id of the Swap that the Shipping Method is used on." * type: string + * example: null + * swap: + * description: A swap object. Available if the relation `swap` is expanded. + * type: object * cart_id: * description: "The id of the Cart that the Shipping Method is used on." * type: string + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object * claim_order_id: * description: "The id of the Claim that the Shipping Method is used on." * type: string + * example: null + * claim_order: + * description: A claim order object. Available if the relation `claim_order` is expanded. + * type: object + * tax_lines: + * type: array + * description: Available if the relation `tax_lines` is expanded. + * items: + * $ref: "#/components/schemas/tax_line" * price: * description: "The amount to charge for the Shipping Method. The currency of the price is defined by the Region that the Order that the Shipping Method belongs to is a part of." * type: integer + * example: 200 * data: * description: "Additional data that the Fulfillment Provider needs to fulfill the shipment. This is used in combination with the Shipping Options data, and may contain information such as a drop point id." * type: object + * example: {} */ diff --git a/packages/medusa/src/models/shipping-option-requirement.ts b/packages/medusa/src/models/shipping-option-requirement.ts index 087db3ec59..7c32ac4c95 100644 --- a/packages/medusa/src/models/shipping-option-requirement.ts +++ b/packages/medusa/src/models/shipping-option-requirement.ts @@ -51,20 +51,35 @@ export class ShippingOptionRequirement { * title: "Shipping Option Requirement" * description: "A requirement that a Cart must satisfy for the Shipping Option to be available to the Cart." * x-resourceId: shipping_option_requirement + * required: + * - shipping_option_id + * - type + * - amount * properties: * id: - * description: "The id of the Shipping Option Requirement. This value will be prefixed with `sor_`." * type: string + * description: The shipping option requirement's ID + * example: sor_01G1G5V29AB4CTNDRFSRWSRKWD * shipping_option_id: - * description: "The id of the Shipping Option that the Shipping Option Requirement belongs to." + * description: "The id of the Shipping Option that the hipping option requirement belongs to" * type: string + * example: so_01G1G5V27GYX4QXNARRQCW1N8T + * shipping_option: + * description: Available if the relation `shipping_option` is expanded. + * $ref: "#/components/schemas/shipping_option" * type: * description: "The type of the requirement, this defines how the value will be compared to the Cart's total. `min_subtotal` requirements define the minimum subtotal that is needed for the Shipping Option to be available, while the `max_subtotal` defines the maximum subtotal that the Cart can have for the Shipping Option to be available." * type: string * enum: * - min_subtotal * - max_subtotal + * example: min_subtotal * amount: * description: "The amount to compare the Cart subtotal to." * type: integer + * example: 100 + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time */ diff --git a/packages/medusa/src/models/shipping-option.ts b/packages/medusa/src/models/shipping-option.ts index d42ffd2861..dd5f8c563e 100644 --- a/packages/medusa/src/models/shipping-option.ts +++ b/packages/medusa/src/models/shipping-option.ts @@ -8,12 +8,12 @@ import { ManyToOne, OneToMany, } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { ShippingProfile } from "./shipping-profile" -import { Region } from "./region" +import { DbAwareColumn } from "../utils/db-aware-column" import { FulfillmentProvider } from "./fulfillment-provider" +import { Region } from "./region" import { ShippingOptionRequirement } from "./shipping-option-requirement" +import { ShippingProfile } from "./shipping-profile" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -86,59 +86,80 @@ export class ShippingOption extends SoftDeletableEntity { * title: "Shipping Option" * description: "Shipping Options represent a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information." * x-resourceId: shipping_option + * required: + * - name + * - region_id + * - profile_id + * - provider_id + * - price_type * properties: * id: - * description: "The id of the Shipping Option. This value will be prefixed with `so_`." * type: string + * description: The shipping option's ID + * example: so_01G1G5V27GYX4QXNARRQCW1N8T * name: * description: "The name given to the Shipping Option - this may be displayed to the Customer." * type: string + * example: PostFake Standard * region_id: - * description: "The id of the Region that the Shipping Option belongs to." * type: string + * description: The region's ID + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G * region: - * description: "The id of the Region that the Shipping Option belongs to." - * anyOf: - * - $ref: "#/components/schemas/region" + * description: A region object. Available if the relation `region` is expanded. + * type: object * profile_id: - * description: "The id of the Shipping Profile that the Shipping Option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products." + * description: "The ID of the Shipping Profile that the shipping option belongs to. Shipping Profiles have a set of defined Shipping Options that can be used to Fulfill a given set of Products." * type: string + * example: sp_01G1G5V239ENSZ5MV4JAR737BM + * profile: + * description: Available if the relation `profile` is expanded. + * $ref: "#/components/schemas/shipping_profile" * provider_id: * description: "The id of the Fulfillment Provider, that will be used to process Fulfillments from the Shipping Option." * type: string + * example: manual + * provider: + * description: Available if the relation `provider` is expanded. + * $ref: "#/components/schemas/fulfillment_provider" * price_type: * description: "The type of pricing calculation that is used when creatin Shipping Methods from the Shipping Option. Can be `flat_rate` for fixed prices or `calculated` if the Fulfillment Provider can provide price calulations." * type: string * enum: * - flat_rate * - calculated + * example: flat_rate * amount: * description: "The amount to charge for shipping when the Shipping Option price type is `flat_rate`." * type: integer + * example: 200 * is_return: * description: "Flag to indicate if the Shipping Option can be used for Return shipments." * type: boolean + * default: false * requirements: - * description: "The requirements that must be satisfied for the Shipping Option to be available for a Cart." + * description: The requirements that must be satisfied for the Shipping Option to be available for a Cart. Available if the relation `requirements` is expanded. * type: array * items: * $ref: "#/components/schemas/shipping_option_requirement" * data: * description: "The data needed for the Fulfillment Provider to identify the Shipping Option." * type: object + * example: {} * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/shipping-profile.ts b/packages/medusa/src/models/shipping-profile.ts index abc03cd031..6e71743a35 100644 --- a/packages/medusa/src/models/shipping-profile.ts +++ b/packages/medusa/src/models/shipping-profile.ts @@ -1,8 +1,8 @@ import { BeforeInsert, Column, Entity, OneToMany } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { ShippingOption } from "./shipping-option" +import { DbAwareColumn } from "../utils/db-aware-column" import { Product } from "./product" +import { ShippingOption } from "./shipping-option" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -40,13 +40,18 @@ export class ShippingProfile extends SoftDeletableEntity { * title: "Shipping Profile" * description: "Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products." * x-resourceId: shipping_profile + * required: + * - name + * - type * properties: * id: - * description: "The id of the Shipping Profile. This value will be prefixed with `sp_`." * type: string + * description: The shipping profile's ID + * example: sp_01G1G5V239ENSZ5MV4JAR737BM * name: * description: "The name given to the Shipping profile - this may be displayed to the Customer." * type: string + * example: Default Shipping Profile * type: * description: "The type of the Shipping Profile, may be `default`, `gift_card` or `custom`." * type: string @@ -54,30 +59,32 @@ export class ShippingProfile extends SoftDeletableEntity { * - default * - gift_card * - custom + * example: default * products: - * description: "The Products that the Shipping Profile defines Shipping Options for." + * description: The Products that the Shipping Profile defines Shipping Options for. Available if the relation `products` is expanded. * type: array * items: - * $ref: "#/components/schemas/product" + * type: object + * description: A product object. * shipping_options: - * description: "The Shipping Options that can be used to fulfill the Products in the Shipping Profile." + * description: The Shipping Options that can be used to fulfill the Products in the Shipping Profile. Available if the relation `shipping_options` is expanded. * type: array * items: - * anyOf: - * - $ref: "#/components/schemas/shipping_option" + * $ref: "#/components/schemas/shipping_option" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/shipping-tax-rate.ts b/packages/medusa/src/models/shipping-tax-rate.ts index 6f8f50838d..cec3394126 100644 --- a/packages/medusa/src/models/shipping-tax-rate.ts +++ b/packages/medusa/src/models/shipping-tax-rate.ts @@ -42,26 +42,34 @@ export class ShippingTaxRate { * title: "Shipping Tax Rate" * description: "Associates a tax rate with a shipping option to indicate that the shipping option is taxed in a certain way" * x-resourceId: shipping_tax_rate + * required: + * - shipping_option_id + * - rate_id * properties: * shipping_option_id: - * description: "The id of the Shipping Option" + * description: "The ID of the Shipping Option" * type: string + * example: so_01G1G5V27GYX4QXNARRQCW1N8T + * shipping_option: + * description: Available if the relation `shipping_option` is expanded. + * $ref: "#/components/schemas/shipping_option" * rate_id: - * description: "The id of the Tax Rate" + * description: "The ID of the Tax Rate" * type: string + * example: txr_01G8XDBAWKBHHJRKH0AV02KXBR + * tax_rate: + * description: Available if the relation `tax_rate` is expanded. + * $ref: "#/components/schemas/tax_rate" * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time - * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/staged-job.ts b/packages/medusa/src/models/staged-job.ts index a5887fd544..8b304161fa 100644 --- a/packages/medusa/src/models/staged-job.ts +++ b/packages/medusa/src/models/staged-job.ts @@ -1,4 +1,5 @@ import { BeforeInsert, Column, Entity, PrimaryColumn } from "typeorm" + import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @@ -18,3 +19,25 @@ export class StagedJob { this.id = generateEntityId(this.id, "job") } } + +/** + * @schema staged_job + * title: "Staged Job" + * description: "A staged job resource" + * x-resourceId: staged_job + * required: + * - event_name + * properties: + * id: + * type: string + * description: The staged job's ID + * example: job_01F0YET7BZTARY9MKN1SJ7AAXF + * event_name: + * description: "The name of the event" + * type: string + * example: order.placed + * data: + * description: Data necessary for the job + * type: object + * example: {} + */ \ No newline at end of file diff --git a/packages/medusa/src/models/store.ts b/packages/medusa/src/models/store.ts index d5c4f0cb04..9ef2bed042 100644 --- a/packages/medusa/src/models/store.ts +++ b/packages/medusa/src/models/store.ts @@ -8,17 +8,17 @@ import { ManyToOne, OneToOne, } from "typeorm" -import { BaseEntity } from "../interfaces/models/base-entity" -import { DbAwareColumn } from "../utils/db-aware-column" - -import { Currency } from "./currency" -import { generateEntityId } from "../utils/generate-entity-id" -import { SalesChannel } from "./sales-channel" import { FeatureFlagColumn, FeatureFlagDecorators, } from "../utils/feature-flag-decorators" +import { BaseEntity } from "../interfaces/models/base-entity" +import { Currency } from "./currency" +import { DbAwareColumn } from "../utils/db-aware-column" +import { SalesChannel } from "./sales-channel" +import { generateEntityId } from "../utils/generate-entity-id" + @Entity() export class Store extends BaseEntity { @Column({ default: "Medusa Store" }) @@ -79,31 +79,49 @@ export class Store extends BaseEntity { * x-resourceId: store * properties: * id: - * description: "The id of the Store. This value will be prefixed with `store_`." * type: string + * description: The store's ID + * example: store_01G1G5V21KADXNGH29BJMAJ4B4 * name: * description: "The name of the Store - this may be displayed to the Customer." * type: string + * example: Medusa Store * default_currency_code: - * description: "The default currency code used when no other currency code is specified." + * description: "The 3 character currency code that is the default of the store." * type: string + * example: usd + * externalDocs: + * url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes + * description: See a list of codes. + * default_currency: + * description: Available if the relation `default_currency` is expanded. + * $ref: "#/components/schemas/currency" * currencies: - * description: "The currencies that are enabled for the Store." + * description: The currencies that are enabled for the Store. Available if the relation `currencies` is expanded. * type: array * items: * $ref: "#/components/schemas/currency" * swap_link_template: - * description: "A template to generate Swap links from use {{cart_id}} to include the Swap's `cart_id` in the link." + * description: "A template to generate Swap links from. Use {{cart_id}} to include the Swap's `cart_id` in the link." * type: string - * created_at: - * description: "The date with timezone at which the resource was created." + * example: null + * payment_link_template: + * description: "A template to generate Payment links from. Use {{cart_id}} to include the payment's `cart_id` in the link." * type: string - * format: date-time - * updated_at: - * description: "The date with timezone at which the resource was last updated." + * example: null + * invite_link_template: + * description: "A template to generate Invite links from" * type: string - * format: date-time - * metadata: - * description: "An optional key-value map with additional information." + * example: null + * default_sales_channel_id: + * type: string + * description: The sales channel ID the cart is associated with. + * example: null + * default_sales_channel: + * description: A sales channel object. Available if the relation `default_sales_channel` is expanded. * type: object + * metadata: + * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/swap.ts b/packages/medusa/src/models/swap.ts index bc6c25c3e7..35cbcbf69a 100644 --- a/packages/medusa/src/models/swap.ts +++ b/packages/medusa/src/models/swap.ts @@ -10,13 +10,13 @@ import { } from "typeorm" import { DbAwareColumn, resolveDbType } from "../utils/db-aware-column" -import { Order } from "./order" -import { Fulfillment } from "./fulfillment" import { Address } from "./address" -import { LineItem } from "./line-item" -import { Return } from "./return" import { Cart } from "./cart" +import { Fulfillment } from "./fulfillment" +import { LineItem } from "./line-item" +import { Order } from "./order" import { Payment } from "./payment" +import { Return } from "./return" import { ShippingMethod } from "./shipping-method" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -122,23 +122,25 @@ export class Swap extends SoftDeletableEntity { * title: "Swap" * description: "Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference." * x-resourceId: swap + * required: + * - fulfillment_status + * - payment_status + * - order_id * properties: * id: - * description: "The id of the Swap. This value will be prefixed with `swap_`." * type: string + * description: The swap's ID + * example: swap_01F0YET86Y9G92D3YDR9Y6V676 * fulfillment_status: * description: "The status of the Fulfillment of the Swap." * type: string * enum: * - not_fulfilled - * - partially_fulfilled * - fulfilled - * - partially_shipped * - shipped - * - partially_returned - * - returned * - canceled * - requires_action + * example: not_fulfilled * payment_status: * description: "The status of the Payment of the Swap. The payment may either refer to the refund of an amount or the authorization of a new amount." * type: string @@ -146,60 +148,73 @@ export class Swap extends SoftDeletableEntity { * - not_paid * - awaiting * - captured + * - confirmed * - canceled * - difference_refunded + * - partially_refunded + * - refunded * - requires_action + * example: not_paid * order_id: - * description: "The id of the Order where the Line Items to be returned where purchased." + * description: "The ID of the Order where the Line Items to be returned where purchased." * type: string + * example: order_01G8TJSYT9M6AVS5N4EMNFS1EK + * order: + * description: An order object. Available if the relation `order` is expanded. + * type: object * additional_items: - * description: "The new Line Items to ship to the Customer." + * description: The new Line Items to ship to the Customer. Available if the relation `additional_items` is expanded. * type: array * items: * $ref: "#/components/schemas/line_item" * return_order: - * description: "The Return that is issued for the return part of the Swap." - * anyOf: - * - $ref: "#/components/schemas/return" + * description: A return order object. The Return that is issued for the return part of the Swap. Available if the relation `return_order` is expanded. + * type: object * fulfillments: - * description: "The Fulfillments used to send the new Line Items." + * description: The Fulfillments used to send the new Line Items. Available if the relation `fulfillments` is expanded. * type: array * items: * $ref: "#/components/schemas/fulfillment" * payment: - * description: "The Payment authorized when the Swap requires an additional amount to be charged from the Customer." - * anyOf: - * - $ref: "#/components/schemas/payment" + * description: The Payment authorized when the Swap requires an additional amount to be charged from the Customer. Available if the relation `payment` is expanded. + * $ref: "#/components/schemas/payment" * difference_due: * description: "The difference that is paid or refunded as a result of the Swap. May be negative when the amount paid for the returned items exceed the total of the new Products." * type: integer + * example: 0 + * shipping_address_id: + * description: The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order. + * type: string + * example: addr_01G8ZH853YPY9B94857DY91YGW * shipping_address: - * description: "The Address to send the new Line Items to - in most cases this will be the same as the shipping address on the Order." - * anyOf: - * - $ref: "#/components/schemas/address" + * description: Available if the relation `shipping_address` is expanded. + * $ref: "#/components/schemas/address" * shipping_methods: - * description: "The Shipping Methods used to fulfill the addtional items purchased." + * description: The Shipping Methods used to fulfill the addtional items purchased. Available if the relation `shipping_methods` is expanded. * type: array * items: * $ref: "#/components/schemas/shipping_method" * cart_id: * description: "The id of the Cart that the Customer will use to confirm the Swap." * type: string + * example: cart_01G8ZH853Y6TFXWPG5EYE81X63 + * cart: + * description: A cart object. Available if the relation `cart` is expanded. + * type: object * allow_backorder: * description: "If true, swaps can be completed with items out of stock" * type: boolean + * default: false + * idempotency_key: + * type: string + * description: Randomly generated key used to continue the completion of the swap in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. * confirmed_at: * description: "The date with timezone at which the Swap was confirmed by the Customer." * type: string * format: date-time - * created_at: - * description: "The date with timezone at which the resource was created." - * type: string - * format: date-time - * updated_at: - * description: "The date with timezone at which the resource was last updated." - * type: string - * format: date-time * canceled_at: * description: "The date with timezone at which the Swap was canceled." * type: string @@ -207,7 +222,21 @@ export class Swap extends SoftDeletableEntity { * no_notification: * description: "If set to true, no notification will be sent related to this swap" * type: boolean + * example: false + * created_at: + * type: string + * description: "The date with timezone at which the resource was created." + * format: date-time + * updated_at: + * type: string + * description: "The date with timezone at which the resource was updated." + * format: date-time + * deleted_at: + * type: string + * description: "The date with timezone at which the resource was deleted." + * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/tax-line.ts b/packages/medusa/src/models/tax-line.ts index 410a40f8f8..d39bd1d3b6 100644 --- a/packages/medusa/src/models/tax-line.ts +++ b/packages/medusa/src/models/tax-line.ts @@ -1,5 +1,5 @@ -import { Column } from "typeorm" import { BaseEntity } from "../interfaces/models/base-entity" +import { Column } from "typeorm" import { DbAwareColumn } from "../utils/db-aware-column" export class TaxLine extends BaseEntity { @@ -21,28 +21,36 @@ export class TaxLine extends BaseEntity { * title: "Tax Line" * description: "Line item that specifies an amount of tax to add to a line item." * x-resourceId: tax_line + * required: + * - rate + * - name * properties: * id: - * description: "The id of the Tax Line. This value will be prefixed by `tl_`." * type: string + * description: The tax line's ID + * example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8 * code: * description: "A code to identify the tax type by" * type: string + * example: tax01 * name: * description: "A human friendly name for the tax" * type: string + * example: Tax Example * rate: * description: "The numeric rate to charge tax by" * type: number + * example: 10 * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/tax-provider.ts b/packages/medusa/src/models/tax-provider.ts index 538ebea35f..14c0f20aa2 100644 --- a/packages/medusa/src/models/tax-provider.ts +++ b/packages/medusa/src/models/tax-provider.ts @@ -18,7 +18,9 @@ export class TaxProvider { * id: * description: "The id of the tax provider as given by the plugin." * type: string + * example: manual * is_installed: * description: "Whether the plugin is installed in the current version. Plugins that are no longer installed are not deleted by will have this field set to `false`." * type: boolean + * default: true */ diff --git a/packages/medusa/src/models/tax-rate.ts b/packages/medusa/src/models/tax-rate.ts index c822c06167..83b6576fed 100644 --- a/packages/medusa/src/models/tax-rate.ts +++ b/packages/medusa/src/models/tax-rate.ts @@ -7,13 +7,13 @@ import { ManyToMany, ManyToOne, } from "typeorm" -import { DbAwareColumn } from "../utils/db-aware-column" -import { Region } from "./region" +import { BaseEntity } from "../interfaces/models/base-entity" +import { DbAwareColumn } from "../utils/db-aware-column" import { Product } from "./product" import { ProductType } from "./product-type" +import { Region } from "./region" import { ShippingOption } from "./shipping-option" -import { BaseEntity } from "../interfaces/models/base-entity" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -95,34 +95,73 @@ export class TaxRate extends BaseEntity { * title: "Tax Rate" * description: "A Tax Rate can be used to associate a certain rate to charge on products within a given Region" * x-resourceId: line_item + * required: + * - name + * - region_id * properties: * id: - * description: "The id of the Tax Rate. This value will be prefixed by `txr_`." * type: string + * description: The tax rate's ID + * example: txr_01G8XDBAWKBHHJRKH0AV02KXBR * rate: * description: "The numeric rate to charge" * type: number + * example: 10 * code: * description: "A code to identify the tax type by" * type: string + * example: tax01 * name: * description: "A human friendly name for the tax" * type: string + * example: Tax Example * region_id: + * type: string * description: "The id of the Region that the rate belongs to" - * type: string + * example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G + * region: + * description: A region object. Available if the relation `region` is expanded. + * type: object + * products: + * type: array + * description: The products that belong to this tax rate. Available if the relation `products` is expanded. + * items: + * type: object + * description: A product object. + * product_types: + * type: array + * description: The product types that belong to this tax rate. Available if the relation `product_types` is expanded. + * items: + * type: object + * description: A product type object. + * shipping_options: + * type: array + * description: The shipping options that belong to this tax rate. Available if the relation `shipping_options` is expanded. + * items: + * type: object + * description: A shipping option object. + * product_count: + * description: "The count of products" + * type: integer + * example: null + * product_type_count: + * description: "The count of product types" + * type: integer + * example: null + * shipping_option_count: + * description: "The count of shipping options" + * type: integer + * example: null * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object - * refundable: - * description: "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration." - * type: integer + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/tracking-link.ts b/packages/medusa/src/models/tracking-link.ts index 3996ad42c7..53b7372df9 100644 --- a/packages/medusa/src/models/tracking-link.ts +++ b/packages/medusa/src/models/tracking-link.ts @@ -1,8 +1,8 @@ import { BeforeInsert, Column, Entity, JoinColumn, ManyToOne } from "typeorm" +import { DbAwareColumn } from "../utils/db-aware-column" import { Fulfillment } from "./fulfillment" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" -import { DbAwareColumn } from "../utils/db-aware-column" import { generateEntityId } from "../utils/generate-entity-id" @Entity() @@ -37,32 +37,49 @@ export class TrackingLink extends SoftDeletableEntity { * title: "Tracking Link" * description: "Tracking Link holds information about tracking numbers for a Fulfillment. Tracking Links can optionally contain a URL that can be visited to see the status of the shipment." * x-resourceId: tracking_link + * required: + * - tracking_number + * - fulfillment_id * properties: * id: - * description: "The id of the Tracking Link. This value will be prefixed with `tlink_`." * type: string + * description: The tracking link's ID + * example: tlink_01G8ZH853Y6TFXWPG5EYE81X63 * url: * description: "The URL at which the status of the shipment can be tracked." * type: string + * format: uri * tracking_number: * description: "The tracking number given by the shipping carrier." * type: string + * format: RH370168054CN * fulfillment_id: + * type: string * description: "The id of the Fulfillment that the Tracking Link references." + * example: ful_01G8ZRTMQCA76TXNAT81KPJZRF + * fulfillment: + * description: Available if the relation `fulfillment` is expanded. + * $ref: "#/components/schemas/fulfillment" + * idempotency_key: * type: string + * description: Randomly generated key used to continue the completion of a process in case of failure. + * externalDocs: + * url: https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key + * description: Learn more how to use the idempotency key. * created_at: - * description: "The date with timezone at which the resource was created." * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: - * description: "The date with timezone at which the resource was last updated." * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: - * description: "The date with timezone at which the resource was deleted." * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: - * description: "An optional key-value map with additional information." * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/packages/medusa/src/models/user.ts b/packages/medusa/src/models/user.ts index 110c04acd0..5473352734 100644 --- a/packages/medusa/src/models/user.ts +++ b/packages/medusa/src/models/user.ts @@ -1,4 +1,5 @@ import { BeforeInsert, Column, Entity, Index } from "typeorm" + import { DbAwareColumn } from "../utils/db-aware-column" import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity" import { generateEntityId } from "../utils/generate-entity-id" @@ -49,28 +50,43 @@ export class User extends SoftDeletableEntity { * title: "User" * description: "Represents a User who can manage store settings." * x-resourceId: user + * required: + * - email * properties: * id: - * description: "The unique id of the User. This will be prefixed with `usr_`" * type: string + * description: The user's ID + * example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V * email: * description: "The email of the User" * type: string + * format: email * first_name: + * description: "The first name of the User" * type: string + * example: Levi * last_name: - * description: "The Customer's billing address." - * anyOf: - * - $ref: "#/components/schemas/address" + * description: "The last name of the User" + * type: string + * example: Bogan + * api_token: + * description: An API token associated with the user. + * type: string + * example: null * created_at: * type: string + * description: "The date with timezone at which the resource was created." * format: date-time * updated_at: * type: string + * description: "The date with timezone at which the resource was updated." * format: date-time * deleted_at: * type: string + * description: "The date with timezone at which the resource was deleted." * format: date-time * metadata: * type: object + * description: An optional key-value map with additional details + * example: {car: "white"} */ diff --git a/scripts/build-openapi.js b/scripts/build-openapi.js index 0fe688f567..171d79dec0 100755 --- a/scripts/build-openapi.js +++ b/scripts/build-openapi.js @@ -3,6 +3,7 @@ const fs = require("fs") const OAS = require("oas-normalize") const swaggerInline = require("swagger-inline") +const { exec } = require("child_process") // Storefront API swaggerInline( @@ -20,6 +21,7 @@ swaggerInline( .catch((err) => { console.log("Error in store") console.error(err) + process.exit(0) }) }) @@ -31,6 +33,12 @@ swaggerInline( } ).then((gen) => { fs.writeFileSync("./docs/api/store-spec3.yaml", gen) + exec("rm -rf docs/api/store/ && yarn run -- redocly split docs/api/store-spec3.yaml --outDir=docs/api/store/", (error, stdout, stderr) => { + if (error) { + throw new Error(`error: ${error.message}`) + } + console.log(`${stderr || stdout}`); + }); }) // Admin API @@ -49,6 +57,7 @@ swaggerInline( .catch((err) => { console.log("Error in admin") console.error(err) + process.exit(0) }) }) @@ -60,4 +69,11 @@ swaggerInline( } ).then((gen) => { fs.writeFileSync("./docs/api/admin-spec3.yaml", gen) + exec("rm -rf docs/api/admin/ && yarn run -- redocly split docs/api/admin-spec3.yaml --outDir=docs/api/admin/", (error, stdout, stderr) => { + if (error) { + throw new Error(`error: ${error.message}`) + } + console.log(`${stderr || stdout}`); + return; + }); }) diff --git a/www/docs/.yarn/install-state.gz b/www/docs/.yarn/install-state.gz index c1440e5ceb..b513dc15e1 100644 Binary files a/www/docs/.yarn/install-state.gz and b/www/docs/.yarn/install-state.gz differ diff --git a/www/docs/docusaurus.config.js b/www/docs/docusaurus.config.js index 767b64d1ba..557958ade3 100644 --- a/www/docs/docusaurus.config.js +++ b/www/docs/docusaurus.config.js @@ -1,5 +1,6 @@ const path = require("path") const docsPath = path.join(__dirname, "../../docs/content") +const apisPath = path.join(__dirname, "../../docs/api") const algoliaAppId = process.env.ALGOLIA_APP_ID || "temp" const algoliaApiKey = process.env.ALGOLIA_API_KEY || "temp" @@ -65,13 +66,32 @@ module.exports = { }, { type: 'dropdown', - label: 'References', + label: 'REST API Reference', items: [ { - href: `https://docs.medusajs.com/api/store`, - target: "_self", - label: "API Reference", + type: 'html', + value: ` + Store + + ` }, + { + type: 'html', + value: ` + Admin + + ` + }, + ], + }, + { + type: 'dropdown', + label: 'References', + items: [ { to: "cli/reference", label: "CLI Reference", @@ -158,9 +178,45 @@ module.exports = { showLastUpdateTime: true }, theme: { - customCss: require.resolve("./src/css/custom.css"), + customCss: require.resolve("./src/css/custom.css") }, }, ], + [ + 'redocusaurus', + { + // Plugin Options for loading OpenAPI files + specs: [ + { + spec: path.join(apisPath, 'store/openapi.yaml'), + route: '/api/store', + layout: { + noFooter: true + } + }, + { + spec: path.join(apisPath, 'admin/openapi.yaml'), + route: '/api/admin', + layout: { + noFooter: true + } + } + ], + // Theme Options for modifying how redoc renders them + theme: { + primaryColorDark: '#242526', + options: { + disableSearch: true, + nativeScrollbars: true, + sortTagsAlphabetically: true, + hideDownloadButton: true, + expandResponses: "200,204", + generatedPayloadSamplesMaxDepth: 4, + showObjectSchemaExamples: true, + requiredPropsFirst: true + } + } + }, + ], ], } diff --git a/www/docs/package.json b/www/docs/package.json index 72d9aee188..ee6d98ad7e 100644 --- a/www/docs/package.json +++ b/www/docs/package.json @@ -30,6 +30,7 @@ "prism-react-renderer": "^1.3.1", "react": "^17.0.1", "react-dom": "^17.0.1", + "redocusaurus": "^1.3.0", "url-loader": "^4.1.1" }, "browserslist": { diff --git a/www/docs/src/components/Banner/Banner.js b/www/docs/src/components/Banner/Banner.js deleted file mode 100644 index d33c2ae513..0000000000 --- a/www/docs/src/components/Banner/Banner.js +++ /dev/null @@ -1,56 +0,0 @@ -import React, { useEffect, useState } from "react" - -import CloseIcon from "../close-icon" -import ConfLogo from "../../../static/img/logo.svg" -import clsx from "clsx" -import styles from "./banner.module.css" -import {useColorMode} from '@docusaurus/theme-common'; - -const Banner = (props) => { - const [isBannerVisible, setIsBannerVisible] = useState(true) - const { isDarkTheme } = useColorMode() - - const handleDismissBanner = () => { - setIsBannerVisible(false) - if (localStorage) { - localStorage.setItem("mc::banner", false) - } - } - - useEffect(() => { - if (localStorage) { - const shouldShow = localStorage.getItem("mc::banner") - if (!shouldShow) { - setIsBannerVisible(true) - } - - if (shouldShow === "false") { - setIsBannerVisible(false) - } - } - }, []) - - return ( - isBannerVisible && ( -
-
-
- -

- We are still working on building out our documentation and guides, - but if you are interested in learning more please reach out - we - would love to jump on a call with you and help you get set up! -

-
- {/*
- -
*/} -
-
- ) - ) -} - -export default Banner diff --git a/www/docs/src/components/Banner/banner.module.css b/www/docs/src/components/Banner/banner.module.css deleted file mode 100644 index 1802b91642..0000000000 --- a/www/docs/src/components/Banner/banner.module.css +++ /dev/null @@ -1,18 +0,0 @@ -.bannerContainer { - height: 100%; - padding: 10px 0px; - margin-bottom: 20px; - background-color: var(--ifm-medusa-gray); - border-radius: 5px; -} - -.bannerContainer svg { - max-width: 100px; - margin-left: 15px; -} - -.banner { - display: flex; - flex-direction: row; - justify-content: space-between; -} diff --git a/www/docs/src/components/Banner/index.js b/www/docs/src/components/Banner/index.js deleted file mode 100644 index e70a0aadc3..0000000000 --- a/www/docs/src/components/Banner/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default as Banner } from "./Banner" diff --git a/www/docs/src/components/Layout/Layout.js b/www/docs/src/components/Layout/Layout.js index 41199808a8..8fb93152c5 100644 --- a/www/docs/src/components/Layout/Layout.js +++ b/www/docs/src/components/Layout/Layout.js @@ -1,4 +1,5 @@ -import React from "react" +import React, { useEffect } from "react" + import RootLayout from "@theme/Layout" const Layout = ({ children, ...props }) => { diff --git a/www/docs/src/components/Tabs/tabs.module.css b/www/docs/src/components/Tabs/tabs.module.css index 2f7721a777..41e999ef4c 100644 --- a/www/docs/src/components/Tabs/tabs.module.css +++ b/www/docs/src/components/Tabs/tabs.module.css @@ -11,5 +11,4 @@ color: var(--ifm-color-primary); border-bottom: 3px solid var(--ifm-color-primary) !important; font-weight: 500; - transition: ; } diff --git a/www/docs/src/css/custom.css b/www/docs/src/css/custom.css index 8973844eed..3e4f918b06 100644 --- a/www/docs/src/css/custom.css +++ b/www/docs/src/css/custom.css @@ -284,7 +284,7 @@ details summary { cursor: pointer; } -.theme-doc-markdown a:not(.box-link):hover { +[data-theme="dark"] .theme-doc-markdown a.card:hover { color: rgba(255, 255, 255, 0.8); text-decoration: none; } @@ -317,4 +317,13 @@ details summary { max-width: 100%; word-break: break-word; white-space: break-spaces; +} + +/* API Reference Styling */ +html[data-theme="dark"] .redocusaurus .expanded + tr > td > div { + background-color: var(--ifm-medusa-gray); +} + +.redocusaurus a { + color: var(--ifm-link-color) !important; } \ No newline at end of file diff --git a/www/docs/src/theme/DocCard/index.js b/www/docs/src/theme/DocCard/index.js index 99edf4a633..189c81a27f 100644 --- a/www/docs/src/theme/DocCard/index.js +++ b/www/docs/src/theme/DocCard/index.js @@ -9,6 +9,7 @@ import clsx from 'clsx'; import isInternalUrl from '@docusaurus/isInternalUrl'; import styles from './styles.module.css'; import {translate} from '@docusaurus/Translate'; + function CardContainer({href, children}) { return ( { + if (isBrowser) { + + //redocusaurus in dark mode displays styling wrong + //until the issue is resolved, this is a work around to hide + //the bad styling + window.onload = function () { + setLoading(false); + } + + //fallback in case the onload function does not execute + setTimeout(() => { + if (loading) { + setLoading(false); + } + }, 1000) + + function scrollHandler () { + const redocSidebar = document.querySelector('.redocusaurus .menu-content'); + const navbar = document.querySelector('.navbar'); + if (!redocSidebar || !navbar) { + return; + } + + let offset = navbar.clientHeight; + for (let [_, className] of navbar.classList.entries()) { + if (className.indexOf('navbarHidden') !== -1) { + offset = 0; + break; + } + } + + redocSidebar.style.top = `${offset}px` + } + + window.addEventListener('scroll', scrollHandler); + + return () => { + window.removeEventListener('scroll', scrollHandler); + } + } + }, [isBrowser]) + + return ( +
+ +
+ ); +} diff --git a/www/docs/src/theme/SearchPage/index.js b/www/docs/src/theme/SearchPage/index.js index 20bc1d0e29..512eda54de 100644 --- a/www/docs/src/theme/SearchPage/index.js +++ b/www/docs/src/theme/SearchPage/index.js @@ -22,6 +22,7 @@ import clsx from 'clsx'; import styles from './styles.module.css'; import {useAllDocsData} from '@docusaurus/plugin-content-docs/client'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; + // Very simple pluralization: probably good enough for now function useDocumentsFoundPlural() { const {selectMessage} = usePluralForm(); diff --git a/www/docs/yarn.lock b/www/docs/yarn.lock index 6a64ed6a82..6d70c77115 100644 --- a/www/docs/yarn.lock +++ b/www/docs/yarn.lock @@ -448,6 +448,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-annotate-as-pure@npm:^7.16.0, @babel/helper-annotate-as-pure@npm:^7.18.6": + version: 7.18.6 + resolution: "@babel/helper-annotate-as-pure@npm:7.18.6" + dependencies: + "@babel/types": ^7.18.6 + checksum: e413cd022e1e21232c1ce98f3e1198ec5f4774c7eceb81155a45f9cb6d8481f3983c52f83252309856668e728c751f0340d29854b604530a694899208df6bcc3 + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.16.7": version: 7.16.7 resolution: "@babel/helper-annotate-as-pure@npm:7.16.7" @@ -457,15 +466,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-annotate-as-pure@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-annotate-as-pure@npm:7.18.6" - dependencies: - "@babel/types": ^7.18.6 - checksum: e413cd022e1e21232c1ce98f3e1198ec5f4774c7eceb81155a45f9cb6d8481f3983c52f83252309856668e728c751f0340d29854b604530a694899208df6bcc3 - languageName: node - linkType: hard - "@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.16.7": version: 7.16.7 resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.16.7" @@ -706,6 +706,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-imports@npm:^7.0.0, @babel/helper-module-imports@npm:^7.16.0, @babel/helper-module-imports@npm:^7.18.6": + version: 7.18.6 + resolution: "@babel/helper-module-imports@npm:7.18.6" + dependencies: + "@babel/types": ^7.18.6 + checksum: a92e28fc4b5dbb0d0afd4a313efc0cf5b26ce1adc0c01fc22724c997789ac7d7f4f30bc9143d94a6ba8b0a035933cf63a727a365ce1c57dbca0935f48de96244 + languageName: node + linkType: hard + "@babel/helper-module-imports@npm:^7.12.13, @babel/helper-module-imports@npm:^7.16.7": version: 7.16.7 resolution: "@babel/helper-module-imports@npm:7.16.7" @@ -715,15 +724,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-imports@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-module-imports@npm:7.18.6" - dependencies: - "@babel/types": ^7.18.6 - checksum: a92e28fc4b5dbb0d0afd4a313efc0cf5b26ce1adc0c01fc22724c997789ac7d7f4f30bc9143d94a6ba8b0a035933cf63a727a365ce1c57dbca0935f48de96244 - languageName: node - linkType: hard - "@babel/helper-module-transforms@npm:^7.12.1": version: 7.17.6 resolution: "@babel/helper-module-transforms@npm:7.17.6" @@ -2874,7 +2874,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.18.6": +"@babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.6": version: 7.18.9 resolution: "@babel/runtime@npm:7.18.9" dependencies: @@ -2932,7 +2932,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.18.10, @babel/traverse@npm:^7.18.11, @babel/traverse@npm:^7.18.8, @babel/traverse@npm:^7.18.9": +"@babel/traverse@npm:^7.18.10, @babel/traverse@npm:^7.18.11, @babel/traverse@npm:^7.18.8, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.4.5": version: 7.18.11 resolution: "@babel/traverse@npm:7.18.11" dependencies: @@ -2977,7 +2977,7 @@ __metadata: dependencies: "@babel/helper-validator-identifier": ^7.18.6 to-fast-properties: ^2.0.0 - checksum: 89cd4c0e3ac93d8ddb80b93261374ad85354663ce6a5415477192e57c4ab7bdb055d75e0c8da132629db423870d63496c9edc04b42de13d638906a669070d5ae + checksum: 6984d0846df8c08818c767808f818ed5a883cadaf72a935e494d0bd9237c85f88e0ba1264923b61a3c6e9cfa793df72b54b5f8e5315d0abd7e6a083c99a0f9bf languageName: node linkType: hard @@ -3522,6 +3522,43 @@ __metadata: languageName: node linkType: hard +"@emotion/is-prop-valid@npm:^1.1.0": + version: 1.2.0 + resolution: "@emotion/is-prop-valid@npm:1.2.0" + dependencies: + "@emotion/memoize": ^0.8.0 + checksum: 098bfde166ddbc3ad635157dff8dd8b90ceb5ee2804b3dbc9ffbffcac33955390d6c6e94dc36b1fde8c90f49dc1e1359dfdcd967906b006a3966382dbe8cc90b + languageName: node + linkType: hard + +"@emotion/memoize@npm:^0.8.0": + version: 0.8.0 + resolution: "@emotion/memoize@npm:0.8.0" + checksum: 246087ec09b32b295af67a094253831f398aabd953d03d14f186acb8607ed2a755e944f5e20b5ccebb461f15c2e5ccbf8fe977bcf3be951cf10961c504e1e65b + languageName: node + linkType: hard + +"@emotion/stylis@npm:^0.8.4": + version: 0.8.5 + resolution: "@emotion/stylis@npm:0.8.5" + checksum: f109e3f11cb0d48e8658aaa23578c5bcfe35e297819cfb089a3de6ba8dc0f89b0960474922690c6028df5d2e1895b4967f2fb280642c030054c312f1e137ce26 + languageName: node + linkType: hard + +"@emotion/unitless@npm:^0.7.4": + version: 0.7.5 + resolution: "@emotion/unitless@npm:0.7.5" + checksum: 4d0d94f53cb97b4481bbfa394953e1899a0b877644642ba9dd7247c27eb8c48e14e22aeb11411d7d9874685ad85dd5fb5b50eb78c6d8840eb56a84b92dcef2f4 + languageName: node + linkType: hard + +"@exodus/schemasafe@npm:^1.0.0-rc.2": + version: 1.0.0-rc.7 + resolution: "@exodus/schemasafe@npm:1.0.0-rc.7" + checksum: b612252f93578cf776d18d8a238332a003815b4ac47528163bc91122edfdf8aea27ec5cd5877b1e8ed1fb99d07e49041ee78b76a0bcab782ca2706200ae0618d + languageName: node + linkType: hard + "@gar/promisify@npm:^1.1.3": version: 1.1.3 resolution: "@gar/promisify@npm:1.1.3" @@ -3726,6 +3763,54 @@ __metadata: languageName: node linkType: hard +"@redocly/ajv@npm:^8.6.4": + version: 8.6.4 + resolution: "@redocly/ajv@npm:8.6.4" + dependencies: + fast-deep-equal: ^3.1.1 + json-schema-traverse: ^1.0.0 + require-from-string: ^2.0.2 + uri-js: ^4.2.2 + checksum: 07ffbd7480962506e696b675e4fb4b53d188e0871312a75be2d569f3ea081ed9982db6d4575f3c955adcad4742c2af45eb01dc5968937467658bec5500d6a47b + languageName: node + linkType: hard + +"@redocly/openapi-core@npm:1.0.0-beta.102": + version: 1.0.0-beta.102 + resolution: "@redocly/openapi-core@npm:1.0.0-beta.102" + dependencies: + "@redocly/ajv": ^8.6.4 + "@types/node": ^14.11.8 + colorette: ^1.2.0 + js-levenshtein: ^1.1.6 + js-yaml: ^4.1.0 + lodash.isequal: ^4.5.0 + minimatch: ^5.0.1 + node-fetch: ^2.6.1 + pluralize: ^8.0.0 + yaml-ast-parser: 0.0.43 + checksum: 1851aff7d79c045e86e824ecf1ecdcfc0e275e8c1dd3972fab2461a4d57c701006b642663528b1dbab69965ee964ea2008b0e53d399613fe49ccd96e48cf83ac + languageName: node + linkType: hard + +"@redocly/openapi-core@npm:^1.0.0-beta.97": + version: 1.0.0-beta.103 + resolution: "@redocly/openapi-core@npm:1.0.0-beta.103" + dependencies: + "@redocly/ajv": ^8.6.4 + "@types/node": ^14.11.8 + colorette: ^1.2.0 + js-levenshtein: ^1.1.6 + js-yaml: ^4.1.0 + lodash.isequal: ^4.5.0 + minimatch: ^5.0.1 + node-fetch: ^2.6.1 + pluralize: ^8.0.0 + yaml-ast-parser: 0.0.43 + checksum: 3c6ffd629da4a690ef549e2f2a234c802a0e47e234d5d687e5d1989a2eeefdbbbbd4a150c3fcc4d3cb2d27d7a7c5e48f4684c3bdd98301d7d16f6d4ad66d08c0 + languageName: node + linkType: hard + "@segment/snippet@npm:^4.13.2": version: 4.15.3 resolution: "@segment/snippet@npm:4.15.3" @@ -4080,6 +4165,13 @@ __metadata: languageName: node linkType: hard +"@types/json-schema@npm:^7.0.7": + version: 7.0.11 + resolution: "@types/json-schema@npm:7.0.11" + checksum: bd1f9a7b898ff15c4bb494eb19124f2d688b804c39f07cbf135ac73f35324970e9e8329b72aae1fb543d925ea295a1568b23056c26658cecec4741fa28c3b81a + languageName: node + linkType: hard + "@types/keyv@npm:^3.1.1": version: 3.1.4 resolution: "@types/keyv@npm:3.1.4" @@ -4119,6 +4211,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^14.11.8": + version: 14.18.21 + resolution: "@types/node@npm:14.18.21" + checksum: 2bdfa6eb23f13e058818b8f53a6759ab5eefd5809febd680be4689665d75813e5ac32388429f52df64073d0f1502364a316161af47469745014722e2f1566637 + languageName: node + linkType: hard + "@types/parse-json@npm:^4.0.0": version: 4.0.0 resolution: "@types/parse-json@npm:4.0.0" @@ -4964,6 +5063,28 @@ __metadata: languageName: node linkType: hard +"babel-plugin-styled-components@npm:>= 1.12.0": + version: 2.0.7 + resolution: "babel-plugin-styled-components@npm:2.0.7" + dependencies: + "@babel/helper-annotate-as-pure": ^7.16.0 + "@babel/helper-module-imports": ^7.16.0 + babel-plugin-syntax-jsx: ^6.18.0 + lodash: ^4.17.11 + picomatch: ^2.3.0 + peerDependencies: + styled-components: ">= 2" + checksum: 1c639742fb177f36648077a44fd473fe050aa5c664a16ecaa8e366426c44520c2a0011682b90f5b62f3c4317c22938410a6044b7cd99eaba831c00d41a2395c1 + languageName: node + linkType: hard + +"babel-plugin-syntax-jsx@npm:^6.18.0": + version: 6.18.0 + resolution: "babel-plugin-syntax-jsx@npm:6.18.0" + checksum: d5954e9c2a3dd519f23e78674ecfba61394a8fae63499afdeca4214fad68997556ebd15ce012bbc4d527ae0e3cecc98d3e8f78004a68707122642d0df4ab7213 + languageName: node + linkType: hard + "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -5221,6 +5342,13 @@ __metadata: languageName: node linkType: hard +"call-me-maybe@npm:^1.0.1": + version: 1.0.1 + resolution: "call-me-maybe@npm:1.0.1" + checksum: 551991433adc2d257d24a5dea5049addc75b182cc7f64860d41bb5ec2c2f1f72efcd6f34be475e70bbb62fde9f9ba380c1a52c922daf2b4111f25fee2509550f + languageName: node + linkType: hard + "callsites@npm:^3.0.0": version: 3.1.0 resolution: "callsites@npm:3.1.0" @@ -5252,6 +5380,13 @@ __metadata: languageName: node linkType: hard +"camelize@npm:^1.0.0": + version: 1.0.0 + resolution: "camelize@npm:1.0.0" + checksum: b2cf60c12d002f6f5bff1dc56dedd9fa98767af2090c9699a0cd4da48d02f0b3939d09722028145555528b82da3140a117f92f1f9ecc7928af4fb3bfe86fec35 + languageName: node + linkType: hard + "caniuse-api@npm:^3.0.0": version: 3.0.0 resolution: "caniuse-api@npm:3.0.0" @@ -5403,6 +5538,13 @@ __metadata: languageName: node linkType: hard +"classnames@npm:^2.3.1": + version: 2.3.1 + resolution: "classnames@npm:2.3.1" + checksum: e3b832219042802464e648c41c2e8be96c2c64d2522cfa22fbb5ec088418406c61ab351a682c077c07f691c8b00c9f0ee7939b20fabc6c23da69063252a4ab89 + languageName: node + linkType: hard + "clean-css@npm:^5.2.2": version: 5.2.4 resolution: "clean-css@npm:5.2.4" @@ -5455,6 +5597,17 @@ __metadata: languageName: node linkType: hard +"cliui@npm:^7.0.2": + version: 7.0.4 + resolution: "cliui@npm:7.0.4" + dependencies: + string-width: ^4.2.0 + strip-ansi: ^6.0.0 + wrap-ansi: ^7.0.0 + checksum: 6035f5daf7383470cef82b3d3db00bec70afb3423538c50394386ffbbab135e26c3689c41791f911fa71b62d13d3863c712fdd70f0fbdffd938a1e6fd09aac00 + languageName: node + linkType: hard + "clone-deep@npm:^4.0.1": version: 4.0.1 resolution: "clone-deep@npm:4.0.1" @@ -5475,7 +5628,7 @@ __metadata: languageName: node linkType: hard -"clsx@npm:^1.1.1": +"clsx@npm:^1.1.0, clsx@npm:^1.1.1": version: 1.1.1 resolution: "clsx@npm:1.1.1" checksum: 5c34e1d5623e3dce0dbf22eedd4f3cc7cd0dee6b1b1ef3ad49d042c9d86372a1dc7788c2ca3213ec08e65ad0e91572ae7cb77183a478c9977bd5327e8f43ffe5 @@ -5544,6 +5697,13 @@ __metadata: languageName: node linkType: hard +"colorette@npm:^1.2.0": + version: 1.4.0 + resolution: "colorette@npm:1.4.0" + checksum: 4955c8f7daafca8ae7081d672e4bd89d553bd5782b5846d5a7e05effe93c2f15f7e9c0cb46f341b59f579a39fcf436241ff79594899d75d5f3460c03d607fe9e + languageName: node + linkType: hard + "colorette@npm:^2.0.10": version: 2.0.16 resolution: "colorette@npm:2.0.16" @@ -5735,6 +5895,24 @@ __metadata: languageName: node linkType: hard +"copyfiles@npm:^2.4.1": + version: 2.4.1 + resolution: "copyfiles@npm:2.4.1" + dependencies: + glob: ^7.0.5 + minimatch: ^3.0.3 + mkdirp: ^1.0.4 + noms: 0.0.0 + through2: ^2.0.1 + untildify: ^4.0.0 + yargs: ^16.1.0 + bin: + copyfiles: copyfiles + copyup: copyfiles + checksum: e65cd055ec9acc14997b0ace83973d73f8d9c68167cbf4293c40b52d100af09a8c8da329042d52dc33422c0a8cbf74c6efb25e9ae088667721653659bd67bf57 + languageName: node + linkType: hard + "core-js-compat@npm:^3.20.2, core-js-compat@npm:^3.21.0": version: 3.21.1 resolution: "core-js-compat@npm:3.21.1" @@ -5829,6 +6007,13 @@ __metadata: languageName: node linkType: hard +"css-color-keywords@npm:^1.0.0": + version: 1.0.0 + resolution: "css-color-keywords@npm:1.0.0" + checksum: af205a86c68e0051846ed91eb3e30b4517e1904aac040013ff1d742019b3f9369ba5658ba40901dbbc121186fc4bf0e75a814321cc3e3182fbb2feb81c6d9cb7 + languageName: node + linkType: hard + "css-declaration-sorter@npm:^6.3.0": version: 6.3.0 resolution: "css-declaration-sorter@npm:6.3.0" @@ -5907,6 +6092,17 @@ __metadata: languageName: node linkType: hard +"css-to-react-native@npm:^3.0.0": + version: 3.0.0 + resolution: "css-to-react-native@npm:3.0.0" + dependencies: + camelize: ^1.0.0 + css-color-keywords: ^1.0.0 + postcss-value-parser: ^4.0.2 + checksum: 03dcf5381ff6a888e3621aaffd812fd52df803d01c264b99142a9f73942007c2e953bd27339d6e2da2504a940a2b0d3cc702d3a737165703a0d8ae9c5626c1c1 + languageName: node + linkType: hard + "css-tree@npm:^1.1.2, css-tree@npm:^1.1.3": version: 1.1.3 resolution: "css-tree@npm:1.1.3" @@ -6054,6 +6250,13 @@ __metadata: languageName: node linkType: hard +"decko@npm:^1.2.0": + version: 1.2.0 + resolution: "decko@npm:1.2.0" + checksum: bae2187734b6faa9db1cf53b04bb107f79a55735d85c7511f941d7fd1cac36991ad2048dee8451dcbcb4efa23a46e5dfd46f71a51585457cd5b912869b5d346b + languageName: node + linkType: hard + "decompress-response@npm:^3.3.0": version: 3.3.0 resolution: "decompress-response@npm:3.3.0" @@ -6238,10 +6441,24 @@ __metadata: prism-react-renderer: ^1.3.1 react: ^17.0.1 react-dom: ^17.0.1 + redocusaurus: ^1.3.0 url-loader: ^4.1.1 languageName: unknown linkType: soft +"docusaurus-plugin-redoc@npm:1.2.3": + version: 1.2.3 + resolution: "docusaurus-plugin-redoc@npm:1.2.3" + dependencies: + "@redocly/openapi-core": 1.0.0-beta.102 + joi: ^17.5.0 + redoc: 2.0.0-rc.72 + peerDependencies: + "@docusaurus/utils": ^2.0.0-beta.18 + checksum: a17edb882ece33bc72960c8a354ab51e7d3511c9ae10cae84ede2abc78b746c8e4ba1169c5f3f6b515f7b9dc6558bca5ae2a0526c6c9582924b92d95513bfe22 + languageName: node + linkType: hard + "docusaurus-plugin-segment@npm:^1.0.3": version: 1.0.3 resolution: "docusaurus-plugin-segment@npm:1.0.3" @@ -6251,6 +6468,22 @@ __metadata: languageName: node linkType: hard +"docusaurus-theme-redoc@npm:1.3.0": + version: 1.3.0 + resolution: "docusaurus-theme-redoc@npm:1.3.0" + dependencies: + clsx: ^1.1.1 + copyfiles: ^2.4.1 + lodash: ^4.17.21 + mobx: ^6.5.0 + redoc: 2.0.0-rc.72 + styled-components: ^5.3.5 + peerDependencies: + "@docusaurus/theme-common": ^2.0.0-beta.18 + checksum: 4f1cbf137709f50c9182c00eb16338f898f3490b213682b667502429415e039b4b26a96134c6673cc95e341d4537963c95464dbf64d446e580f40cee0c44c028 + languageName: node + linkType: hard + "docusaurus2-dotenv@npm:^1.4.0": version: 1.4.0 resolution: "docusaurus2-dotenv@npm:1.4.0" @@ -6323,6 +6556,13 @@ __metadata: languageName: node linkType: hard +"dompurify@npm:^2.2.8": + version: 2.3.10 + resolution: "dompurify@npm:2.3.10" + checksum: 602b9e23b2653c0757b9ed862ec5523df6211f5a97b47bbc7ea243c0945fa9637fe3b07b7d7a950b70471259b6aae3f50c1707f3418b29ec98f2dc8b946df6dc + languageName: node + linkType: hard + "domutils@npm:^2.5.2, domutils@npm:^2.8.0": version: 2.8.0 resolution: "domutils@npm:2.8.0" @@ -6547,6 +6787,13 @@ __metadata: languageName: node linkType: hard +"es6-promise@npm:^3.2.1": + version: 3.3.1 + resolution: "es6-promise@npm:3.3.1" + checksum: b4fc87cb8509c001f62f860f97b05d1fd3f87220c8b832578e6a483c719ca272b73a77f2231cb26395fa865e1cab2fd4298ab67786b69e97b8d757b938f4fc1f + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -6656,7 +6903,7 @@ __metadata: languageName: node linkType: hard -"eventemitter3@npm:^4.0.0": +"eventemitter3@npm:^4.0.0, eventemitter3@npm:^4.0.7": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" checksum: 5f6d97cbcbac47be798e6355e3a7639a84ee1f7d9b199a07017f1d2f1e2fe236004d14fa5dfaeba661f94ea57805385e326236a6debbc7145c8877fbc0297c6b @@ -6769,6 +7016,13 @@ __metadata: languageName: node linkType: hard +"fast-safe-stringify@npm:^2.0.7": + version: 2.1.1 + resolution: "fast-safe-stringify@npm:2.1.1" + checksum: d90ec1c963394919828872f21edaa3ad6f1dddd288d2bd4e977027afff09f5db40f94e39536d4646f7e01761d704d72d51dce5af1b93717f3489ef808f5f4e4d + languageName: node + linkType: hard + "fast-url-parser@npm:1.1.3": version: 1.1.3 resolution: "fast-url-parser@npm:1.1.3" @@ -6941,6 +7195,13 @@ __metadata: languageName: node linkType: hard +"foreach@npm:^2.0.4": + version: 2.0.6 + resolution: "foreach@npm:2.0.6" + checksum: dc79f83997ac986dadbc95b4035ce8b86699fb654eb85446b0ad779fe69d567fc9894075e460243ca8bc20adb8fd178ad203aef66dc3c620ac78b18a4cb7059c + languageName: node + linkType: hard + "fork-ts-checker-webpack-plugin@npm:^6.5.0": version: 6.5.0 resolution: "fork-ts-checker-webpack-plugin@npm:6.5.0" @@ -7095,6 +7356,13 @@ __metadata: languageName: node linkType: hard +"get-caller-file@npm:^2.0.5": + version: 2.0.5 + resolution: "get-caller-file@npm:2.0.5" + checksum: c6c7b60271931fa752aeb92f2b47e355eac1af3a2673f47c9589e8f8a41adc74d45551c1bc57b5e66a80609f10ffb72b6f575e4370d61cc3f7f3aaff01757cde + languageName: node + linkType: hard + "get-intrinsic@npm:^1.0.2": version: 1.1.1 resolution: "get-intrinsic@npm:1.1.1" @@ -7184,7 +7452,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.1.4": +"glob@npm:^7.0.5, glob@npm:^7.1.4": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -7475,7 +7743,7 @@ __metadata: languageName: node linkType: hard -"hoist-non-react-statics@npm:^3.1.0": +"hoist-non-react-statics@npm:^3.0.0, hoist-non-react-statics@npm:^3.1.0": version: 3.3.2 resolution: "hoist-non-react-statics@npm:3.3.2" dependencies: @@ -7659,6 +7927,13 @@ __metadata: languageName: node linkType: hard +"http2-client@npm:^1.2.5": + version: 1.3.5 + resolution: "http2-client@npm:1.3.5" + checksum: 4974f10f5c8b5b7b9e23771190471d02690e9a22c22e028d84715b7ecdcda05017fc9e565476558da3bdf0ba642d24186a94818d0b9afee706ccf9874034be73 + languageName: node + linkType: hard + "https-proxy-agent@npm:^5.0.0": version: 5.0.1 resolution: "https-proxy-agent@npm:5.0.1" @@ -7792,7 +8067,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.0, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:~2.0.3": +"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.0, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:~2.0.1, inherits@npm:~2.0.3": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4e531f648b29039fb7426fb94075e6545faa1eb9fe83c29f0b6d9e7263aceb4289d2d4557db0d428188eeb449cc7c5e77b0a0b2c4e248ff2a65933a0dee49ef2 @@ -7843,10 +8118,10 @@ __metadata: languageName: node linkType: hard -"ip@npm:^1.1.5": - version: 1.1.8 - resolution: "ip@npm:1.1.8" - checksum: ab32a5ecfa678d4c158c1381c4c6744fce89a1d793e1b6635ba79d0753c069030b672d765887b6fff55670c711dfa47475895e5d6013efbbcf04687c51cb8db9 +"ip@npm:^2.0.0": + version: 2.0.0 + resolution: "ip@npm:2.0.0" + checksum: 8d186cc5585f57372847ae29b6eba258c68862055e18a75cc4933327232cb5c107f89800ce29715d542eef2c254fbb68b382e780a7414f9ee7caf60b7a473958 languageName: node linkType: hard @@ -8156,7 +8431,7 @@ __metadata: languageName: node linkType: hard -"joi@npm:^17.6.0": +"joi@npm:^17.5.0, joi@npm:^17.6.0": version: 17.6.0 resolution: "joi@npm:17.6.0" dependencies: @@ -8169,6 +8444,13 @@ __metadata: languageName: node linkType: hard +"js-levenshtein@npm:^1.1.6": + version: 1.1.6 + resolution: "js-levenshtein@npm:1.1.6" + checksum: 14045735325ea1fd87f434a74b11d8a14380f090f154747e613529c7cff68b5ee607f5230fa40665d5fb6125a3791f4c223f73b9feca754f989b059f5c05864f + languageName: node + linkType: hard + "js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" @@ -8231,6 +8513,15 @@ __metadata: languageName: node linkType: hard +"json-pointer@npm:0.6.2, json-pointer@npm:^0.6.2": + version: 0.6.2 + resolution: "json-pointer@npm:0.6.2" + dependencies: + foreach: ^2.0.4 + checksum: 47f6103032c0340b3392cb650e0ec817f785eccb553407da13fae85bc535483c9b359d7e756de4ed73130172c28d2b02f8beb53a700a98b12e72c7bf70e734b7 + languageName: node + linkType: hard + "json-schema-traverse@npm:^0.4.1": version: 0.4.1 resolution: "json-schema-traverse@npm:0.4.1" @@ -8401,6 +8692,13 @@ __metadata: languageName: node linkType: hard +"lodash.isequal@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.isequal@npm:4.5.0" + checksum: dfdb2356db19631a4b445d5f37868a095e2402292d59539a987f134a8778c62a2810c2452d11ae9e6dcac71fc9de40a6fedcb20e2952a15b431ad8b29e50e28f + languageName: node + linkType: hard + "lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" @@ -8415,7 +8713,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": +"lodash@npm:^4.17.11, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c @@ -8472,6 +8770,13 @@ __metadata: languageName: node linkType: hard +"lunr@npm:^2.3.9": + version: 2.3.9 + resolution: "lunr@npm:2.3.9" + checksum: 77d7dbb4fbd602aac161e2b50887d8eda28c0fa3b799159cee380fbb311f1e614219126ecbbd2c3a9c685f1720a8109b3c1ca85cc893c39b6c9cc6a62a1d8a8b + languageName: node + linkType: hard + "make-dir@npm:^3.0.0, make-dir@npm:^3.0.2, make-dir@npm:^3.1.0": version: 3.1.0 resolution: "make-dir@npm:3.1.0" @@ -8482,8 +8787,8 @@ __metadata: linkType: hard "make-fetch-happen@npm:^10.0.3": - version: 10.1.8 - resolution: "make-fetch-happen@npm:10.1.8" + version: 10.2.0 + resolution: "make-fetch-happen@npm:10.2.0" dependencies: agentkeepalive: ^4.2.1 cacache: ^16.1.0 @@ -8501,7 +8806,14 @@ __metadata: promise-retry: ^2.0.1 socks-proxy-agent: ^7.0.0 ssri: ^9.0.0 - checksum: 68dd3d1f1da1f9fdf92010b1d5efcda15a95391b9fb3a2868b45f9aeb46f1254ab25847cf7e27852070f3b9387ab2d2b8ecca419b1b6ad572b99ebe23e68815e + checksum: ec51ded78f2d47be39aab4c4c1091e1850cf32b66472e252fc8927e26ad393c5c582178a95d5e77153566e9b2584909f2a7427ca5963f034b8ff0ba9c9f6518d + languageName: node + linkType: hard + +"mark.js@npm:^8.11.1": + version: 8.11.1 + resolution: "mark.js@npm:8.11.1" + checksum: 5e69e776db61abdd857b5cbb7070c8a3b1b0e5c12bf077fcd5a8c6f17b1f85ed65275aba5662b57136d1b9f82b54bb34d4ef4220f7703c9a7ab806ae1e208cff languageName: node linkType: hard @@ -8512,6 +8824,15 @@ __metadata: languageName: node linkType: hard +"marked@npm:^4.0.15": + version: 4.0.17 + resolution: "marked@npm:4.0.17" + bin: + marked: bin/marked.js + checksum: e923db2223ab7045c3f6422a31c3dcb97a9dae4a08b8dd2b1710563c4d4687703d5826d2b07382f684c7f2ebe677dfd4470cd683c9f3a7f703102531f3a0812f + languageName: node + linkType: hard + "mdast-squeeze-paragraphs@npm:^4.0.0": version: 4.0.0 resolution: "mdast-squeeze-paragraphs@npm:4.0.0" @@ -8733,7 +9054,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^3.0.4, minimatch@npm:^3.1.1": +"minimatch@npm:^3.0.3, minimatch@npm:^3.0.4, minimatch@npm:^3.1.1": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: @@ -8844,6 +9165,45 @@ __metadata: languageName: node linkType: hard +"mobx-react-lite@npm:^3.4.0": + version: 3.4.0 + resolution: "mobx-react-lite@npm:3.4.0" + peerDependencies: + mobx: ^6.1.0 + react: ^16.8.0 || ^17 || ^18 + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + checksum: 7aa64fb8740d48de23c370385331063f0a0821a87ed7a1eb0324305e8ef2f5173806c3e5ff2bfb7696e5b80faf19de11e2d3c0b64268df21895d4eec4816e325 + languageName: node + linkType: hard + +"mobx-react@npm:^7.2.0": + version: 7.5.1 + resolution: "mobx-react@npm:7.5.1" + dependencies: + mobx-react-lite: ^3.4.0 + peerDependencies: + mobx: ^6.1.0 + react: ^16.8.0 || ^17 || ^18 + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + checksum: acb48e66d0e7ca54666a9dd9aafd651659f5f556a0df6e2108ca23a4daf397e770787dba3bb81ee2b2312262b3c84442db62573547ca3e30500cdef4925a877e + languageName: node + linkType: hard + +"mobx@npm:^6.5.0": + version: 6.6.1 + resolution: "mobx@npm:6.6.1" + checksum: e46384971efa1b396b18914580c881157d2800ca84fd0ecc2bf9a8ddf6f6b18b01e7955512dc8b542d4d4b0d464b276117db59311a027c7925bceb21d10c22d8 + languageName: node + linkType: hard + "mrmime@npm:^1.0.0": version: 1.0.0 resolution: "mrmime@npm:1.0.0" @@ -8935,7 +9295,16 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:2.6.7": +"node-fetch-h2@npm:^2.3.0": + version: 2.3.0 + resolution: "node-fetch-h2@npm:2.3.0" + dependencies: + http2-client: ^1.2.5 + checksum: 10f117c5aa1d475fff05028dddd617a61606083e4d6c4195dd5f5b03c973182e0d125e804771e6888d04f7d92b5c9c27a6149d1beedd6af1e0744f163e8a02d9 + languageName: node + linkType: hard + +"node-fetch@npm:2.6.7, node-fetch@npm:^2.6.1": version: 2.6.7 resolution: "node-fetch@npm:2.6.7" dependencies: @@ -8976,6 +9345,15 @@ __metadata: languageName: node linkType: hard +"node-readfiles@npm:^0.2.0": + version: 0.2.0 + resolution: "node-readfiles@npm:0.2.0" + dependencies: + es6-promise: ^3.2.1 + checksum: 9de2f741baae29f2422b22ef4399b5f7cb6c20372d4e88447a98d00a92cf1a35efdf942d24eee153a87d885aa7e7442b4bc6de33d4b91c47ba9da501780c76a1 + languageName: node + linkType: hard + "node-releases@npm:^2.0.2": version: 2.0.2 resolution: "node-releases@npm:2.0.2" @@ -8990,6 +9368,16 @@ __metadata: languageName: node linkType: hard +"noms@npm:0.0.0": + version: 0.0.0 + resolution: "noms@npm:0.0.0" + dependencies: + inherits: ^2.0.1 + readable-stream: ~1.0.31 + checksum: 7790dbbef45c593b5444b361cb9cde3260244ab66aaa199c0728d334525eb69df96231115cff260b71b92fc7a6915a642aa22f2f8448696d8dd6e7d7cebfccce + languageName: node + linkType: hard + "nopt@npm:^5.0.0": version: 5.0.0 resolution: "nopt@npm:5.0.0" @@ -9073,6 +9461,64 @@ __metadata: languageName: node linkType: hard +"oas-kit-common@npm:^1.0.8": + version: 1.0.8 + resolution: "oas-kit-common@npm:1.0.8" + dependencies: + fast-safe-stringify: ^2.0.7 + checksum: 5619a0bd19a07b52af1afeff26e44601002c0fd558d0020fdb720cb3723b60c83b80efede3a62110ce315f15b971751fb46396760e0e507fb8fd412cdc3808dd + languageName: node + linkType: hard + +"oas-linter@npm:^3.2.2": + version: 3.2.2 + resolution: "oas-linter@npm:3.2.2" + dependencies: + "@exodus/schemasafe": ^1.0.0-rc.2 + should: ^13.2.1 + yaml: ^1.10.0 + checksum: 5a8ea3d8a0bf185b676659d1e1c0b9b50695aeff53ccd5c264c8e99b4a7c0021f802b937913d76f0bc1a6a2b8ae151df764d95302b0829063b9b26f8c436871c + languageName: node + linkType: hard + +"oas-resolver@npm:^2.5.6": + version: 2.5.6 + resolution: "oas-resolver@npm:2.5.6" + dependencies: + node-fetch-h2: ^2.3.0 + oas-kit-common: ^1.0.8 + reftools: ^1.1.9 + yaml: ^1.10.0 + yargs: ^17.0.1 + bin: + resolve: resolve.js + checksum: cfba5ba3f7ea6673a840836cf194a80ba7f77e6d1ee005aa35cc838cad56d7e455fa53753ae7cc38810c96405b8606e675098ea7023639cf546cb10343f180f9 + languageName: node + linkType: hard + +"oas-schema-walker@npm:^1.1.5": + version: 1.1.5 + resolution: "oas-schema-walker@npm:1.1.5" + checksum: 8ba6bd2a9a8ede2c5574f217653a9e2b889a7c5be69c664a57e293591c58952e8510f4f9e2a82fd5f52491c859ce5c2b68342e9b971e9667f6b811e7fb56fd54 + languageName: node + linkType: hard + +"oas-validator@npm:^5.0.8": + version: 5.0.8 + resolution: "oas-validator@npm:5.0.8" + dependencies: + call-me-maybe: ^1.0.1 + oas-kit-common: ^1.0.8 + oas-linter: ^3.2.2 + oas-resolver: ^2.5.6 + oas-schema-walker: ^1.1.5 + reftools: ^1.1.9 + should: ^13.2.1 + yaml: ^1.10.0 + checksum: 16bb722042dcba93892c50db2201df6aeea9c3dd60e2f7bc18b36f23c610d136f52a5946908817f6fdd4139219fa4b177f952b9831039078b4c8730fa026b180 + languageName: node + linkType: hard + "object-assign@npm:^4.1.0, object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" @@ -9158,6 +9604,16 @@ __metadata: languageName: node linkType: hard +"openapi-sampler@npm:^1.3.0": + version: 1.3.0 + resolution: "openapi-sampler@npm:1.3.0" + dependencies: + "@types/json-schema": ^7.0.7 + json-pointer: 0.6.2 + checksum: e4bd3d0c2125e060d5d9a86273b4ec9554b4f819632e716c31361334eb849eea9606b7cb8b727a50dbd8f8398a7da166fab3384d096c85d243dc37f0b8802346 + languageName: node + linkType: hard + "opener@npm:^1.5.2": version: 1.5.2 resolution: "opener@npm:1.5.2" @@ -9352,6 +9808,13 @@ __metadata: languageName: node linkType: hard +"path-browserify@npm:^1.0.1": + version: 1.0.1 + resolution: "path-browserify@npm:1.0.1" + checksum: 8b8c3fd5c66bd340272180590ae4ff139769e9ab79522e2eb82e3d571a89b8117c04147f65ad066dccfb42fcad902e5b7d794b3d35e0fd840491a8ddbedf8c66 + languageName: node + linkType: hard + "path-exists@npm:^3.0.0": version: 3.0.0 resolution: "path-exists@npm:3.0.0" @@ -9424,6 +9887,13 @@ __metadata: languageName: node linkType: hard +"perfect-scrollbar@npm:^1.5.1": + version: 1.5.5 + resolution: "perfect-scrollbar@npm:1.5.5" + checksum: 10f0c3a1205328b22e232be4ee9f0e832e96fb5b6c524d1d04e11f97ad910018c1c0659af145e0ae0dc2b41e67a96df12787de5366ff5ba86034339071ca722b + languageName: node + linkType: hard + "picocolors@npm:^1.0.0": version: 1.0.0 resolution: "picocolors@npm:1.0.0" @@ -9431,7 +9901,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.0, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" checksum: 26c02b8d06f03206fc2ab8d16f19960f2ff9e81a658f831ecb656d8f17d9edc799e8364b1f4a7873e89d9702dff96204be0fa26fe4181f6843f040f819dac4be @@ -9456,6 +9926,22 @@ __metadata: languageName: node linkType: hard +"pluralize@npm:^8.0.0": + version: 8.0.0 + resolution: "pluralize@npm:8.0.0" + checksum: 2044cfc34b2e8c88b73379ea4a36fc577db04f651c2909041b054c981cd863dd5373ebd030123ab058d194ae615d3a97cfdac653991e499d10caf592e8b3dc33 + languageName: node + linkType: hard + +"polished@npm:^4.1.3": + version: 4.2.2 + resolution: "polished@npm:4.2.2" + dependencies: + "@babel/runtime": ^7.17.8 + checksum: 1d054d1fea18ac7d921ca91504ffcf1ef0f505eda6acbfec6e205a98ebfea80b658664995deb35907dabc5f75f287dc2894812503a8aed28285bb91f25cf7400 + languageName: node + linkType: hard + "postcss-calc@npm:^8.2.3": version: 8.2.4 resolution: "postcss-calc@npm:8.2.4" @@ -9874,7 +10360,7 @@ __metadata: languageName: node linkType: hard -"postcss-value-parser@npm:^4.1.0, postcss-value-parser@npm:^4.2.0": +"postcss-value-parser@npm:^4.0.2, postcss-value-parser@npm:^4.1.0, postcss-value-parser@npm:^4.2.0": version: 4.2.0 resolution: "postcss-value-parser@npm:4.2.0" checksum: f4142a4f56565f77c1831168e04e3effd9ffcc5aebaf0f538eee4b2d465adfd4b85a44257bb48418202a63806a7da7fe9f56c330aebb3cac898e46b4cbf49161 @@ -9974,7 +10460,7 @@ __metadata: languageName: node linkType: hard -"prismjs@npm:^1.28.0": +"prismjs@npm:^1.27.0, prismjs@npm:^1.28.0": version: 1.28.0 resolution: "prismjs@npm:1.28.0" checksum: bf879309e74188b424cf8bb3962f9df9e7004a71f44f82a3cfbd26f884c9a0bb91f529db79503c1bc0b570ed7b94a10c3303153642da533c1e10f51779c0617f @@ -10024,7 +10510,7 @@ __metadata: languageName: node linkType: hard -"prop-types@npm:^15.6.2, prop-types@npm:^15.7.2": +"prop-types@npm:^15.5.0, prop-types@npm:^15.6.2, prop-types@npm:^15.7.2": version: 15.8.1 resolution: "prop-types@npm:15.8.1" dependencies: @@ -10361,6 +10847,18 @@ __metadata: languageName: node linkType: hard +"react-tabs@npm:^3.2.2": + version: 3.2.3 + resolution: "react-tabs@npm:3.2.3" + dependencies: + clsx: ^1.1.0 + prop-types: ^15.5.0 + peerDependencies: + react: ^16.3.0 || ^17.0.0-0 + checksum: 1891471b3708ceb3292c05fa51cc9ea7fb40c2f85b9c7494d368d563d73cd6c4ae6e65e06c42fc9595f637885f42685a64581a54832a1675526f2631a35b8d3b + languageName: node + linkType: hard + "react-textarea-autosize@npm:^8.3.2": version: 8.3.3 resolution: "react-textarea-autosize@npm:8.3.3" @@ -10384,7 +10882,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^2.0.1": +"readable-stream@npm:^2.0.1, readable-stream@npm:~2.3.6": version: 2.3.7 resolution: "readable-stream@npm:2.3.7" dependencies: @@ -10410,6 +10908,18 @@ __metadata: languageName: node linkType: hard +"readable-stream@npm:~1.0.31": + version: 1.0.34 + resolution: "readable-stream@npm:1.0.34" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.1 + isarray: 0.0.1 + string_decoder: ~0.10.x + checksum: 02272551396ed8930ddee1a088bdf0379f0f7cc47ac49ed8804e998076cb7daec9fbd2b1fd9c0490ec72e56e8bb3651abeb8080492b8e0a9c3f2158330908ed6 + languageName: node + linkType: hard + "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -10444,6 +10954,62 @@ __metadata: languageName: node linkType: hard +"redoc@npm:2.0.0-rc.72": + version: 2.0.0-rc.72 + resolution: "redoc@npm:2.0.0-rc.72" + dependencies: + "@redocly/openapi-core": ^1.0.0-beta.97 + classnames: ^2.3.1 + decko: ^1.2.0 + dompurify: ^2.2.8 + eventemitter3: ^4.0.7 + json-pointer: ^0.6.2 + lunr: ^2.3.9 + mark.js: ^8.11.1 + marked: ^4.0.15 + mobx-react: ^7.2.0 + openapi-sampler: ^1.3.0 + path-browserify: ^1.0.1 + perfect-scrollbar: ^1.5.1 + polished: ^4.1.3 + prismjs: ^1.27.0 + prop-types: ^15.7.2 + react-tabs: ^3.2.2 + slugify: ~1.4.7 + stickyfill: ^1.1.1 + style-loader: ^3.3.1 + swagger2openapi: ^7.0.6 + url-template: ^2.0.8 + peerDependencies: + core-js: ^3.1.4 + mobx: ^6.0.4 + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + styled-components: ^4.1.1 || ^5.1.1 + checksum: 778c9ec2d3d697e7254835b5ae14eb7bab6dd25b22a7dc286fb6ce4d3aaff5d1234a83b846050d35ea04d3491a777b4eef2df48c01215a3721788425144eb635 + languageName: node + linkType: hard + +"redocusaurus@npm:^1.3.0": + version: 1.3.0 + resolution: "redocusaurus@npm:1.3.0" + dependencies: + docusaurus-plugin-redoc: 1.2.3 + docusaurus-theme-redoc: 1.3.0 + peerDependencies: + "@docusaurus/theme-common": ^2.0.0-beta.18 + "@docusaurus/utils": ^2.0.0-beta.18 + checksum: ba56718c03c7a8d6c5c0ca8ee6209970c485e3166b636f18c0fb0d703f8987fa20a7fbda49f76ecba81da9c63005009491e2b774046ddee7c8b864d45da1f578 + languageName: node + linkType: hard + +"reftools@npm:^1.1.9": + version: 1.1.9 + resolution: "reftools@npm:1.1.9" + checksum: 4b44c9e75d6e5328b43b974de08776ee1718a0b48f24e033b2699f872cc9a698234a4aa0553b9e1a766b828aeb9834e4aa988410f0279e86179edb33b270da6c + languageName: node + linkType: hard + "regenerate-unicode-properties@npm:^10.0.1": version: 10.0.1 resolution: "regenerate-unicode-properties@npm:10.0.1" @@ -10643,6 +11209,13 @@ __metadata: languageName: node linkType: hard +"require-directory@npm:^2.1.1": + version: 2.1.1 + resolution: "require-directory@npm:2.1.1" + checksum: 83aa76a7bc1531f68d92c75a2ca2f54f1b01463cb566cf3fbc787d0de8be30c9dbc211d1d46be3497dac5785fe296f2dd11d531945ac29730643357978966e99 + languageName: node + linkType: hard + "require-from-string@npm:^2.0.2": version: 2.0.2 resolution: "require-from-string@npm:2.0.2" @@ -11104,6 +11677,62 @@ __metadata: languageName: node linkType: hard +"should-equal@npm:^2.0.0": + version: 2.0.0 + resolution: "should-equal@npm:2.0.0" + dependencies: + should-type: ^1.4.0 + checksum: b375e1da2586671e2b9442ac5b700af508f56438af9923f69123b1fe4e02ccddc9a8a3eb803447a6df91e616cec236c41d6f28fdaa100467f9fdb81651089538 + languageName: node + linkType: hard + +"should-format@npm:^3.0.3": + version: 3.0.3 + resolution: "should-format@npm:3.0.3" + dependencies: + should-type: ^1.3.0 + should-type-adaptors: ^1.0.1 + checksum: ef2a31148d79a3fabd0dc6c1c1b10f90d9e071ad8e1f99452bd01e8aceaca62985b43974cf8103185fa1a3ade85947c6f664e44ca9af253afd1ce93c223bd8e4 + languageName: node + linkType: hard + +"should-type-adaptors@npm:^1.0.1": + version: 1.1.0 + resolution: "should-type-adaptors@npm:1.1.0" + dependencies: + should-type: ^1.3.0 + should-util: ^1.0.0 + checksum: cf127f8807f69ace9db04dbec3f274330a854405feef9821b5fa525748961da65747869cca36c813132b98757bd3e42d53541579cb16630ccf3c0dd9c0082320 + languageName: node + linkType: hard + +"should-type@npm:^1.3.0, should-type@npm:^1.4.0": + version: 1.4.0 + resolution: "should-type@npm:1.4.0" + checksum: 50cb50d776ee117b151068367c09ec12ac8e6f5fe2bd4d167413972813f06e930fe8624232a56c335846d3afcb784455f9a9690baa4350b3919bd001f0c4c94b + languageName: node + linkType: hard + +"should-util@npm:^1.0.0": + version: 1.0.1 + resolution: "should-util@npm:1.0.1" + checksum: 1790719e05eae9edae86e44cbbad98529bd333df3f7cdfd63ea80acb6af718990e70abbc173aa9ccb93fff5ab6ee08d38412d707ff4003840be2256a278a61f3 + languageName: node + linkType: hard + +"should@npm:^13.2.1": + version: 13.2.3 + resolution: "should@npm:13.2.3" + dependencies: + should-equal: ^2.0.0 + should-format: ^3.0.3 + should-type: ^1.4.0 + should-type-adaptors: ^1.0.1 + should-util: ^1.0.0 + checksum: 99581d8615f6fb27cd23c9f431cfacef58d118a90d0cccf58775b90631a47441397cfbdcbe6379e2718e9e60f293e3dfc0e87857f4b5a36fe962814e46ab05fa + languageName: node + linkType: hard + "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -11168,6 +11797,13 @@ __metadata: languageName: node linkType: hard +"slugify@npm:~1.4.7": + version: 1.4.7 + resolution: "slugify@npm:1.4.7" + checksum: 27d31bac7bd28a7a702ab7b18996d2a41086d81a97cdc5487f131d7cedb009a745bcd10c8b263e48deb9f055e6c5a6b0bdb37f1156d5dd29b66f8ba981945302 + languageName: node + linkType: hard + "smart-buffer@npm:^4.2.0": version: 4.2.0 resolution: "smart-buffer@npm:4.2.0" @@ -11198,12 +11834,12 @@ __metadata: linkType: hard "socks@npm:^2.6.2": - version: 2.6.2 - resolution: "socks@npm:2.6.2" + version: 2.7.0 + resolution: "socks@npm:2.7.0" dependencies: - ip: ^1.1.5 + ip: ^2.0.0 smart-buffer: ^4.2.0 - checksum: 3a97a3fa751d43294c1861bc3519bf3e3ebccc9136e690df96ee7b496b280a42fae3ae39480928ba7d940c1644737eab126502d433af026b209c57f1ca6cb7b3 + checksum: 5cc9ea8d0f1fae370d7ac319b5dd8973fa24bc58d0194a8140687fd10be53a1f348b1b02b97932ce67ddae0edf459e5da0fe4b13cd5dd22ce46ac4d1a83239ec languageName: node linkType: hard @@ -11337,6 +11973,13 @@ __metadata: languageName: node linkType: hard +"stickyfill@npm:^1.1.1": + version: 1.1.1 + resolution: "stickyfill@npm:1.1.1" + checksum: 8f11804fd3bba852cf3277dc4d6366a2bd592d3f7f3d9ab30b7adab4190a20e1296960b5107257081645b0d28afcbbab9f80e347cc425f2cd72b0a4f6917b4ab + languageName: node + linkType: hard + "string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.0.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.2, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" @@ -11368,6 +12011,13 @@ __metadata: languageName: node linkType: hard +"string_decoder@npm:~0.10.x": + version: 0.10.31 + resolution: "string_decoder@npm:0.10.31" + checksum: 1c628d78f974aa7539c496029f48e7019acc32487fc695464f9d6bdfec98edd7d933a06b3216bc2016918f6e75074c611d84430a53cb0e43071597d6c1ac5e25 + languageName: node + linkType: hard + "string_decoder@npm:~1.1.1": version: 1.1.1 resolution: "string_decoder@npm:1.1.1" @@ -11434,6 +12084,15 @@ __metadata: languageName: node linkType: hard +"style-loader@npm:^3.3.1": + version: 3.3.1 + resolution: "style-loader@npm:3.3.1" + peerDependencies: + webpack: ^5.0.0 + checksum: b325f4ce5d0ee9797878d9db42a5c45ef6d757ad42de85bc550ef90c2fb78b762bbdff3214ddf1f4c8e1307fe1879fc47ea34ee48f8f56191309f8fc28f4d2b6 + languageName: node + linkType: hard + "style-to-object@npm:0.3.0, style-to-object@npm:^0.3.0": version: 0.3.0 resolution: "style-to-object@npm:0.3.0" @@ -11443,6 +12102,28 @@ __metadata: languageName: node linkType: hard +"styled-components@npm:^5.3.5": + version: 5.3.5 + resolution: "styled-components@npm:5.3.5" + dependencies: + "@babel/helper-module-imports": ^7.0.0 + "@babel/traverse": ^7.4.5 + "@emotion/is-prop-valid": ^1.1.0 + "@emotion/stylis": ^0.8.4 + "@emotion/unitless": ^0.7.4 + babel-plugin-styled-components: ">= 1.12.0" + css-to-react-native: ^3.0.0 + hoist-non-react-statics: ^3.0.0 + shallowequal: ^1.1.0 + supports-color: ^5.5.0 + peerDependencies: + react: ">= 16.8.0" + react-dom: ">= 16.8.0" + react-is: ">= 16.8.0" + checksum: b51d3e6d3476a7bcccaceb84a7d7e53d4e74822a887d4b58ad1a3018c7c0e733495f33a16fe84b2e9ac76552d45356c130ba2f9c629fe82c975a1486ee75d369 + languageName: node + linkType: hard + "stylehacks@npm:^5.1.0": version: 5.1.0 resolution: "stylehacks@npm:5.1.0" @@ -11455,7 +12136,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^5.3.0": +"supports-color@npm:^5.3.0, supports-color@npm:^5.5.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" dependencies: @@ -11513,6 +12194,29 @@ __metadata: languageName: node linkType: hard +"swagger2openapi@npm:^7.0.6": + version: 7.0.8 + resolution: "swagger2openapi@npm:7.0.8" + dependencies: + call-me-maybe: ^1.0.1 + node-fetch: ^2.6.1 + node-fetch-h2: ^2.3.0 + node-readfiles: ^0.2.0 + oas-kit-common: ^1.0.8 + oas-resolver: ^2.5.6 + oas-schema-walker: ^1.1.5 + oas-validator: ^5.0.8 + reftools: ^1.1.9 + yaml: ^1.10.0 + yargs: ^17.0.1 + bin: + boast: boast.js + oas-validate: oas-validate.js + swagger2openapi: swagger2openapi.js + checksum: 441a4d3a7d353f99395b14a0c8d6124be6390f2f8aa53336905e7314a7f80b66f5f2a40ac0dc2dbe2f7bc01f52a223a94f54a2ece345095fd3ad8ae8b03d688b + languageName: node + linkType: hard + "tapable@npm:^1.0.0": version: 1.1.3 resolution: "tapable@npm:1.1.3" @@ -11606,6 +12310,16 @@ __metadata: languageName: node linkType: hard +"through2@npm:^2.0.1": + version: 2.0.5 + resolution: "through2@npm:2.0.5" + dependencies: + readable-stream: ~2.3.6 + xtend: ~4.0.1 + checksum: cbfe5b57943fa12b4f8c043658c2a00476216d79c014895cef1ac7a1d9a8b31f6b438d0e53eecbb81054b93128324a82ecd59ec1a4f91f01f7ac113dcb14eade + languageName: node + linkType: hard + "thunky@npm:^1.0.2": version: 1.1.0 resolution: "thunky@npm:1.1.0" @@ -11932,6 +12646,13 @@ __metadata: languageName: node linkType: hard +"untildify@npm:^4.0.0": + version: 4.0.0 + resolution: "untildify@npm:4.0.0" + checksum: d758e624c707d49f76f7511d75d09a8eda7f2020d231ec52b67ff4896bcf7013be3f9522d8375f57e586e9a2e827f5641c7e06ee46ab9c435fc2b2b2e9de517a + languageName: node + linkType: hard + "update-browserslist-db@npm:^1.0.5": version: 1.0.5 resolution: "update-browserslist-db@npm:1.0.5" @@ -12003,6 +12724,13 @@ __metadata: languageName: node linkType: hard +"url-template@npm:^2.0.8": + version: 2.0.8 + resolution: "url-template@npm:2.0.8" + checksum: 56a15057eacbcf05d52b0caed8279c8451b3dd9d32856a1fdd91c6dc84dcb1646f12bafc756b7ade62ca5b1564da8efd7baac5add35868bafb43eb024c62805b + languageName: node + linkType: hard + "use-composed-ref@npm:^1.0.0": version: 1.2.1 resolution: "use-composed-ref@npm:1.2.1" @@ -12485,13 +13213,20 @@ __metadata: languageName: node linkType: hard -"xtend@npm:^4.0.0, xtend@npm:^4.0.1": +"xtend@npm:^4.0.0, xtend@npm:^4.0.1, xtend@npm:~4.0.1": version: 4.0.2 resolution: "xtend@npm:4.0.2" checksum: 366ae4783eec6100f8a02dff02ac907bf29f9a00b82ac0264b4d8b832ead18306797e283cf19de776538babfdcb2101375ec5646b59f08c52128ac4ab812ed0e languageName: node linkType: hard +"y18n@npm:^5.0.5": + version: 5.0.8 + resolution: "y18n@npm:5.0.8" + checksum: 4df2842c36e468590c3691c894bc9cdbac41f520566e76e24f59401ba7d8b4811eb1e34524d57e54bc6d864bcb66baab7ffd9ca42bf1eda596618f9162b91249 + languageName: node + linkType: hard + "yallist@npm:^4.0.0": version: 4.0.0 resolution: "yallist@npm:4.0.0" @@ -12499,6 +13234,13 @@ __metadata: languageName: node linkType: hard +"yaml-ast-parser@npm:0.0.43": + version: 0.0.43 + resolution: "yaml-ast-parser@npm:0.0.43" + checksum: 4d2f1e761067b2c6abdd882279a406f879258787af470a6d4a659cb79cb2ab056b870b25f1f80f46ed556e8b499d611d247806376f53edf3412f72c0a8ea2e98 + languageName: node + linkType: hard + "yaml@npm:^1.10.0, yaml@npm:^1.10.2, yaml@npm:^1.7.2": version: 1.10.2 resolution: "yaml@npm:1.10.2" @@ -12506,6 +13248,50 @@ __metadata: languageName: node linkType: hard +"yargs-parser@npm:^20.2.2": + version: 20.2.9 + resolution: "yargs-parser@npm:20.2.9" + checksum: 0685a8e58bbfb57fab6aefe03c6da904a59769bd803a722bb098bd5b0f29d274a1357762c7258fb487512811b8063fb5d2824a3415a0a4540598335b3b086c72 + languageName: node + linkType: hard + +"yargs-parser@npm:^21.0.0": + version: 21.0.1 + resolution: "yargs-parser@npm:21.0.1" + checksum: 384ca19e113a053bb7858cf47f891e630c10ea6ad91f9ad7cae84ea1cdfb09b155a2d0fa97b51116ee6f01e038faaa6c46964953afecd453fa64a761bb87475f + languageName: node + linkType: hard + +"yargs@npm:^16.1.0": + version: 16.2.0 + resolution: "yargs@npm:16.2.0" + dependencies: + cliui: ^7.0.2 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.0 + y18n: ^5.0.5 + yargs-parser: ^20.2.2 + checksum: b1dbfefa679848442454b60053a6c95d62f2d2e21dd28def92b647587f415969173c6e99a0f3bab4f1b67ee8283bf735ebe3544013f09491186ba9e8a9a2b651 + languageName: node + linkType: hard + +"yargs@npm:^17.0.1": + version: 17.5.1 + resolution: "yargs@npm:17.5.1" + dependencies: + cliui: ^7.0.2 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.3 + y18n: ^5.0.5 + yargs-parser: ^21.0.0 + checksum: 349c823b772bc5383d56684bca8615020ae5cc0b81bacafe1ef268b281ade93528da1982b0f2dd898e0c678932d9147b8a2e93e341733622773caf7048196de4 + languageName: node + linkType: hard + "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0" diff --git a/yarn.lock b/yarn.lock index a35b2b1fac..073b73c3a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6297,6 +6297,57 @@ __metadata: languageName: node linkType: hard +"@redocly/ajv@npm:^8.6.4": + version: 8.6.4 + resolution: "@redocly/ajv@npm:8.6.4" + dependencies: + fast-deep-equal: ^3.1.1 + json-schema-traverse: ^1.0.0 + require-from-string: ^2.0.2 + uri-js: ^4.2.2 + checksum: 07ffbd7480962506e696b675e4fb4b53d188e0871312a75be2d569f3ea081ed9982db6d4575f3c955adcad4742c2af45eb01dc5968937467658bec5500d6a47b + languageName: node + linkType: hard + +"@redocly/cli@npm:latest": + version: 1.0.0-beta.105 + resolution: "@redocly/cli@npm:1.0.0-beta.105" + dependencies: + "@redocly/openapi-core": 1.0.0-beta.105 + assert-node-version: ^1.0.3 + chokidar: ^3.5.1 + colorette: ^1.2.0 + glob: ^7.1.6 + glob-promise: ^3.4.0 + handlebars: ^4.7.6 + portfinder: ^1.0.26 + simple-websocket: ^9.0.0 + yargs: 17.0.1 + bin: + openapi: bin/cli.js + redocly: bin/cli.js + checksum: 1431b538c7e541cdbcf27784942a32f834f6430cf7385e3dae21f764bde4fb097ab6b69e209c3ee0ba01b2aca07f4edab3a4d46b7670677cb64aba42fc45d01e + languageName: node + linkType: hard + +"@redocly/openapi-core@npm:1.0.0-beta.105": + version: 1.0.0-beta.105 + resolution: "@redocly/openapi-core@npm:1.0.0-beta.105" + dependencies: + "@redocly/ajv": ^8.6.4 + "@types/node": ^14.11.8 + colorette: ^1.2.0 + js-levenshtein: ^1.1.6 + js-yaml: ^4.1.0 + lodash.isequal: ^4.5.0 + minimatch: ^5.0.1 + node-fetch: ^2.6.1 + pluralize: ^8.0.0 + yaml-ast-parser: 0.0.43 + checksum: e7ba983158815ead9bf40f813bef5beef6646564e31a50cde50400d19b56194a7af0ce50225080422efe63240167b572846bb894cb18a9c2972648784acf9b7c + languageName: node + linkType: hard + "@rollup/plugin-alias@npm:^3.1.1": version: 3.1.9 resolution: "@rollup/plugin-alias@npm:3.1.9" @@ -8805,6 +8856,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^14.11.8": + version: 14.18.22 + resolution: "@types/node@npm:14.18.22" + checksum: 6ade9441d9ad57c1a32351f57ca81a9f721809fb91574fd214fcedcf4d60c24194db412d35f3bdfa8ad94b2fbcc38aaa417e9602dbdb649d4c84d6a54342f924 + languageName: node + linkType: hard + "@types/node@npm:^14.17.14": version: 14.18.21 resolution: "@types/node@npm:14.18.21" @@ -10744,6 +10802,16 @@ __metadata: languageName: node linkType: hard +"assert-node-version@npm:^1.0.3": + version: 1.0.3 + resolution: "assert-node-version@npm:1.0.3" + dependencies: + expected-node-version: ^1.0.0 + semver: ^5.0.3 + checksum: 7feff6b946555ecd1e79a7b4f93272a320e8e323d9a0d207d20622b4d8fa8baef4bc2ebeb661762631ecffd21c92817b77da9dba2546704a922918431b8217e2 + languageName: node + linkType: hard + "assert-plus@npm:1.0.0, assert-plus@npm:^1.0.0": version: 1.0.0 resolution: "assert-plus@npm:1.0.0" @@ -10842,6 +10910,15 @@ __metadata: languageName: node linkType: hard +"async@npm:^2.6.2": + version: 2.6.4 + resolution: "async@npm:2.6.4" + dependencies: + lodash: ^4.17.14 + checksum: 0ebb3273ef96513389520adc88e0d3c45e523d03653cc9b66f5c46f4239444294899bfd13d2b569e7dbfde7da2235c35cf5fd3ece9524f935d41bbe4efccdad0 + languageName: node + linkType: hard + "async@npm:^3.2.3": version: 3.2.4 resolution: "async@npm:3.2.4" @@ -13324,7 +13401,7 @@ __metadata: languageName: node linkType: hard -"colorette@npm:^1.2.2, colorette@npm:^1.4.0": +"colorette@npm:^1.2.0, colorette@npm:^1.2.2, colorette@npm:^1.4.0": version: 1.4.0 resolution: "colorette@npm:1.4.0" checksum: 4955c8f7daafca8ae7081d672e4bd89d553bd5782b5846d5a7e05effe93c2f15f7e9c0cb46f341b59f579a39fcf436241ff79594899d75d5f3460c03d607fe9e @@ -14763,7 +14840,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:^3.0.0, debug@npm:^3.0.1, debug@npm:^3.1.0, debug@npm:^3.2.7": +"debug@npm:^3.0.0, debug@npm:^3.0.1, debug@npm:^3.1.0, debug@npm:^3.1.1, debug@npm:^3.2.7": version: 3.2.7 resolution: "debug@npm:3.2.7" dependencies: @@ -16955,6 +17032,13 @@ __metadata: languageName: node linkType: hard +"expected-node-version@npm:^1.0.0": + version: 1.0.2 + resolution: "expected-node-version@npm:1.0.2" + checksum: a10609c3cba8b8eaabff81cfe1bee9c93a02dad4380289eaa88c2776c9ff321b4ac1523773e380788ba103359dab443fc895ca461b7b82902a28c1033286b34a + languageName: node + linkType: hard + "express-graphql@npm:^0.12.0": version: 0.12.0 resolution: "express-graphql@npm:0.12.0" @@ -24177,6 +24261,13 @@ __metadata: languageName: node linkType: hard +"lodash.isequal@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.isequal@npm:4.5.0" + checksum: dfdb2356db19631a4b445d5f37868a095e2402292d59539a987f134a8778c62a2810c2452d11ae9e6dcac71fc9de40a6fedcb20e2952a15b431ad8b29e50e28f + languageName: node + linkType: hard + "lodash.isinteger@npm:^4.0.4": version: 4.0.4 resolution: "lodash.isinteger@npm:4.0.4" @@ -28972,6 +29063,13 @@ __metadata: languageName: node linkType: hard +"pluralize@npm:^8.0.0": + version: 8.0.0 + resolution: "pluralize@npm:8.0.0" + checksum: 2044cfc34b2e8c88b73379ea4a36fc577db04f651c2909041b054c981cd863dd5373ebd030123ab058d194ae615d3a97cfdac653991e499d10caf592e8b3dc33 + languageName: node + linkType: hard + "pn@npm:^1.1.0": version: 1.1.0 resolution: "pn@npm:1.1.0" @@ -29027,6 +29125,17 @@ __metadata: languageName: node linkType: hard +"portfinder@npm:^1.0.26": + version: 1.0.28 + resolution: "portfinder@npm:1.0.28" + dependencies: + async: ^2.6.2 + debug: ^3.1.1 + mkdirp: ^0.5.5 + checksum: fefd3d65a6464b498e0e9b4a4b82f29489441bb1892a3350403cfdf6e591e583d9e75bac1c6ae8ca2cdf1a942ae18890831a0a855bb1bb977678acdf9e5a560f + languageName: node + linkType: hard + "posix-character-classes@npm:^0.1.0": version: 0.1.1 resolution: "posix-character-classes@npm:0.1.1" @@ -31889,6 +31998,7 @@ __metadata: "@babel/runtime": ^7.11.2 "@changesets/changelog-github": ^0.4.5 "@changesets/cli": ^2.23.0 + "@redocly/cli": latest "@typescript-eslint/eslint-plugin": ^5.0.0 "@typescript-eslint/parser": ^5.0.0 axios: ^0.21.1 @@ -32214,7 +32324,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:2 || 3 || 4 || 5, semver@npm:2.x || 3.x || 4 || 5, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.5.1, semver@npm:^5.6.0, semver@npm:^5.7.0, semver@npm:^5.7.1": +"semver@npm:2 || 3 || 4 || 5, semver@npm:2.x || 3.x || 4 || 5, semver@npm:^5.0.3, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.5.1, semver@npm:^5.6.0, semver@npm:^5.7.0, semver@npm:^5.7.1": version: 5.7.1 resolution: "semver@npm:5.7.1" bin: @@ -32684,6 +32794,19 @@ __metadata: languageName: node linkType: hard +"simple-websocket@npm:^9.0.0": + version: 9.1.0 + resolution: "simple-websocket@npm:9.1.0" + dependencies: + debug: ^4.3.1 + queue-microtask: ^1.2.2 + randombytes: ^2.1.0 + readable-stream: ^3.6.0 + ws: ^7.4.2 + checksum: fc245963d54d5a6647d407b9f6ad46da14e90479e0f150c62a94a22fd17e578412f110678a70641fe0a849165051327243edbfe9a886cb19ddf94154881cde5c + languageName: node + linkType: hard + "simplebar-react@npm:^1.0.0-alpha.6": version: 1.2.3 resolution: "simplebar-react@npm:1.2.3" @@ -37148,6 +37271,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:^7.4.2": + version: 7.5.9 + resolution: "ws@npm:7.5.9" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: aec4ef4eb65821a7dde7b44790f8699cfafb7978c9b080f6d7a98a7f8fc0ce674c027073a78574c94786ba7112cc90fa2cc94fc224ceba4d4b1030cff9662494 + languageName: node + linkType: hard + "ws@npm:^8.2.3": version: 8.8.0 resolution: "ws@npm:8.8.0" @@ -37355,6 +37493,13 @@ __metadata: languageName: node linkType: hard +"yaml-ast-parser@npm:0.0.43": + version: 0.0.43 + resolution: "yaml-ast-parser@npm:0.0.43" + checksum: 4d2f1e761067b2c6abdd882279a406f879258787af470a6d4a659cb79cb2ab056b870b25f1f80f46ed556e8b499d611d247806376f53edf3412f72c0a8ea2e98 + languageName: node + linkType: hard + "yaml-loader@npm:^0.6.0": version: 0.6.0 resolution: "yaml-loader@npm:0.6.0" @@ -37406,6 +37551,21 @@ __metadata: languageName: node linkType: hard +"yargs@npm:17.0.1": + version: 17.0.1 + resolution: "yargs@npm:17.0.1" + dependencies: + cliui: ^7.0.2 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.0 + y18n: ^5.0.5 + yargs-parser: ^20.2.2 + checksum: 3eb39d6dd477331826ef0a4732e05777b1f3ad85a4c1e44155f278369038206e504d3a36ec12470e9a9364117685f1d5a0b01f954a1bb7edb47ec34eda254e1c + languageName: node + linkType: hard + "yargs@npm:^14.2.2": version: 14.2.3 resolution: "yargs@npm:14.2.3"