diff --git a/.github/workflows/generate-reference.yml b/.github/workflows/generate-reference.yml new file mode 100644 index 0000000000..3410689cc2 --- /dev/null +++ b/.github/workflows/generate-reference.yml @@ -0,0 +1,43 @@ +name: Generate References +on: + push: + branches: + - 'master' + paths: + - packages/medusa/src/services/** +jobs: + services: + 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: Bootstrap packages + uses: ./.github/actions/cache-bootstrap + with: + extension: unit-tests + + - name: Build Packages + run: yarn build + + - name: Generate Services Reference + run: yarn generate:services + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Automatically Generated Services Reference + file_pattern: docs/content/* + skip_dirty_check: false diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000000..65496704d2 --- /dev/null +++ b/.yarnrc @@ -0,0 +1,5 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +yarn-path ".yarn/releases/yarn-1.19.0.cjs" diff --git a/docs/api/admin-spec3.json b/docs/api/admin-spec3.json index 9c76462bd2..af5df7beb5 100644 --- a/docs/api/admin-spec3.json +++ b/docs/api/admin-spec3.json @@ -63,6 +63,10 @@ { "name": "Product Variant", "x-resourceId": "product_variant" + }, + { + "name": "OAuth", + "x-resourceId": "OAuth" } ], "servers": [ @@ -71,14 +75,41 @@ } ], "paths": { - "/auth": { + "/apps": { "post": { - "operationId": "PostAuth", - "summary": "Authenticate a User", - "description": "Logs a User in and authorizes them to manage Store settings.", - "parameters": [], + "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": [ - "Auth" + "Apps" ], "responses": { "200": { @@ -87,8 +118,61 @@ "application/json": { "schema": { "properties": { - "user": { - "$ref": "#/components/schemas/user" + "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" + } + } + } + } + } + } + } + } + }, + "/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" } } } @@ -102,297 +186,16 @@ "schema": { "type": "object", "required": [ - "email", - "password" + "name" ], "properties": { - "email": { + "name": { "type": "string", - "description": "The User's email." - }, - "password": { - "type": "string", - "description": "The User's password." - } - } - } - } - } - } - }, - "get": { - "operationId": "GetAuth", - "summary": "Get Session", - "description": "Gets the currently logged in User.", - "tags": [ - "Auth" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "user": { - "$ref": "#/components/schemas/user" - } - } - } - } - } - } - } - } - }, - "/customers": { - "post": { - "operationId": "PostCustomers", - "summary": "Create a Customer", - "description": "Creates a Customer.", - "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." - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCustomers", - "summary": "List Customers", - "description": "Retrieves a list of Customers.", - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers/{id}": { - "get": { - "operationId": "GetCustomersCustomer", - "summary": "Retrieve a Customer", - "description": "Retrieves a Customer.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "PostCustomersCustomer", - "summary": "Update a Customer", - "description": "Updates a Customer.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "email": { - "type": "string", - "description": "The Customer's email. Only providable if user not registered." - }, - "first_name": { - "type": "string", - "description": "The Customer's first name." - }, - "last_name": { - "type": "string", - "description": "The Customer's last name." - }, - "phone": { - "description": "The Customer's phone number.", - "type": "object" - } - } - } - } - } - }, - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/collections": { - "post": { - "operationId": "PostCollections", - "summary": "Create a Product Collection", - "description": "Creates a Product Collection.", - "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." + "description": "Name of the customer group" }, "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" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "GetCollections", - "summary": "List Product Collections", - "description": "Retrieve a list of Product Collection.", - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } + "type": "object", + "description": "Metadata for the customer." } } } @@ -401,24 +204,25 @@ } } }, - "/collections/{id}": { + "/customer-groups/{id}": { "delete": { - "operationId": "DeleteCollectionsCollection", - "summary": "Delete a Product Collection", - "description": "Deletes a Product Collection.", + "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 Collection.", + "description": "The id of the Customer Group", "schema": { "type": "string" } } ], "tags": [ - "Collection" + "CustomerGroup" ], "responses": { "200": { @@ -429,7 +233,7 @@ "properties": { "id": { "type": "string", - "description": "The id of the deleted Collection" + "description": "The id of the deleted customer group." }, "object": { "type": "string", @@ -445,23 +249,24 @@ } } }, - "get": { - "operationId": "GetCollectionsCollection", - "summary": "Retrieve a Product Collection", - "description": "Retrieves a Product Collection.", + "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 Product Collection", + "description": "The id of the customer group.", "schema": { "type": "string" } } ], "tags": [ - "Collection" + "CustomerGroup" ], "responses": { "200": { @@ -470,55 +275,58 @@ "application/json": { "schema": { "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" + "customer_group": { + "$ref": "#/components/schemas/customer_group" } } } } } } - } - }, - "post": { - "operationId": "PostCollectionsCollection", - "summary": "Update a Product Collection", - "description": "Updates a Product Collection.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Collection.", - "schema": { - "type": "string" - } - } - ], + }, "requestBody": { "content": { "application/json": { "schema": { + "type": "object", + "required": [ + "name" + ], "properties": { - "title": { + "name": { "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." + "description": "Name of the customer group" }, "metadata": { - "description": "An optional set of key-value pairs to hold additional information.", - "type": "object" + "type": "object", + "description": "Metadata for the customer." } } } } } - }, + } + } + }, + "/customer-group/{id}": { + "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": [ - "Collection" + "CustomerGroup" ], "responses": { "200": { @@ -527,8 +335,8 @@ "application/json": { "schema": { "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" + "customer_group": { + "$ref": "#/components/schemas/customer_group" } } } @@ -543,6 +351,7 @@ "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", @@ -586,6 +395,7 @@ "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": [ { @@ -630,9 +440,55 @@ }, "/discounts/{id}/products/{product_id}": { "post": { + "operationId": "PostDiscountsDiscountProductsProduct", + "summary": "Adds Product availability", + "description": "Adds a Product to the list of Products that a Discount can be used for.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The id of the Discount.", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "product_id", + "required": true, + "description": "The id of the Product.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Discount" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "discount": { + "$ref": "#/components/schemas/discount" + } + } + } + } + } + } + } + }, + "delete": { "operationId": "DeleteDiscountsDiscountProductsProduct", "summary": "Remove Product availability", "description": "Removes a Product from the list of Products that a Discount can be used for.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -678,11 +534,16 @@ "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.", "requestBody": { "content": { "application/json": { "schema": { + "required": [ + "code", + "rule" + ], "properties": { "code": { "type": "string", @@ -757,7 +618,58 @@ "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 results.", + "schema": { + "type": "string" + } + }, + { + "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" + } + }, + { + "in": "query", + "name": "offset", + "description": "The offset of items in response", + "schema": { + "type": "number" + } + }, + { + "in": "query", + "name": "expand", + "description": "Comma separated list of relations to include in the results.", + "schema": { + "type": "string" + } + } + ], "tags": [ "Discount" ], @@ -784,6 +696,7 @@ "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", @@ -843,6 +756,7 @@ "operationId": "DeleteDiscountsDiscount", "summary": "Delete a Discount", "description": "Deletes a Discount.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -886,6 +800,7 @@ "operationId": "GetDiscountsDiscount", "summary": "Retrieve a Discount", "description": "Retrieves a Discount", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -921,6 +836,7 @@ "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", @@ -973,6 +889,10 @@ "items": { "type": "string" } + }, + "metadata": { + "description": "An object containing metadata of the discount", + "type": "object" } } } @@ -1005,6 +925,7 @@ "operationId": "DeleteDiscountsDiscountDynamicCodesCode", "summary": "Delete a dynamic code", "description": "Deletes a dynamic code from a Discount.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1051,6 +972,7 @@ "operationId": "GetDiscountsDiscountCode", "summary": "Retrieve a Discount by code", "description": "Retrieves a Discount by its discount code", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1083,15 +1005,469 @@ } } }, + "/collections/{id}/products/batch": { + "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": { + "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" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Collection" + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "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": { + "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" + } + } + } + } + } + } + } + } + }, + "tags": [ + "Collection" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/collections": { + "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" + } + } + } + } + } + } + } + }, + "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": "string" + } + }, + { + "in": "query", + "name": "offset", + "description": "The offset of collections to return.", + "schema": { + "type": "string" + } + }, + { + "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": "deleted_at", + "description": "Date comparison for when resulting collections was deleted, i.e. less than, greater than etc.", + "schema": { + "type": "object" + } + }, + { + "in": "query", + "name": "created_at", + "description": "Date comparison for when resulting collections was created, i.e. less than, greater than etc.", + "schema": { + "type": "object" + } + }, + { + "in": "query", + "name": "updated_at", + "description": "Date comparison for when resulting collections was updated, i.e. less than, greater than etc.", + "schema": { + "type": "object" + } + } + ], + "tags": [ + "Collection" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "collection": { + "$ref": "#/components/schemas/product_collection" + } + } + } + } + } + } + } + } + }, + "/collections/{id}": { + "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." + }, + "deleted": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "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" + } + } + } + } + } + } + } + }, + "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" + } + } + } + } + } + } + } + } + }, + "/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" + } + } + } + } + } + } + } + } + }, "/draft-orders": { "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", @@ -1222,6 +1598,7 @@ "operationId": "GetDraftOrders", "summary": "List Draft Orders", "description": "Retrieves an list of Draft Orders", + "x-authenticated": true, "tags": [ "Draft Order" ], @@ -1248,10 +1625,25 @@ "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.", @@ -1304,6 +1696,7 @@ "operationId": "DeleteDraftOrdersDraftOrder", "summary": "Delete a Draft Order", "description": "Deletes a Draft Order", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1347,6 +1740,7 @@ "operationId": "GetDraftOrdersDraftOrder", "summary": "Retrieve a Draft Order", "description": "Retrieves a Draft Order.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1384,6 +1778,7 @@ "operationId": "DeleteDraftOrdersDraftOrderLineItemsItem", "summary": "Delete a Line Item", "description": "Removes a Line Item from a Draft Order.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1428,6 +1823,27 @@ "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": { @@ -1480,6 +1896,7 @@ "summary": "Registers a payment for a Draft Order", "operationId": "PostDraftOrdersDraftOrderRegisterPayment", "description": "Registers a payment for a Draft Order.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1517,6 +1934,7 @@ "operationId": "PostDraftOrdersDraftOrder", "summary": "Update a Draft Order\"", "description": "Updates a Draft Order.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1603,11 +2021,236 @@ } } }, + "/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/{id}": { + "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" + } + } + ], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + }, + "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", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "email": { + "type": "string", + "description": "The Customer's email. Only providable if user not registered." + }, + "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." + }, + "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": { + "type": "object", + "description": "Metadata for the customer." + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, "/gift-cards": { "post": { "operationId": "PostGiftCards", "summary": "Create a Gift Card", "description": "Creates a Gift Card that can redeemed by its unique code. The Gift Card is only valid within 1 region.", + "x-authenticated": true, "requestBody": { "content": { "application/json": { @@ -1666,6 +2309,7 @@ "operationId": "GetGiftCards", "summary": "List Gift Cards", "description": "Retrieves a list of Gift Cards.", + "x-authenticated": true, "tags": [ "Gift Card" ], @@ -1695,6 +2339,7 @@ "operationId": "DeleteGiftCardsGiftCard", "summary": "Delete a Gift Card", "description": "Deletes a Gift Card", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1738,6 +2383,7 @@ "operationId": "GetGiftCardsGiftCard", "summary": "Retrieve a Gift Card", "description": "Retrieves a Gift Card.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1773,6 +2419,7 @@ "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", @@ -1839,11 +2486,188 @@ } } }, + "/invites/accept": { + "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" + } + } + } + } + } + } + } + }, + "tags": [ + "Invites" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/invites": { + "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" + }, + "role": { + "description": "The role of the user to be created.", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Invites" + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "get": { + "operationId": "GetInvites", + "summary": "Lists all Invites", + "description": "Lists all Invites", + "x-authenticated": true, + "tags": [ + "Invites" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "invites": { + "type": "array", + "items": { + "$ref": "#/components/schemas/invite" + } + } + } + } + } + } + } + } + } + }, + "/invites/{invite_id}": { + "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": [ + "Invites" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/invites/{invite_id}/resend": { + "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": [ + "Invites" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/notes": { "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": { @@ -1889,7 +2713,40 @@ "get": { "operationId": "GetNotes", "summary": "List Notes", + "x-authenticated": true, "description": "Retrieves a list of notes", + "parameters": [ + { + "in": "path", + "name": "limit", + "required": true, + "description": "The number of notes to get", + "schema": { + "type": "number", + "default": "" + } + }, + { + "in": "path", + "name": "offset", + "required": true, + "description": "The offset at which to get notes", + "schema": { + "type": "number", + "default": "" + } + }, + { + "in": "path", + "name": "resource_id", + "required": true, + "description": "The id which the notes belongs to", + "schema": { + "type": "string", + "default": "" + } + } + ], "tags": [ "Note" ], @@ -1919,6 +2776,7 @@ "operationId": "DeleteNotesNote", "summary": "Deletes a Note", "description": "Deletes a Note.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1956,9 +2814,10 @@ } }, "get": { - "operationId": "GetNoteNote", + "operationId": "GetNotesNote", "summary": "Get Note", "description": "Retrieves a single note using its id", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -1993,6 +2852,7 @@ "post": { "operationId": "PostNotesNote", "summary": "Updates a Note", + "x-authenticated": true, "description": "Updates a Note associated with some resource", "parameters": [ { @@ -2009,6 +2869,9 @@ "content": { "application/json": { "schema": { + "required": [ + "value" + ], "properties": { "value": { "type": "string", @@ -2045,6 +2908,79 @@ "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" ], @@ -2074,6 +3010,7 @@ "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", @@ -2085,6 +3022,20 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "to": { + "description": "The address or user identifier that the Notification was sent to", + "type": "string" + } + } + } + } + } + }, "tags": [ "Notification" ], @@ -2106,11 +3057,89 @@ } } }, + "/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" + } + } + } + } + } + } + } + } + }, "/orders/{id}/shipping-methods": { "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", @@ -2171,11 +3200,50 @@ } } }, + "/orders/{id}/archive": { + "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" + } + } + } + } + } + } + } + } + }, "/orders/{id}/claims/{claim_id}/cancel": { "post": { "operationId": "PostOrdersClaimCancel", "summary": "Cancels a Claim", "description": "Cancels a Claim", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2222,6 +3290,7 @@ "operationId": "PostOrdersClaimFulfillmentsCancel", "summary": "Cancels a fulfilmment related to a Claim", "description": "Registers a Fulfillment as canceled.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2277,6 +3346,7 @@ "operationId": "PostOrdersSwapFulfillmentsCancel", "summary": "Cancels a fulfilmment related to a Swap", "description": "Registers a Fulfillment as canceled.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2332,6 +3402,7 @@ "operationId": "PostOrdersOrderFulfillmentsCancel", "summary": "Cancels a fulfilmment", "description": "Registers a Fulfillment as canceled.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2378,6 +3449,7 @@ "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", @@ -2415,6 +3487,7 @@ "operationId": "PostOrdersSwapCancel", "summary": "Cancels a Swap", "description": "Cancels a Swap", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2461,6 +3534,45 @@ "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" + } + } + } + } + } + } + } + } + }, + "/orders/{id}/complete": { + "post": { + "operationId": "PostOrdersOrderComplete", + "summary": "Complete an Order", + "description": "Completes an Order", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2498,6 +3610,7 @@ "operationId": "PostOrdersOrderClaimsClaimShipments", "summary": "Create Claim Shipment", "description": "Registers a Claim Fulfillment as shipped.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2522,6 +3635,9 @@ "content": { "application/json": { "schema": { + "required": [ + "fulfillment_id" + ], "properties": { "fulfillment_id": { "description": "The id of the Fulfillment.", @@ -2565,6 +3681,7 @@ "operationId": "PostOrdersOrderClaims", "summary": "Create a Claim", "description": "Creates a Claim.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2580,6 +3697,10 @@ "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.", @@ -2729,6 +3850,7 @@ "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", @@ -2744,6 +3866,9 @@ "content": { "application/json": { "schema": { + "required": [ + "items" + ], "properties": { "items": { "description": "The Line Items to include in the Fulfillment.", @@ -2795,11 +3920,347 @@ } } }, + "/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", "summary": "Create a Shipment", "description": "Registers a Fulfillment as shipped.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2815,6 +4276,9 @@ "content": { "application/json": { "schema": { + "required": [ + "fulfillment_id" + ], "properties": { "fulfillment_id": { "description": "The id of the Fulfillment.", @@ -2862,6 +4326,7 @@ "operationId": "PostOrdersOrderSwapsSwapShipments", "summary": "Create Swap Shipment", "description": "Registers a Swap Fulfillment as shipped.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -2886,6 +4351,9 @@ "content": { "application/json": { "schema": { + "required": [ + "fulfillment_id" + ], "properties": { "fulfillment_id": { "description": "The id of the Fulfillment.", @@ -2933,6 +4401,7 @@ "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", @@ -2948,11 +4417,18 @@ "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.", @@ -2983,6 +4459,10 @@ "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.", @@ -2999,6 +4479,10 @@ "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.", @@ -3050,6 +4534,7 @@ "operationId": "DeleteOrdersOrderMetadataKey", "summary": "Delete Metadata", "description": "Deletes a metadata key.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3096,6 +4581,7 @@ "operationId": "PostOrdersOrderClaimsClaimFulfillments", "summary": "Create a Claim Fulfillment", "description": "Creates a Fulfillment for a Claim.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3160,6 +4646,7 @@ "operationId": "PostOrdersOrderSwapsSwapFulfillments", "summary": "Create a Swap Fulfillment", "description": "Creates a Fulfillment for a Swap.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3224,6 +4711,7 @@ "operationId": "GetOrdersOrder", "summary": "Retrieve an Order", "description": "Retrieves an Order", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3254,42 +4742,12 @@ } } } - } - }, - "/orders": { - "get": { - "operationId": "GetOrders", - "summary": "List Orders", - "description": "Retrieves a list of Orders", - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "orders": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - } - }, - "/orders/{id}/swaps/{swap_id}/process-payment": { + }, "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.", + "operationId": "PostOrdersOrder", + "summary": "Update an order", + "description": "Updates and order", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3299,61 +4757,6 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "swap_id", - "required": true, - "description": "The id of the Swap.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Order" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "order": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/orders/{id}/swaps/{swap_id}/receive": { - "post": { - "operationId": "PostOrdersOrderSwapsSwapReceive", - "summary": "Receive a Swap", - "description": "Registers a Swap as received.", - "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": { @@ -3361,21 +4764,94 @@ "application/json": { "schema": { "properties": { + "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 that have been received.", + "description": "The Line Items for the order", "type": "array", "items": { - "properties": { - "item_id": { - "description": "The id of the Line Item.", - "type": "string" - }, - "quantity": { - "description": "The quantity of the Line Item.", - "type": "integer" - } + "$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", + "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" + }, + "description": "Items to ship" + } + } + }, + "no_notification": { + "description": "A flag to indicate if no notifications should be emitted related to the updated order.", + "type": "boolean" } } } @@ -3403,11 +4879,59 @@ } } }, + "/orders/{id}/swaps/{swap_id}/process-payment": { + "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": [ + "Order" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "order": { + "$ref": "#/components/schemas/order" + } + } + } + } + } + } + } + } + }, "/orders/{id}/refunds": { "post": { "operationId": "PostOrdersOrderRefunds", "summary": "Create a Refund", "description": "Issues a Refund.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3475,6 +4999,7 @@ "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", @@ -3490,6 +5015,9 @@ "content": { "application/json": { "schema": { + "required": [ + "items" + ], "properties": { "items": { "description": "The Line Items that will be returned.", @@ -3572,6 +5100,7 @@ "operationId": "PostOrdersOrderClaimsClaim", "summary": "Update a Claim", "description": "Updates a Claim.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -3698,10 +5227,88 @@ } } }, + "/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" + } + } + } + } + } + } + } + } + }, "/products/{id}/options": { "post": { "operationId": "PostProductsProductOptions", "summary": "Add an Option", + "x-authenticated": true, "description": "Adds a Product Option to a Product", "parameters": [ { @@ -3718,6 +5325,9 @@ "content": { "application/json": { "schema": { + "required": [ + "title" + ], "properties": { "title": { "description": "The title the Product Option will be identified by i.e. \"Size\"", @@ -3753,11 +5363,17 @@ "post": { "operationId": "PostProducts", "summary": "Create a Product", + "x-authenticated": true, "description": "Creates a Product", "requestBody": { "content": { "application/json": { "schema": { + "required": [ + "title", + "subtitle", + "description" + ], "properties": { "title": { "description": "The title of the Product", @@ -4007,6 +5623,168 @@ "operationId": "GetProducts", "summary": "List Product", "description": "Retrieves a list of Product", + "x-authenticated": true, + "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": "status", + "style": "form", + "explode": false, + "description": "Status to search for", + "schema": { + "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": "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": "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.", + "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": "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" + } + }, + { + "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" ], @@ -4048,6 +5826,7 @@ "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", @@ -4063,6 +5842,11 @@ "content": { "application/json": { "schema": { + "required": [ + "title", + "prices", + "options" + ], "properties": { "title": { "description": "The title to identify the Product Variant by.", @@ -4199,6 +5983,7 @@ "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", @@ -4239,6 +6024,7 @@ "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", @@ -4294,6 +6080,7 @@ "operationId": "PostProductsProductOptionsOption", "summary": "Update a Product Option.", "description": "Updates a Product Option", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4318,6 +6105,9 @@ "content": { "application/json": { "schema": { + "required": [ + "title" + ], "properties": { "title": { "description": "The title of the Product Option", @@ -4354,6 +6144,7 @@ "operationId": "DeleteProductsProduct", "summary": "Delete a Product", "description": "Deletes a Product and it's associated Product Variants.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4397,6 +6188,7 @@ "operationId": "GetProductsProduct", "summary": "Retrieve a Product", "description": "Retrieves a Product.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4432,6 +6224,7 @@ "operationId": "PostProductsProduct", "summary": "Update a Product", "description": "Updates a Product", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4698,6 +6491,7 @@ "operationId": "DeleteProductsProductVariantsVariant", "summary": "Delete a Product Variant", "description": "Deletes a Product Variant.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4750,6 +6544,7 @@ "operationId": "PostProductsProductVariantsVariant", "summary": "Update a Product Variant", "description": "Update a Product Variant.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4912,6 +6707,7 @@ "operationId": "GetProductsTypes", "summary": "List Product Types", "description": "Retrieves a list of Product Types.", + "x-authenticated": true, "tags": [ "Product" ], @@ -4936,11 +6732,72 @@ } } }, + "/products/{id}/metadata": { + "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" + } + } + } + } + } + } + } + } + }, "/regions/{id}/countries": { "post": { "operationId": "PostRegionsRegionCountries", "summary": "Add Country", "description": "Adds a Country to the list of Countries in a Region", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -4956,6 +6813,9 @@ "content": { "application/json": { "schema": { + "required": [ + "country_code" + ], "properties": { "country_code": { "description": "The 2 character ISO code for the Country.", @@ -4992,6 +6852,7 @@ "operationId": "PostRegionsRegionFulfillmentProviders", "summary": "Add Fulfillment Provider", "description": "Adds a Fulfillment Provider to a Region", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5007,6 +6868,9 @@ "content": { "application/json": { "schema": { + "required": [ + "provider_id" + ], "properties": { "provider_id": { "description": "The id of the Fulfillment Provider to add.", @@ -5043,6 +6907,7 @@ "operationId": "PostRegionsRegionPaymentProviders", "summary": "Add Payment Provider", "description": "Adds a Payment Provider to a Region", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5058,6 +6923,9 @@ "content": { "application/json": { "schema": { + "required": [ + "provider_id" + ], "properties": { "provider_id": { "description": "The id of the Payment Provider to add.", @@ -5094,10 +6962,16 @@ "operationId": "PostRegions", "summary": "Create a Region", "description": "Creates a Region", + "x-authenticated": true, "requestBody": { "content": { "application/json": { "schema": { + "required": [ + "name", + "currency_code", + "tax_rate" + ], "properties": { "name": { "description": "The name of the Region", @@ -5165,6 +7039,54 @@ "operationId": "GetRegions", "summary": "List Regions", "description": "Retrieves a list of Regions.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer" + }, + "required": false, + "description": "limit the number of regions in response" + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer" + }, + "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" ], @@ -5194,6 +7116,7 @@ "operationId": "DeleteRegionsRegionMetadataKey", "summary": "Delete Metadata", "description": "Deletes a metadata key.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5240,6 +7163,7 @@ "operationId": "DeleteRegionsRegion", "summary": "Delete a Region", "description": "Deletes a Region.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5283,6 +7207,7 @@ "operationId": "GetRegionsRegion", "summary": "Retrieve a Region", "description": "Retrieves a Region.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5318,6 +7243,7 @@ "operationId": "PostRegionsRegion", "summary": "Update a Region", "description": "Updates a Region", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5342,6 +7268,18 @@ "description": "The 3 character ISO currency code to use for the Region.", "type": "string" }, + "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" @@ -5402,6 +7340,7 @@ "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", @@ -5414,7 +7353,7 @@ } ], "tags": [ - "Product" + "Region" ], "responses": { "200": { @@ -5426,7 +7365,16 @@ "fulfillment_options": { "type": "array", "items": { - "type": "object" + "properties": { + "provider_id": { + "type": "string", + "description": "id of the fulfillment provider" + }, + "options": { + "type": "object", + "description": "fulfillment provider options" + } + } } } } @@ -5441,6 +7389,7 @@ "delete": { "operationId": "PostRegionsRegionCountriesCountry", "summary": "Remove Country", + "x-authenticated": true, "description": "Removes a Country from the list of Countries in a Region", "parameters": [ { @@ -5488,6 +7437,7 @@ "operationId": "PostRegionsRegionFulfillmentProvidersProvider", "summary": "Remove Fulfillment Provider", "description": "Removes a Fulfillment Provider.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5534,6 +7484,7 @@ "operationId": "PostRegionsRegionPaymentProvidersProvider", "summary": "Remove Payment Provider", "description": "Removes a Payment Provider.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5575,15 +7526,81 @@ } } }, + "/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", "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.", @@ -5593,6 +7610,10 @@ "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" @@ -5630,6 +7651,7 @@ "operationId": "GetReturnReasons", "summary": "List Return Reasons", "description": "Retrieves a list of Return Reasons.", + "x-authenticated": true, "tags": [ "Return Reason" ], @@ -5654,11 +7676,12 @@ } } }, - "/return-reason/{id}": { + "/return-reasons/{id}": { "delete": { "operationId": "DeleteReturnReason", "summary": "Delete a return reason", "description": "Deletes a return reason.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5697,13 +7720,12 @@ } } } - } - }, - "/return-reasons/{id}": { + }, "get": { "operationId": "GetReturnReasonsReason", "summary": "Retrieve a Return Reason", "description": "Retrieves a Return Reason.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5739,6 +7761,7 @@ "operationId": "PostReturnReasonsReason", "summary": "Update a Return Reason", "description": "Updates a Return Reason", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5759,10 +7782,6 @@ "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" @@ -5797,11 +7816,168 @@ } } }, + "/returns/{id}/cancel": { + "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": { + "return": { + "$ref": "#/components/schemas/order" + } + } + } + } + } + } + } + } + }, + "/returns": { + "get": { + "operationId": "GetReturns", + "summary": "List Returns", + "description": "Retrieves a list of Returns", + "parameters": [ + { + "in": "path", + "name": "limit", + "required": true, + "description": "The upper limit for the amount of responses returned.", + "schema": { + "type": "number" + } + }, + { + "in": "path", + "name": "offset", + "required": true, + "description": "The offset of the list returned.", + "schema": { + "type": "number" + } + } + ], + "tags": [ + "Return" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "returns": { + "type": "array", + "items": { + "$ref": "#/components/schemas/return" + } + } + } + } + } + } + } + } + } + }, + "/returns/{id}/receive": { + "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": { + "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": "integer" + } + } + } + } + } + }, + "tags": [ + "Return" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "return": { + "$ref": "#/components/schemas/return" + } + } + } + } + } + } + } + } + }, "/shipping-options": { "post": { "operationId": "PostShippingOptions", "summary": "Create Shipping Option", "description": "Creates a Shipping Option", + "x-authenticated": true, "requestBody": { "content": { "application/json": { @@ -5862,6 +8038,14 @@ "is_return": { "description": "Whether the Shipping Option defines a return shipment.", "type": "boolean" + }, + "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" } } } @@ -5892,6 +8076,33 @@ "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 to fetch options from" + }, + { + "in": "query", + "name": "is_return", + "schema": { + "type": "boolean" + }, + "description": "Flag for fetching return options" + }, + { + "in": "query", + "name": "admin_only", + "schema": { + "type": "boolean" + }, + "description": "Flag for fetching admin specific options" + } + ], "tags": [ "Shipping Option" ], @@ -5921,6 +8132,7 @@ "operationId": "DeleteShippingOptionsOption", "summary": "Delete a Shipping Option", "description": "Deletes a Shipping Option.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5964,6 +8176,7 @@ "operationId": "GetShippingOptionsOption", "summary": "Retrieve a Shipping Option", "description": "Retrieves a Shipping Option.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -5999,6 +8212,7 @@ "operationId": "PostShippingOptionsOption", "summary": "Update Shipping Option", "description": "Updates a Shipping Option", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -6023,6 +8237,14 @@ "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", @@ -6074,10 +8296,14 @@ "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", @@ -6112,6 +8338,7 @@ "operationId": "GetShippingProfiles", "summary": "List Shipping Profiles", "description": "Retrieves a list of Shipping Profile.", + "x-authenticated": true, "tags": [ "Shipping Profile" ], @@ -6141,6 +8368,7 @@ "operationId": "DeleteShippingProfilesProfile", "summary": "Delete a Shipping Profile", "description": "Deletes a Shipping Profile.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -6184,6 +8412,7 @@ "operationId": "GetShippingProfilesProfile", "summary": "Retrieve a Shipping Profile", "description": "Retrieves a Shipping Profile.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -6270,6 +8499,7 @@ "operationId": "PostStoreCurrenciesCode", "summary": "Add a Currency Code", "description": "Adds a Currency Code to the available currencies.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -6303,8 +8533,9 @@ }, "delete": { "operationId": "DeleteStoreCurrenciesCode", - "summary": "Remvoe a Currency Code", + "summary": "Remove a Currency Code", "description": "Removes a Currency Code from the available currencies.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -6342,6 +8573,7 @@ "operationId": "GetStore", "summary": "Retrieve Store details.", "description": "Retrieves the Store details", + "x-authenticated": true, "tags": [ "Store" ], @@ -6366,6 +8598,7 @@ "operationId": "PostStore", "summary": "Update Store details.", "description": "Updates the Store details", + "x-authenticated": true, "requestBody": { "content": { "application/json": { @@ -6379,6 +8612,14 @@ "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" @@ -6414,6 +8655,7 @@ "operationId": "GetStorePaymentProviders", "summary": "Retrieve configured Payment Providers", "description": "Retrieves the configured Payment Providers", + "x-authenticated": true, "tags": [ "Store" ], @@ -6438,11 +8680,42 @@ } } }, + "/store/tax-providers": { + "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/store" + } + } + } + } + } + } + } + } + } + }, "/swaps/{id}": { "get": { "operationId": "GetSwapsSwap", "summary": "Retrieve a Swap", "description": "Retrieves a Swap.", + "x-authenticated": true, "parameters": [ { "in": "path", @@ -6480,6 +8753,7 @@ "operationId": "GetSwaps", "summary": "List Swaps", "description": "Retrieves a list of Swaps.", + "x-authenticated": true, "tags": [ "Swap" ], @@ -6504,11 +8778,800 @@ } } }, + "/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", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$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", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$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", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "DeleteTaxRatesTaxRateProducts", + "summary": "Removes Tax Rate from Products", + "description": "Removes a Tax Rate from a list of Products", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$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", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$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", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } + } + } + } + } + } + } + } + } + }, + "/tax-rates": { + "post": { + "operationId": "PostTaxRates", + "summary": "Create a Tax Rate", + "description": "Creates a Tax Rate", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetTaxRates", + "summary": "List Tax Rates", + "description": "Retrieves a list of TaxRates", + "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": "region_id", + "description": "to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "code", + "description": "to search for.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "rate", + "description": "to search for.", + "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" + } + }, + { + "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": "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" + } + } + } + } + } + } + } + } + } + }, + "/tax-rates/{id}": { + "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 Rates" + ], + "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." + }, + "deleted": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/tax-rates/:id": { + "get": { + "operationId": "GetTaxRatesTaxRate", + "summary": "Get Tax Rate", + "description": "Retrieves a TaxRate", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostTaxRatesTaxRate", + "summary": "Update a Tax Rate", + "description": "Updates a Tax Rate", + "x-authenticated": true, + "tags": [ + "Tax Rates" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "tax_rate": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tax_rate" + } + } + } + } + } + } + } + } + } + }, + "/": { + "post": { + "operationId": "PostUploads", + "summary": "Uploads an array of files", + "description": "Uploads an array of files to the specific fileservice that is installed in medusa.", + "x-authenticated": true, + "tags": [ + "Uploads" + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "files": { + "type": "array", + "items": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "uploads": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "/users": { + "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" + }, + "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" + }, + "password": { + "description": "The Users password.", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Users" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "user": { + "$ref": "#/components/schemas/user" + } + } + } + } + } + } + } + }, + "get": { + "operationId": "GetUsers", + "summary": "Retrieve all users", + "description": "Retrieves all users.", + "x-authenticated": true, + "tags": [ + "Users" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/user" + } + } + } + } + } + } + } + } + } + }, + "/users/{user_id}": { + "delete": { + "operationId": "DeleteUsersUser", + "summary": "Delete a User", + "description": "Deletes 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": { + "id": { + "type": "string", + "description": "The id of the deleted Shipping Profile." + }, + "object": { + "type": "string", + "description": "The type of the object that was deleted." + }, + "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}": { + "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": [ + "Users" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "user": { + "$ref": "#/components/schemas/user" + } + } + } + } + } + } + } + } + }, + "/users/password-token": { + "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": [ + "email", + "token", + "password" + ], + "properties": { + "email": { + "description": "The Users email.", + "type": "string" + }, + "token": { + "description": "The token generated from the 'password-token' endpoint.", + "type": "string" + }, + "password": { + "description": "The Users new password.", + "type": "string" + } + } + } + } + } + }, + "tags": [ + "Users" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "user": { + "$ref": "#/components/schemas/user" + } + } + } + } + } + } + } + } + }, "/variants": { "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": "string" + } + }, + { + "in": "query", + "name": "limit", + "description": "Limit the number of variants returned.", + "schema": { + "type": "string" + } + } + ], "tags": [ "Product Variant" ], @@ -6532,139 +9595,6 @@ } } } - }, - "/returns/{id}/cancel": { - "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": { - "return": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - }, - "/returns": { - "get": { - "operationId": "GetReturns", - "summary": "List Returns", - "description": "Retrieves a list of Returns", - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "returns": { - "type": "array", - "items": { - "$ref": "#/components/schemas/return" - } - } - } - } - } - } - } - } - } - }, - "/returns/{id}/receive": { - "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": { - "properties": { - "items": { - "description": "The Line Items that have been received.", - "type": "array", - "items": { - "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": "integer" - } - } - } - } - } - }, - "tags": [ - "Return" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "return": { - "$ref": "#/components/schemas/return" - } - } - } - } - } - } - } - } } }, "components": { @@ -7177,6 +10107,40 @@ } } }, + "customer_group": { + "title": "Customer Group", + "description": "Represents a customer group", + "x-resourceId": "customer_group", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "customers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/customer" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time" + }, + "metadata": { + "type": "object" + } + } + }, "customer": { "title": "Customer", "description": "Represents a customer", @@ -7700,6 +10664,52 @@ } } }, + "invite": { + "title": "Invite", + "description": "Represents an invite", + "x-resourceId": "invite", + "properties": { + "id": { + "type": "string" + }, + "user_email": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "admin", + "member", + "developer" + ] + }, + "accepted": { + "type": "boolean" + }, + "token": { + "type": "string" + }, + "expores_at": { + "type": "string", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time" + }, + "metadata": { + "type": "object" + } + } + }, "line_item": { "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.", @@ -8037,6 +11047,31 @@ } } }, + "OAuth": { + "title": "OAuth", + "description": "Represent an OAuth app", + "x-resourceId": "OAuth", + "properties": { + "id": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "application_name": { + "type": "string" + }, + "install_url": { + "type": "string" + }, + "uninstall_url": { + "type": "integer" + }, + "data": { + "type": "object" + } + } + }, "order": { "title": "Order", "description": "Represents an order", @@ -8091,7 +11126,7 @@ "type": "string" }, "tax_rate": { - "type": "integer" + "type": "number" }, "discounts": { "type": "array", @@ -8412,7 +11447,7 @@ "description": "The Products contained in the Product Collection.", "type": "array", "items": { - "type": "object" + "$ref": "#/components/schemas/product" } }, "created_at": { @@ -8557,6 +11592,74 @@ } } }, + "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", + "properties": { + "product_id": { + "description": "The id of the Product", + "type": "string" + }, + "rate_id": { + "description": "The id of the Tax Rate", + "type": "string" + }, + "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" + }, + "deleted_at": { + "description": "The date with timezone at which the resource was deleted.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "An optional key-value map with additional information.", + "type": "object" + } + } + }, + "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", + "properties": { + "product_type_id": { + "description": "The id of the Product type", + "type": "string" + }, + "rate_id": { + "description": "The id of the Tax Rate", + "type": "string" + }, + "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" + }, + "deleted_at": { + "description": "The date with timezone at which the resource was deleted.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "An optional key-value map with additional information.", + "type": "object" + } + } + }, "product_type": { "title": "Product Type", "description": "Product Type can be added to Products for filtering and reporting purposes.", @@ -9347,6 +12450,40 @@ } } }, + "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", + "properties": { + "shipping_option_id": { + "description": "The id of the Shipping Option", + "type": "string" + }, + "rate_id": { + "description": "The id of the Tax Rate", + "type": "string" + }, + "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" + }, + "deleted_at": { + "description": "The date with timezone at which the resource was deleted.", + "type": "string", + "format": "date-time" + }, + "metadata": { + "description": "An optional key-value map with additional information.", + "type": "object" + } + } + }, "store": { "title": "Store", "description": "Holds settings for the Store, such as name, currencies, etc.", @@ -9518,6 +12655,103 @@ } } }, + "tax_line": { + "title": "Tax Line", + "description": "Line item that specifies an amount of tax to add to a line item.", + "x-resourceId": "tax_line", + "properties": { + "id": { + "description": "The id of the Tax Line. This value will be prefixed by `tl_`.", + "type": "string" + }, + "code": { + "description": "A code to identify the tax type by", + "type": "string" + }, + "name": { + "description": "A human friendly name for the tax", + "type": "string" + }, + "rate": { + "description": "The numeric rate to charge tax by", + "type": "number" + }, + "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" + } + } + }, + "tax_provider": { + "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" + }, + "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" + } + } + }, + "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", + "properties": { + "id": { + "description": "The id of the Tax Rate. This value will be prefixed by `txr_`.", + "type": "string" + }, + "rate": { + "description": "The numeric rate to charge", + "type": "number" + }, + "code": { + "description": "A code to identify the tax type by", + "type": "string" + }, + "name": { + "description": "A human friendly name for the tax", + "type": "string" + }, + "region_id": { + "description": "The id of the Region that the rate belongs to", + "type": "string" + }, + "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" + }, + "refundable": { + "description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.", + "type": "integer" + } + } + }, "tracking_link": { "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.", diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index f0967aa938..8c42b10226 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -38,7 +38,7 @@ tags: - name: OAuth x-resourceId: OAuth servers: - - url: "https://api.medusa-commerce.com/admin" + - url: 'https://api.medusa-commerce.com/admin' paths: /apps: post: @@ -67,14 +67,14 @@ paths: tags: - Apps responses: - "200": + '200': description: OK content: application/json: schema: properties: apps: - $ref: "#/components/schemas/OAuth" + $ref: '#/components/schemas/OAuth' get: operationId: GetApps summary: List applications @@ -83,14 +83,14 @@ paths: tags: - Apps responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/OAuth" + $ref: '#/components/schemas/OAuth' /auth: post: operationId: PostAuth @@ -101,14 +101,14 @@ paths: tags: - Auth responses: - "200": + '200': description: OK content: application/json: schema: properties: user: - $ref: "#/components/schemas/user" + $ref: '#/components/schemas/user' requestBody: content: application/json: @@ -132,15 +132,15 @@ paths: tags: - Auth responses: - "200": + '200': description: OK content: application/json: schema: properties: user: - $ref: "#/components/schemas/user" - "/collections/{id}/products/batch": + $ref: '#/components/schemas/user' + '/collections/{id}/products/batch': post: operationId: PostProductsToCollection summary: Updates products associated with a Product Collection @@ -169,7 +169,7 @@ paths: tags: - Collection responses: - "200": + '200': description: OK delete: operationId: DeleteProductsFromCollection @@ -203,7 +203,7 @@ paths: tags: - Collection responses: - "200": + '200': description: OK /collections: post: @@ -234,14 +234,14 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/product_collection" + $ref: '#/components/schemas/product_collection' get: operationId: GetCollections summary: List Product Collections @@ -292,15 +292,15 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/product_collection" - "/collections/{id}": + $ref: '#/components/schemas/product_collection' + '/collections/{id}': delete: operationId: DeleteCollectionsCollection summary: Delete a Product Collection @@ -316,7 +316,7 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: @@ -345,14 +345,14 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/product_collection" + $ref: '#/components/schemas/product_collection' post: operationId: PostCollectionsCollection summary: Update a Product Collection @@ -386,14 +386,14 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/product_collection" + $ref: '#/components/schemas/product_collection' /customer-groups: post: operationId: PostCustomerGroups @@ -404,14 +404,14 @@ paths: tags: - CustomerGroup responses: - "200": + '200': description: OK content: application/json: schema: properties: customer_group: - $ref: "#/components/schemas/customer_group" + $ref: '#/components/schemas/customer_group' requestBody: content: application/json: @@ -426,7 +426,7 @@ paths: metadata: type: object description: Metadata for the customer. - "/customer-groups/{id}": + '/customer-groups/{id}': delete: operationId: DeleteCustomerGroupsCustomerGroup summary: Delete a CustomerGroup @@ -442,7 +442,7 @@ paths: tags: - CustomerGroup responses: - "200": + '200': description: OK content: application/json: @@ -471,14 +471,14 @@ paths: tags: - CustomerGroup responses: - "200": + '200': description: OK content: application/json: schema: properties: customer_group: - $ref: "#/components/schemas/customer_group" + $ref: '#/components/schemas/customer_group' requestBody: content: application/json: @@ -493,7 +493,7 @@ paths: metadata: type: object description: Metadata for the customer. - "/customer-group/{id}": + '/customer-group/{id}': get: operationId: GetCustomerGroupsGroup summary: Retrieve a CustomerGroup @@ -509,14 +509,14 @@ paths: tags: - CustomerGroup responses: - "200": + '200': description: OK content: application/json: schema: properties: customer_group: - $ref: "#/components/schemas/customer_group" + $ref: '#/components/schemas/customer_group' /customers: post: operationId: PostCustomers @@ -527,14 +527,14 @@ paths: tags: - Customer responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' requestBody: content: application/json: @@ -568,15 +568,15 @@ paths: tags: - Customer responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" - "/customers/{id}": + $ref: '#/components/schemas/customer' + '/customers/{id}': get: operationId: GetCustomersCustomer summary: Retrieve a Customer @@ -592,14 +592,14 @@ paths: tags: - Customer responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' post: operationId: PostCustomersCustomer summary: Update a Customer @@ -612,6 +612,14 @@ paths: description: The id of the Customer. schema: type: string + - in: query + name: expand + style: form + explode: false + schema: + type: array + items: + type: string requestBody: content: application/json: @@ -636,7 +644,6 @@ paths: description: The Customer's password. groups: type: array - description: A list of customer groups to which the customer belongs. items: required: - id @@ -644,21 +651,22 @@ paths: id: description: The id of a customer group type: string + description: A list of customer groups to which the customer belongs. metadata: type: object description: Metadata for the customer. tags: - Customer responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" - "/discounts/{id}/regions/{region_id}": + $ref: '#/components/schemas/customer' + '/discounts/{id}/regions/{region_id}': post: operationId: PostDiscountsDiscountRegionsRegion summary: Adds Region availability @@ -680,14 +688,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' delete: operationId: DeleteDiscountsDiscountRegionsRegion summary: Remove Region availability @@ -711,15 +719,15 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" - "/discounts/{id}/products/{product_id}": + $ref: '#/components/schemas/discount' + '/discounts/{id}/products/{product_id}': post: operationId: PostDiscountsDiscountProductsProduct summary: Adds Product availability @@ -741,14 +749,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' delete: operationId: DeleteDiscountsDiscountProductsProduct summary: Remove Product availability @@ -772,14 +780,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' /discounts: post: operationId: PostDiscounts @@ -791,10 +799,10 @@ paths: requestBody: content: application/json: - required: - - code - - rule schema: + required: + - code + - rule properties: code: type: string @@ -809,7 +817,7 @@ paths: rule: description: The Discount Rule that defines how Discounts are calculated oneOf: - - $ref: "#/components/schemas/discount_rule" + - $ref: '#/components/schemas/discount_rule' is_disabled: type: boolean description: >- @@ -843,14 +851,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' get: operationId: GetDiscounts summary: List Discounts @@ -890,15 +898,15 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" - "/discounts/{id}/dynamic-codes": + $ref: '#/components/schemas/discount' + '/discounts/{id}/dynamic-codes': post: operationId: PostDiscountsDiscountDynamicCodes summary: Create a dynamic Discount code @@ -916,14 +924,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' requestBody: content: application/json: @@ -940,7 +948,7 @@ paths: description: >- An optional set of key-value paris to hold additional information. - "/discounts/{id}": + '/discounts/{id}': delete: operationId: DeleteDiscountsDiscount summary: Delete a Discount @@ -956,7 +964,7 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: @@ -985,14 +993,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' post: operationId: PostDiscountsDiscount summary: Update a Discount @@ -1025,17 +1033,19 @@ paths: rule: description: The Discount Rule that defines how Discounts are calculated oneOf: - - $ref: "#/components/schemas/discount_rule" + - $ref: '#/components/schemas/discount_rule' 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. @@ -1052,15 +1062,15 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" - "/discounts/{id}/dynamic-codes/{code}": + $ref: '#/components/schemas/discount' + '/discounts/{id}/dynamic-codes/{code}': delete: operationId: DeleteDiscountsDiscountDynamicCodesCode summary: Delete a dynamic code @@ -1082,15 +1092,15 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" - "/discounts/code/{code}": + $ref: '#/components/schemas/discount' + '/discounts/code/{code}': get: operationId: GetDiscountsDiscountCode summary: Retrieve a Discount by code @@ -1106,14 +1116,14 @@ paths: tags: - Discount responses: - "200": + '200': description: OK content: application/json: schema: properties: discount: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' /draft-orders: post: operationId: PostDraftOrders @@ -1139,11 +1149,11 @@ paths: 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 @@ -1211,14 +1221,14 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" + $ref: '#/components/schemas/draft-order' get: operationId: GetDraftOrders summary: List Draft Orders @@ -1227,26 +1237,33 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" - "/draft-orders/{id}/line-items": + $ref: '#/components/schemas/draft-order' + '/draft-orders/{id}/line-items': 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: - required: - - quantity schema: + required: + - quantity properties: variant_id: description: >- @@ -1270,15 +1287,15 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" - "/draft-orders/{id}": + $ref: '#/components/schemas/draft-order' + '/draft-orders/{id}': delete: operationId: DeleteDraftOrdersDraftOrder summary: Delete a Draft Order @@ -1294,7 +1311,7 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: @@ -1323,15 +1340,15 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" - "/draft-orders/{id}/line-items/{line_id}": + $ref: '#/components/schemas/draft-order' + '/draft-orders/{id}/line-items/{line_id}': delete: operationId: DeleteDraftOrdersDraftOrderLineItemsItem summary: Delete a Line Item @@ -1353,19 +1370,32 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" + $ref: '#/components/schemas/draft-order' 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: @@ -1388,15 +1418,15 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" - "/draft-orders/{id}/register-payment": + $ref: '#/components/schemas/draft-order' + '/draft-orders/{id}/register-payment': post: summary: Registers a payment for a Draft Order operationId: PostDraftOrdersDraftOrderRegisterPayment @@ -1412,15 +1442,15 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" - "/admin/draft-orders/{id}": + $ref: '#/components/schemas/draft-order' + '/admin/draft-orders/{id}': post: operationId: PostDraftOrdersDraftOrder summary: Update a Draft Order" @@ -1447,11 +1477,11 @@ paths: 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 @@ -1471,14 +1501,14 @@ paths: tags: - Draft Order responses: - "200": + '200': description: OK content: application/json: schema: properties: draft_order: - $ref: "#/components/schemas/draft-order" + $ref: '#/components/schemas/draft-order' /gift-cards: post: operationId: PostGiftCards @@ -1521,14 +1551,14 @@ paths: tags: - Gift Card responses: - "200": + '200': description: OK content: application/json: schema: properties: gift_card: - $ref: "#/components/schemas/gift_card" + $ref: '#/components/schemas/gift_card' get: operationId: GetGiftCards summary: List Gift Cards @@ -1537,7 +1567,7 @@ paths: tags: - Gift Card responses: - "200": + '200': description: OK content: application/json: @@ -1546,8 +1576,8 @@ paths: gift_cards: type: array items: - $ref: "#/components/schemas/gift_card" - "/gift-cards/{id}": + $ref: '#/components/schemas/gift_card' + '/gift-cards/{id}': delete: operationId: DeleteGiftCardsGiftCard summary: Delete a Gift Card @@ -1563,7 +1593,7 @@ paths: tags: - Gift Card responses: - "200": + '200': description: OK content: application/json: @@ -1592,14 +1622,14 @@ paths: tags: - Gift Card responses: - "200": + '200': description: OK content: application/json: schema: properties: gift_card: - $ref: "#/components/schemas/gift_card" + $ref: '#/components/schemas/gift_card' post: operationId: PostGiftCardsGiftCard summary: Create a Gift Card @@ -1648,14 +1678,14 @@ paths: tags: - Gift Card responses: - "200": + '200': description: OK content: application/json: schema: properties: gift_card: - $ref: "#/components/schemas/gift_card" + $ref: '#/components/schemas/gift_card' /invites/accept: post: operationId: PostInvitesInviteAccept @@ -1692,7 +1722,7 @@ paths: tags: - Invites responses: - "200": + '200': description: OK /invites: post: @@ -1717,7 +1747,7 @@ paths: tags: - Invites responses: - "200": + '200': description: OK get: operationId: GetInvites @@ -1727,7 +1757,7 @@ paths: tags: - Invites responses: - "200": + '200': description: OK content: application/json: @@ -1736,8 +1766,8 @@ paths: invites: type: array items: - $ref: "#/components/schemas/invite" - "/invites/{invite_id}": + $ref: '#/components/schemas/invite' + '/invites/{invite_id}': delete: operationId: DeleteInvitesInvite summary: Create an Invite @@ -1753,9 +1783,9 @@ paths: tags: - Invites responses: - "200": + '200': description: OK - "/invites/{invite_id}/resend": + '/invites/{invite_id}/resend': post: operationId: PostInvitesInviteResend summary: Resend an Invite @@ -1771,7 +1801,7 @@ paths: tags: - Invites responses: - "200": + '200': description: OK /notes: post: @@ -1796,14 +1826,14 @@ paths: tags: - Note responses: - "200": + '200': description: OK content: application/json: schema: properties: note: - $ref: "#/components/schemas/note" + $ref: '#/components/schemas/note' get: operationId: GetNotes summary: List Notes @@ -1816,25 +1846,25 @@ paths: description: The number of notes to get schema: type: number - default: "" + default: '' - in: path name: offset required: true description: The offset at which to get notes schema: type: number - default: "" + default: '' - in: path name: resource_id required: true description: The id which the notes belongs to schema: type: string - default: "" + default: '' tags: - Note responses: - "200": + '200': description: OK content: application/json: @@ -1843,8 +1873,8 @@ paths: notes: type: array items: - $ref: "#/components/schemas/note" - "/notes/{id}": + $ref: '#/components/schemas/note' + '/notes/{id}': delete: operationId: DeleteNotesNote summary: Deletes a Note @@ -1860,7 +1890,7 @@ paths: tags: - Note responses: - "200": + '200': description: OK content: application/json: @@ -1887,14 +1917,14 @@ paths: tags: - Note responses: - "200": + '200': description: OK content: application/json: schema: properties: note: - $ref: "#/components/schemas/note" + $ref: '#/components/schemas/note' post: operationId: PostNotesNote summary: Updates a Note @@ -1920,14 +1950,14 @@ paths: tags: - Note responses: - "200": + '200': description: OK content: application/json: schema: properties: note: - $ref: "#/components/schemas/note" + $ref: '#/components/schemas/note' /notifications: get: operationId: GetNotifications @@ -1983,7 +2013,7 @@ paths: tags: - Notification responses: - "200": + '200': description: OK content: application/json: @@ -1992,8 +2022,8 @@ paths: notifications: type: array items: - $ref: "#/components/schemas/notification" - "/notifications/{id}/resend": + $ref: '#/components/schemas/notification' + '/notifications/{id}/resend': post: operationId: PostNotificationsNotificationResend summary: Resend Notification @@ -2021,15 +2051,15 @@ paths: tags: - Notification responses: - "200": + '200': description: OK content: application/json: schema: properties: notification: - $ref: "#/components/schemas/notification" - "/orders/{id}/shipping-methods": + $ref: '#/components/schemas/notification' + '/orders/{id}/shipping-methods': post: operationId: PostOrdersOrderShippingMethods summary: Add a Shipping Method @@ -2048,14 +2078,14 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' requestBody: content: application/json: @@ -2082,7 +2112,7 @@ paths: The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider. - "/orders/{id}/archive": + '/orders/{id}/archive': post: operationId: PostOrdersOrderArchive summary: Archive order @@ -2098,15 +2128,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/claims/{claim_id}/cancel": + $ref: '#/components/schemas/order' + '/orders/{id}/claims/{claim_id}/cancel': post: operationId: PostOrdersClaimCancel summary: Cancels a Claim @@ -2128,15 +2158,15 @@ paths: tags: - Claim responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/claim_order" - "/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel": + $ref: '#/components/schemas/claim_order' + '/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel': post: operationId: PostOrdersClaimFulfillmentsCancel summary: Cancels a fulfilmment related to a Claim @@ -2164,15 +2194,15 @@ paths: tags: - Fulfillment responses: - "200": + '200': description: OK content: application/json: schema: properties: fulfillment: - $ref: "#/components/schemas/fulfillment" - "/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel": + $ref: '#/components/schemas/fulfillment' + '/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel': post: operationId: PostOrdersSwapFulfillmentsCancel summary: Cancels a fulfilmment related to a Swap @@ -2200,15 +2230,15 @@ paths: tags: - Fulfillment responses: - "200": + '200': description: OK content: application/json: schema: properties: fulfillment: - $ref: "#/components/schemas/fulfillment" - "/orders/{id}/fulfillments/{fulfillment_id}/cancel": + $ref: '#/components/schemas/fulfillment' + '/orders/{id}/fulfillments/{fulfillment_id}/cancel': post: operationId: PostOrdersOrderFulfillmentsCancel summary: Cancels a fulfilmment @@ -2230,15 +2260,15 @@ paths: tags: - Fulfillment responses: - "200": + '200': description: OK content: application/json: schema: properties: fulfillment: - $ref: "#/components/schemas/fulfillment" - "/orders/{id}/cancel": + $ref: '#/components/schemas/fulfillment' + '/orders/{id}/cancel': post: operationId: PostOrdersOrderCancel summary: Cancel an Order @@ -2257,15 +2287,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/swaps/{swap_id}/cancel": + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/cancel': post: operationId: PostOrdersSwapCancel summary: Cancels a Swap @@ -2287,15 +2317,15 @@ paths: tags: - Swap responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/swap" - "/orders/{id}/capture": + $ref: '#/components/schemas/swap' + '/orders/{id}/capture': post: operationId: PostOrdersOrderCapture summary: Capture an Order @@ -2311,15 +2341,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/complete": + $ref: '#/components/schemas/order' + '/orders/{id}/complete': post: operationId: PostOrdersOrderComplete summary: Complete an Order @@ -2335,15 +2365,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/claims/{claim_id}/shipments": + $ref: '#/components/schemas/order' + '/orders/{id}/claims/{claim_id}/shipments': post: operationId: PostOrdersOrderClaimsClaimShipments summary: Create Claim Shipment @@ -2380,15 +2410,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/order/{id}/claims": + $ref: '#/components/schemas/order' + '/order/{id}/claims': post: operationId: PostOrdersOrderClaims summary: Create a Claim @@ -2520,15 +2550,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/fulfillments": + $ref: '#/components/schemas/order' + '/orders/{id}/fulfillments': post: operationId: PostOrdersOrderFulfillments summary: Create a Fulfillment @@ -2574,14 +2604,14 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' /orders: post: operationId: PostOrders @@ -2591,16 +2621,16 @@ paths: requestBody: content: application/json: - required: - - email - - billing_address - - shipping_address - - items - - region - - customer_id - - payment_method - - shipping_method schema: + required: + - email + - billing_address + - shipping_address + - items + - region + - customer_id + - payment_method + - shipping_method properties: status: description: status of the order @@ -2611,22 +2641,24 @@ paths: 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 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 @@ -2664,6 +2696,8 @@ paths: description: Data relevant to the specific shipping method. items: type: array + items: + $ref: '#/components/schemas/line_item' description: Items to ship no_notification: description: >- @@ -2673,14 +2707,14 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' get: operationId: GetOrders summary: List Orders @@ -2699,19 +2733,23 @@ paths: type: string - in: query name: status - description: Status to search for. + style: form + explode: false + description: Status to search for schema: - type: "string[]" + type: array + items: + type: string - in: query name: fulfillment_status description: Fulfillment status to search for. schema: - type: "string[]" + type: string - in: query name: payment_status description: Payment status to search for. schema: - type: "string[]" + type: string - in: query name: display_id description: Display id to search for. @@ -2795,7 +2833,7 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: @@ -2804,8 +2842,8 @@ paths: orders: type: array items: - $ref: "#/components/schemas/order" - "/orders/{id}/shipment": + $ref: '#/components/schemas/order' + '/orders/{id}/shipment': post: operationId: PostOrdersOrderShipment summary: Create a Shipment @@ -2841,15 +2879,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/swaps/{swap_id}/shipments": + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/shipments': post: operationId: PostOrdersOrderSwapsSwapShipments summary: Create Swap Shipment @@ -2891,15 +2929,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/order/{id}/swaps": + $ref: '#/components/schemas/order' + '/order/{id}/swaps': post: operationId: PostOrdersOrderSwaps summary: Create a Swap @@ -2985,20 +3023,20 @@ paths: Swap. type: boolean allow_backorder: - description: "If true, swaps can be completed with items out of stock" + description: 'If true, swaps can be completed with items out of stock' type: boolean tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/order/{id}/metadata/{key}": + $ref: '#/components/schemas/order' + '/order/{id}/metadata/{key}': delete: operationId: DeleteOrdersOrderMetadataKey summary: Delete Metadata @@ -3020,15 +3058,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/claims/{claim_id}/fulfillments": + $ref: '#/components/schemas/order' + '/orders/{id}/claims/{claim_id}/fulfillments': post: operationId: PostOrdersOrderClaimsClaimFulfillments summary: Create a Claim Fulfillment @@ -3065,15 +3103,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/swaps/{swap_id}/fulfillments": + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/fulfillments': post: operationId: PostOrdersOrderSwapsSwapFulfillments summary: Create a Swap Fulfillment @@ -3110,15 +3148,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}": + $ref: '#/components/schemas/order' + '/orders/{id}': get: operationId: GetOrdersOrder summary: Retrieve an Order @@ -3134,14 +3172,14 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' post: operationId: PostOrdersOrder summary: Update an order @@ -3165,23 +3203,29 @@ paths: billing_address: description: Billing address anyOf: - - $ref: >- - #/components/schemas/address shipping_address: - description: Shipping address anyOf: - $ref: + - $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: null + description: payment method chosen for the order type: object properties: provider_id: @@ -3208,6 +3252,8 @@ paths: description: Data relevant to the specific shipping method. items: type: array + items: + $ref: '#/components/schemas/line_item' description: Items to ship no_notification: description: >- @@ -3217,15 +3263,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/swaps/{swap_id}/process-payment": + $ref: '#/components/schemas/order' + '/orders/{id}/swaps/{swap_id}/process-payment': post: operationId: PostOrdersOrderSwapsSwapProcessPayment summary: Process a Swap difference @@ -3250,15 +3296,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/refunds": + $ref: '#/components/schemas/order' + '/orders/{id}/refunds': post: operationId: PostOrdersOrderRefunds summary: Create a Refund @@ -3296,15 +3342,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/orders/{id}/returns": + $ref: '#/components/schemas/order' + '/orders/{id}/returns': post: operationId: PostOrdersOrderReturns summary: Request a Return @@ -3373,15 +3419,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/order/{id}/claims/{claim_id}": + $ref: '#/components/schemas/order' + '/order/{id}/claims/{claim_id}': post: operationId: PostOrdersOrderClaimsClaim summary: Update a Claim @@ -3472,14 +3518,14 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' /product-tags: get: operationId: GetProductTags @@ -3524,14 +3570,14 @@ paths: tags: - Product Tag responses: - "200": + '200': description: OK content: application/json: schema: properties: tags: - $ref: "#/components/schemas/product_tag" + $ref: '#/components/schemas/product_tag' /product-types: get: operationId: GetProductTypes @@ -3565,553 +3611,26 @@ paths: Date comparison for when resulting tas was created, i.e. less than, greater than etc. schema: - type: datecomparisonoperator + 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: datecomparisonoperator + type: object tags: - Product Tag responses: - "200": + '200': description: OK content: application/json: schema: properties: types: - $ref: "#/components/schemas/product_tag" - "/regions/{id}/countries": - 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 - tags: - - Region - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - region: - $ref: "#/components/schemas/region" - "/regions/{id}/fulfillment-providers": - 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: - required: - - provider_id - schema: - 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" - "/regions/{id}/payment-providers": - 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: - required: - - provider_id - schema: - 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" - /regions: - post: - operationId: PostRegions - summary: Create a Region - description: Creates a Region - x-authenticated: true - requestBody: - content: - application/json: - required: - - name - - currency_code - - tax_rate - 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 - 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 Providers 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 - type: array - items: - type: string - countries: - description: A list of countries 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" - get: - operationId: GetRegions - summary: List Regions - description: Retrieves a list of Regions. - x-authenticated: true - parameters: - - in: query - name: limit - schema: - type: integer - required: false - description: limit the number of regions in response - - in: query - name: offset - schema: - type: integer - 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" - "/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" - "/regions/{id}": - 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. - deleted: - type: boolean - 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" - 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 - 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 Providers 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 - type: array - items: - type: string - countries: - description: A list of countries 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" - "/regions/{id}/fulfillment-options": - 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: - type: object - "/regions/{id}/countries/{country_code}": - 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 - required: true - description: The 2 character ISO code for the Country. - schema: - type: string - tags: - - Region - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - region: - $ref: "#/components/schemas/region" - "/regions/{id}/fulfillment-providers/{provider_id}": - 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" - "/regions/{id}/payment-providers/{provider_id}": - delete: - operationId: PostRegionsRegionPaymentProvidersProvider - summary: Remove Payment Provider - description: Removes a Payment Provider. - x-authenticated: true - parameters: - - in: path - name: region_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" - "/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. - "/products/{id}/options": + $ref: '#/components/schemas/product_tag' + '/products/{id}/options': post: operationId: PostProductsProductOptions summary: Add an Option @@ -4139,14 +3658,14 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' /products: post: operationId: PostProducts @@ -4156,13 +3675,11 @@ paths: requestBody: content: application/json: - required: - - title - - subtitle - - description schema: required: - title + - subtitle + - description properties: title: description: The title of the Product @@ -4214,7 +3731,7 @@ paths: description: The id of an existing Tag. type: string value: - description: "The value of the Tag, these will be upserted." + description: 'The value of the Tag, these will be upserted.' type: string options: description: >- @@ -4350,14 +3867,14 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' get: operationId: GetProducts summary: List Product @@ -4376,19 +3893,31 @@ paths: type: string - in: query name: status - description: Status to search for. + style: form + explode: false + description: Status to search for schema: 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 - description: Tags to search for. + style: form + explode: false + description: Tags to search for schema: type: array + items: + type: string - in: query name: title description: to search for. @@ -4467,7 +3996,7 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -4485,8 +4014,8 @@ paths: products: type: array items: - $ref: "#/components/schemas/product" - "/products/{id}/variants": + $ref: '#/components/schemas/product' + '/products/{id}/variants': post: operationId: PostProductsProductVariants summary: Create a Product Variant @@ -4600,14 +4129,14 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' get: operationId: GetProductsProductVariants summary: List a Product's Product Variants @@ -4623,7 +4152,7 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -4632,8 +4161,8 @@ paths: variants: type: array items: - $ref: "#/components/schemas/product_variant" - "/products/{id}/options/{option_id}": + $ref: '#/components/schemas/product_variant' + '/products/{id}/options/{option_id}': delete: operationId: DeleteProductsProductOptionsOption summary: Delete a Product Option @@ -4659,7 +4188,7 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -4674,7 +4203,7 @@ paths: deleted: type: boolean product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' post: operationId: PostProductsProductOptionsOption summary: Update a Product Option. @@ -4696,9 +4225,9 @@ paths: requestBody: content: application/json: - required: - - title schema: + required: + - title properties: title: description: The title of the Product Option @@ -4706,15 +4235,15 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" - "/products/{id}": + $ref: '#/components/schemas/product' + '/products/{id}': delete: operationId: DeleteProductsProduct summary: Delete a Product @@ -4730,7 +4259,7 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -4759,14 +4288,14 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' post: operationId: PostProductsProduct summary: Update a Product @@ -4834,7 +4363,7 @@ paths: description: The id of an existing Tag. type: string value: - description: "The value of the Tag, these will be upserted." + description: 'The value of the Tag, these will be upserted.' type: string options: description: >- @@ -4970,15 +4499,15 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" - "/products/{id}/variants/{variant_id}": + $ref: '#/components/schemas/product' + '/products/{id}/variants/{variant_id}': delete: operationId: DeleteProductsProductVariantsVariant summary: Delete a Product Variant @@ -5000,7 +4529,7 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -5127,14 +4656,14 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' /products/types: get: operationId: GetProductsTypes @@ -5144,7 +4673,7 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -5153,8 +4682,8 @@ paths: types: type: array items: - $ref: "#/components/schemas/product_type" - "/products/{id}/metadata": + $ref: '#/components/schemas/product_type' + '/products/{id}/metadata': post: operationId: PostProductsProductMetadata summary: Set Product metadata @@ -5184,14 +4713,547 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' + '/regions/{id}/countries': + 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 + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}/fulfillment-providers': + 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' + '/regions/{id}/payment-providers': + 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' + /regions: + 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 + 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 + 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 Providers 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 + type: array + items: + type: string + countries: + description: A list of countries 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' + get: + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. + x-authenticated: true + parameters: + - in: query + name: limit + schema: + type: integer + required: false + description: limit the number of regions in response + - in: query + name: offset + schema: + type: integer + 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' + '/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' + '/regions/{id}': + 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. + deleted: + type: boolean + 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' + 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 + 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 Providers 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 + type: array + items: + type: string + countries: + description: A list of countries 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' + '/regions/{id}/fulfillment-options': + 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: object + description: fulfillment provider options + '/regions/{id}/countries/{country_code}': + 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 + required: true + description: The 2 character ISO code for the Country. + schema: + type: string + tags: + - Region + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + region: + $ref: '#/components/schemas/region' + '/regions/{id}/fulfillment-providers/{provider_id}': + 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' + '/regions/{id}/payment-providers/{provider_id}': + 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' + '/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 @@ -5228,14 +5290,14 @@ paths: tags: - Return Reason responses: - "200": + '200': description: OK content: application/json: schema: properties: return_reason: - $ref: "#/components/schemas/return_reason" + $ref: '#/components/schemas/return_reason' get: operationId: GetReturnReasons summary: List Return Reasons @@ -5244,7 +5306,7 @@ paths: tags: - Return Reason responses: - "200": + '200': description: OK content: application/json: @@ -5253,8 +5315,8 @@ paths: return_reasons: type: array items: - $ref: "#/components/schemas/return_reason" - "/return-reasons/{id}": + $ref: '#/components/schemas/return_reason' + '/return-reasons/{id}': delete: operationId: DeleteReturnReason summary: Delete a return reason @@ -5270,7 +5332,7 @@ paths: tags: - Return Reason responses: - "200": + '200': description: OK content: application/json: @@ -5299,14 +5361,14 @@ paths: tags: - Return Reason responses: - "200": + '200': description: OK content: application/json: schema: properties: return_reason: - $ref: "#/components/schemas/return_reason" + $ref: '#/components/schemas/return_reason' post: operationId: PostReturnReasonsReason summary: Update a Return Reason @@ -5338,15 +5400,15 @@ paths: tags: - Return Reason responses: - "200": + '200': description: OK content: application/json: schema: properties: return_reason: - $ref: "#/components/schemas/return_reason" - "/returns/{id}/cancel": + $ref: '#/components/schemas/return_reason' + '/returns/{id}/cancel': post: operationId: PostReturnsReturnCancel summary: Cancel a Return @@ -5361,14 +5423,14 @@ paths: tags: - Return responses: - "200": + '200': description: OK content: application/json: schema: properties: return: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' /returns: get: operationId: GetReturns @@ -5390,7 +5452,7 @@ paths: tags: - Return responses: - "200": + '200': description: OK content: application/json: @@ -5399,8 +5461,8 @@ paths: returns: type: array items: - $ref: "#/components/schemas/return" - "/returns/{id}/receive": + $ref: '#/components/schemas/return' + '/returns/{id}/receive': post: operationId: PostReturnsReturnReceive summary: Receive a Return @@ -5438,14 +5500,14 @@ paths: tags: - Return responses: - "200": + '200': description: OK content: application/json: schema: properties: return: - $ref: "#/components/schemas/return" + $ref: '#/components/schemas/return' /shipping-options: post: operationId: PostShippingOptions @@ -5509,7 +5571,7 @@ paths: description: Whether the Shipping Option defines a return shipment. type: boolean admin_only: - description: "If true, the option can be used for draft orders" + description: 'If true, the option can be used for draft orders' type: boolean metadata: description: >- @@ -5519,42 +5581,39 @@ paths: tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: schema: properties: shipping_option: - $ref: "#/components/schemas/shipping_option" + $ref: '#/components/schemas/shipping_option' get: operationId: GetShippingOptions summary: List Shipping Options 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 + - in: query name: is_return schema: type: boolean - required: false description: Flag for fetching return options - - in: path + - in: query name: admin_only schema: type: boolean - required: false description: Flag for fetching admin specific options tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: @@ -5563,8 +5622,8 @@ paths: shipping_options: type: array items: - $ref: "#/components/schemas/shipping_option" - "/shipping-options/{id}": + $ref: '#/components/schemas/shipping_option' + '/shipping-options/{id}': delete: operationId: DeleteShippingOptionsOption summary: Delete a Shipping Option @@ -5580,7 +5639,7 @@ paths: tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: @@ -5609,14 +5668,14 @@ paths: tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: schema: properties: shipping_option: - $ref: "#/components/schemas/shipping_option" + $ref: '#/components/schemas/shipping_option' post: operationId: PostShippingOptionsOption summary: Update Shipping Option @@ -5641,7 +5700,7 @@ paths: description: The amount to charge for the Shipping Option. type: integer admin_only: - description: "If true, the option can be used for draft orders" + description: 'If true, the option can be used for draft orders' type: boolean metadata: description: >- @@ -5667,14 +5726,14 @@ paths: tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: schema: properties: shipping_option: - $ref: "#/components/schemas/shipping_option" + $ref: '#/components/schemas/shipping_option' /shipping-profiles: post: operationId: PostShippingProfiles @@ -5694,14 +5753,14 @@ paths: tags: - Shipping Profile responses: - "200": + '200': description: OK content: application/json: schema: properties: shipping_profile: - $ref: "#/components/schemas/shipping_profile" + $ref: '#/components/schemas/shipping_profile' get: operationId: GetShippingProfiles summary: List Shipping Profiles @@ -5710,7 +5769,7 @@ paths: tags: - Shipping Profile responses: - "200": + '200': description: OK content: application/json: @@ -5719,8 +5778,8 @@ paths: shipping_profiles: type: array items: - $ref: "#/components/schemas/shipping_profile" - "/shipping-profiles/{id}": + $ref: '#/components/schemas/shipping_profile' + '/shipping-profiles/{id}': delete: operationId: DeleteShippingProfilesProfile summary: Delete a Shipping Profile @@ -5736,7 +5795,7 @@ paths: tags: - Shipping Profile responses: - "200": + '200': description: OK content: application/json: @@ -5765,14 +5824,14 @@ paths: tags: - Shipping Profile responses: - "200": + '200': description: OK content: application/json: schema: properties: shipping_profile: - $ref: "#/components/schemas/shipping_profile" + $ref: '#/components/schemas/shipping_profile' post: operationId: PostShippingProfilesProfile summary: Update a Shipping Profiles @@ -5795,15 +5854,15 @@ paths: tags: - Shipping Profile responses: - "200": + '200': description: OK content: application/json: schema: properties: shipping_profiles: - $ref: "#/components/schemas/shipping_profile" - "/store/currencies/{code}": + $ref: '#/components/schemas/shipping_profile' + '/store/currencies/{code}': post: operationId: PostStoreCurrenciesCode summary: Add a Currency Code @@ -5819,14 +5878,14 @@ paths: tags: - Store responses: - "200": + '200': description: OK content: application/json: schema: properties: store: - $ref: "#/components/schemas/store" + $ref: '#/components/schemas/store' delete: operationId: DeleteStoreCurrenciesCode summary: Remove a Currency Code @@ -5842,14 +5901,14 @@ paths: tags: - Store responses: - "200": + '200': description: OK content: application/json: schema: properties: store: - $ref: "#/components/schemas/store" + $ref: '#/components/schemas/store' /store: get: operationId: GetStore @@ -5859,14 +5918,14 @@ paths: tags: - Store responses: - "200": + '200': description: OK content: application/json: schema: properties: store: - $ref: "#/components/schemas/store" + $ref: '#/components/schemas/store' post: operationId: PostStore summary: Update Store details. @@ -5901,14 +5960,14 @@ paths: tags: - Store responses: - "200": + '200': description: OK content: application/json: schema: properties: store: - $ref: "#/components/schemas/store" + $ref: '#/components/schemas/store' /store/payment-providers: get: operationId: GetStorePaymentProviders @@ -5918,7 +5977,7 @@ paths: tags: - Store responses: - "200": + '200': description: OK content: application/json: @@ -5927,7 +5986,7 @@ paths: payment_providers: type: array items: - $ref: "#/components/schemas/store" + $ref: '#/components/schemas/store' /store/tax-providers: get: operationId: GetStoreTaxProviders @@ -5937,7 +5996,7 @@ paths: tags: - Store responses: - "200": + '200': description: OK content: application/json: @@ -5946,8 +6005,8 @@ paths: tax_providers: type: array items: - $ref: "#/components/schemas/store" - "/swaps/{id}": + $ref: '#/components/schemas/store' + '/swaps/{id}': get: operationId: GetSwapsSwap summary: Retrieve a Swap @@ -5963,14 +6022,14 @@ paths: tags: - Swap responses: - "200": + '200': description: OK content: application/json: schema: properties: swap: - $ref: "#/components/schemas/swap" + $ref: '#/components/schemas/swap' /swaps: get: operationId: GetSwaps @@ -5980,7 +6039,7 @@ paths: tags: - Swap responses: - "200": + '200': description: OK content: application/json: @@ -5989,8 +6048,8 @@ paths: swaps: type: array items: - $ref: "#/components/schemas/swap" - "/tax-rates/:id/product-types/batch": + $ref: '#/components/schemas/swap' + '/tax-rates/:id/product-types/batch': post: operationId: PostTaxRatesTaxRateProductTypes summary: Add Tax Rate to Product Types @@ -5999,7 +6058,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6008,7 +6067,7 @@ paths: 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 @@ -6017,7 +6076,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6026,8 +6085,8 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" - "/tax-rates/:id/products/batch": + $ref: '#/components/schemas/tax_rate' + '/tax-rates/:id/products/batch': post: operationId: PostTaxRatesTaxRateProducts summary: Add Tax Rate to Products @@ -6036,7 +6095,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6045,7 +6104,7 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" + $ref: '#/components/schemas/tax_rate' delete: operationId: DeleteTaxRatesTaxRateProducts summary: Removes Tax Rate from Products @@ -6054,7 +6113,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6063,8 +6122,8 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" - "/tax-rates/:id/shipping-options/batch": + $ref: '#/components/schemas/tax_rate' + '/tax-rates/:id/shipping-options/batch': post: operationId: PostTaxRatesTaxRateShippingOptions summary: Add Tax Rate to Product Types @@ -6073,7 +6132,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6082,7 +6141,7 @@ paths: 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 @@ -6091,7 +6150,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6100,7 +6159,7 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" + $ref: '#/components/schemas/tax_rate' /tax-rates: post: operationId: PostTaxRates @@ -6110,7 +6169,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6119,7 +6178,7 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" + $ref: '#/components/schemas/tax_rate' get: operationId: GetTaxRates summary: List Tax Rates @@ -6185,7 +6244,7 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: @@ -6194,8 +6253,8 @@ paths: orders: type: array items: - $ref: "#/components/schemas/order" - "/tax-rates/{id}": + $ref: '#/components/schemas/order' + '/tax-rates/{id}': delete: operationId: DeleteTaxRatesTaxRate summary: Delete a Tax Rate @@ -6211,7 +6270,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6225,7 +6284,7 @@ paths: description: The type of the object that was deleted. deleted: type: boolean - "/tax-rates/:id": + '/tax-rates/:id': get: operationId: GetTaxRatesTaxRate summary: Get Tax Rate @@ -6234,7 +6293,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6243,7 +6302,7 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" + $ref: '#/components/schemas/tax_rate' post: operationId: PostTaxRatesTaxRate summary: Update a Tax Rate @@ -6252,7 +6311,7 @@ paths: tags: - Tax Rates responses: - "200": + '200': description: OK content: application/json: @@ -6261,7 +6320,7 @@ paths: tax_rate: type: array items: - $ref: "#/components/schemas/tax_rate" + $ref: '#/components/schemas/tax_rate' /: post: operationId: PostUploads @@ -6272,48 +6331,28 @@ paths: x-authenticated: true tags: - Uploads + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + files: + type: array + items: + type: string + format: binary responses: - "200": - description: OK - content: - application/json: - schema: - properties: uploads - /variants: - 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: string - - in: query - name: limit - description: Limit the number of variants returned. - schema: - type: string - tags: - - Product Variant - responses: - "200": + '200': description: OK content: application/json: schema: properties: - variants: + uploads: type: array items: - $ref: "#/components/schemas/product_variant" + type: string /users: post: operationId: PostUsers @@ -6346,14 +6385,14 @@ paths: tags: - Users responses: - "200": + '200': description: OK content: application/json: schema: properties: user: - $ref: "#/components/schemas/user" + $ref: '#/components/schemas/user' get: operationId: GetUsers summary: Retrieve all users @@ -6362,7 +6401,7 @@ paths: tags: - Users responses: - "200": + '200': description: OK content: application/json: @@ -6371,8 +6410,8 @@ paths: users: type: array items: - $ref: "#/components/schemas/user" - "/users/{user_id}": + $ref: '#/components/schemas/user' + '/users/{user_id}': delete: operationId: DeleteUsersUser summary: Delete a User @@ -6388,7 +6427,7 @@ paths: tags: - Users responses: - "200": + '200': description: OK content: application/json: @@ -6417,19 +6456,24 @@ paths: tags: - Users responses: - "200": + '200': description: OK content: application/json: schema: properties: user: - $ref: "#/components/schemas/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 @@ -6439,11 +6483,11 @@ paths: description: The name of the User. role: type: string - description: "The role of the User(admin, member, developer)." + description: 'The role of the User(admin, member, developer).' api_token: type: string description: The api_token of the User. - "/users/{id}": + '/users/{id}': get: operationId: GetUsersUser summary: Retrieve a User @@ -6459,14 +6503,14 @@ paths: tags: - Users responses: - "200": + '200': description: OK content: application/json: schema: properties: user: - $ref: "#/components/schemas/user" + $ref: '#/components/schemas/user' /users/password-token: post: operationId: PostUsersUserPassword @@ -6494,14 +6538,49 @@ paths: tags: - Users responses: - "200": + '200': description: OK content: application/json: schema: properties: user: - $ref: "#/components/schemas/user" + $ref: '#/components/schemas/user' + /variants: + 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: string + - in: query + name: limit + description: Limit the number of variants returned. + schema: + type: string + tags: + - Product Variant + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + variants: + type: array + items: + $ref: '#/components/schemas/product_variant' components: schemas: address: @@ -6528,7 +6607,7 @@ components: country_code: type: string country: - $ref: "#/components/schemas/country" + $ref: '#/components/schemas/country' cart: title: Cart description: Represents a user cart @@ -6541,43 +6620,43 @@ components: billing_address_id: type: string billing_address: - $ref: "#/components/schemas/address" + $ref: '#/components/schemas/address' shipping_address_id: type: string shipping_address: - $ref: "#/components/schemas/address" + $ref: '#/components/schemas/address' items: type: array items: - $ref: "#/components/schemas/line_item" + $ref: '#/components/schemas/line_item' region_id: type: string region: - $ref: "#/components/schemas/region" + $ref: '#/components/schemas/region' discounts: type: array items: - $ref: "#/components/schemas/region" + $ref: '#/components/schemas/region' gift_cards: type: array items: - $ref: "#/components/schemas/gift_card" + $ref: '#/components/schemas/gift_card' customer_id: type: string customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' payment_session: - $ref: "#/components/schemas/payment_session" + $ref: '#/components/schemas/payment_session' payment_sessions: type: array items: - $ref: "#/components/schemas/payment_session" + $ref: '#/components/schemas/payment_session' payment: - $ref: "#/components/schemas/payment" + $ref: '#/components/schemas/payment' shipping_methods: type: array items: - $ref: "#/components/schemas/shipping_method" + $ref: '#/components/schemas/shipping_method' type: type: string enum: @@ -6644,19 +6723,19 @@ components: images: type: array items: - $ref: "#/components/schemas/claim_image" + $ref: '#/components/schemas/claim_image' claim_order_id: type: string item_id: type: string item: description: The Line Item that the claim refers to - $ref: "#/components/schemas/line_item" + $ref: '#/components/schemas/line_item' variant_id: type: string variant: description: The Product Variant that is claimed. - $ref: "#/components/schemas/product_variant" + $ref: '#/components/schemas/product_variant' reason: description: The reason for the claim type: string @@ -6666,7 +6745,7 @@ components: - production_failure - other note: - description: "An optional note about the claim, for additional information" + description: 'An optional note about the claim, for additional information' type: string quantity: description: >- @@ -6677,7 +6756,7 @@ components: description: User defined tags for easy filtering and grouping. type: array items: - $ref: "#/components/schemas/claim_tag" + $ref: '#/components/schemas/claim_tag' created_at: type: string format: date-time @@ -6726,36 +6805,36 @@ components: description: The items that have been claimed type: array items: - $ref: "#/components/schemas/claim_item" + $ref: '#/components/schemas/claim_item' additional_items: description: >- Refers to the new items to be shipped when the claim order has the type `replace` type: array items: - $ref: "#/components/schemas/line_item" + $ref: '#/components/schemas/line_item' order_id: description: The id of the order that the claim comes from. type: string return_order: description: Holds information about the return if the claim is to be returned - $ref: "#/components/schemas/return" + $ref: '#/components/schemas/return' shipping_address_id: description: The id of the address that the new items should be shipped to type: string shipping_address: description: The address that the new items should be shipped to - $ref: "#/components/schemas/address" + $ref: '#/components/schemas/address' shipping_methods: description: The shipping methods that the claim order will be shipped with. type: array items: - $ref: "#/components/schemas/shipping_method" + $ref: '#/components/schemas/shipping_method' fulfillments: description: The fulfillments of the new items to be shipped type: array items: - $ref: "#/components/schemas/fulfillment" + $ref: '#/components/schemas/fulfillment' refund_amount: description: The amount that will be refunded in conjunction with the claim type: integer @@ -6870,11 +6949,11 @@ components: The id of the Shipping Option that the custom shipping option overrides anyOf: - - $ref: "#/components/schemas/shipping_option" + - $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" + - $ref: '#/components/schemas/cart' created_at: description: The date with timezone at which the resource was created. type: string @@ -6902,7 +6981,7 @@ components: customers: type: array items: - type: object + $ref: '#/components/schemas/customer' created_at: type: string format: date-time @@ -6928,11 +7007,11 @@ components: billing_address: description: The Customer's billing address. anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' shipping_addresses: type: array items: - $ref: "#/components/schemas/address" + $ref: '#/components/schemas/address' first_name: type: string last_name: @@ -6990,7 +7069,7 @@ components: description: A set of Products that the discount can be used for. type: array items: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' created_at: description: The date with timezone at which the resource was created. type: string @@ -7029,7 +7108,7 @@ components: rule: description: The Discount Rule that governs the behaviour of the Discount anyOf: - - $ref: "#/components/schemas/discount_rule" + - $ref: '#/components/schemas/discount_rule' is_disabled: description: >- Whether the Discount has been disabled. Disabled discounts cannot be @@ -7052,7 +7131,7 @@ components: description: The Regions in which the Discount can be used type: array items: - $ref: "#/components/schemas/region" + $ref: '#/components/schemas/region' usage_limit: description: The maximum number of times that a discount can be used. type: integer @@ -7092,12 +7171,12 @@ components: type: string cart: anyOf: - - $ref: "#/components/schemas/cart" + - $ref: '#/components/schemas/cart' order_id: type: string order: anyOf: - - $ref: "#/components/schemas/order" + - $ref: '#/components/schemas/order' canceled_at: type: string format: date-time @@ -7135,7 +7214,7 @@ components: item: description: The Line Item that the Fulfillment Item references. anyOf: - - $ref: "#/components/schemas/line_item" + - $ref: '#/components/schemas/line_item' quantity: description: The quantity of the Line Item that is included in the Fulfillment. type: integer @@ -7190,7 +7269,7 @@ components: about how many of each Line Item has been fulfilled. type: array items: - $ref: "#/components/schemas/fulfillment_item" + $ref: '#/components/schemas/fulfillment_item' tracking_links: description: >- The Tracking Links that can be used to track the status of the @@ -7198,7 +7277,7 @@ components: Provider. type: array items: - $ref: "#/components/schemas/tracking_link" + $ref: '#/components/schemas/tracking_link' tracking_numbers: deprecated: true description: >- @@ -7249,7 +7328,7 @@ components: gift_card: description: The Gift Card that was used in the transaction. anyOf: - - $ref: "#/components/schemas/gift_card" + - $ref: '#/components/schemas/gift_card' order_id: description: The id of the Order that the Gift Card was used to pay for. type: string @@ -7287,7 +7366,7 @@ components: region: description: The Region in which the Gift Card is available. anyOf: - - $ref: "#/components/schemas/region" + - $ref: '#/components/schemas/region' order_id: description: The id of the Order that the Gift Card was purchased in. type: string @@ -7435,7 +7514,7 @@ components: variant: description: The Product Variant contained in the Line Item. anyOf: - - $ref: "#/components/schemas/product_variant" + - $ref: '#/components/schemas/product_variant' quantity: description: The quantity of the content in the Line Item. type: integer @@ -7500,7 +7579,7 @@ components: region: description: The Region that the Money Amount is defined for. anyOf: - - $ref: "#/components/schemas/region" + - $ref: '#/components/schemas/region' created_at: description: The date with timezone at which the resource was created. type: string @@ -7536,7 +7615,7 @@ components: author: description: The author of the note. anyOf: - - $ref: "#/components/schemas/user" + - $ref: '#/components/schemas/user' created_at: description: The date with timezone at which the resource was created. type: string @@ -7595,7 +7674,7 @@ components: customer: description: The Customer that the Notification was sent to. anyOf: - - $ref: "#/components/schemas/customer" + - $ref: '#/components/schemas/customer' to: description: >- The address that the Notification was sent to. This will usually be @@ -7616,7 +7695,7 @@ components: Notification. type: array items: - $ref: "#/components/schemas/notification_resend" + $ref: '#/components/schemas/notification_resend' provider_id: description: The id of the Notification Provider that handles the Notification. type: string @@ -7735,76 +7814,76 @@ components: discounts: type: array items: - $ref: "#/components/schemas/discount" + $ref: '#/components/schemas/discount' email: type: string billing_address_id: type: string billing_address: anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' shipping_address_id: type: string shipping_address: anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' items: type: array items: - $ref: "#/components/schemas/line_item" + $ref: '#/components/schemas/line_item' region_id: type: string region: anyOf: - - $ref: "#/components/schemas/region" + - $ref: '#/components/schemas/region' gift_cards: type: array items: - $ref: "#/components/schemas/gift_card" + $ref: '#/components/schemas/gift_card' customer_id: type: string customer: anyOf: - - $ref: "#/components/schemas/customer" + - $ref: '#/components/schemas/customer' payment_session: anyOf: - - $ref: "#/components/schemas/payment_session" + - $ref: '#/components/schemas/payment_session' payment_sessions: type: array items: - $ref: "#/components/schemas/payment_session" + $ref: '#/components/schemas/payment_session' payments: type: array items: - $ref: "#/components/schemas/payment" + $ref: '#/components/schemas/payment' shipping_methods: type: array items: - $ref: "#/components/schemas/shipping_method" + $ref: '#/components/schemas/shipping_method' fulfillments: type: array items: - $ref: "#/components/schemas/fulfillment" + $ref: '#/components/schemas/fulfillment' returns: type: array items: - $ref: "#/components/schemas/return" + $ref: '#/components/schemas/return' claims: type: array items: - $ref: "#/components/schemas/claim_order" + $ref: '#/components/schemas/claim_order' refunds: type: array items: - $ref: "#/components/schemas/refund" + $ref: '#/components/schemas/refund' swaps: type: array items: - $ref: "#/components/schemas/refund" + $ref: '#/components/schemas/refund' gift_card_transactions: type: array items: - $ref: "#/components/schemas/gift_card_transaction" + $ref: '#/components/schemas/gift_card_transaction' canceled_at: type: string format: date-time @@ -7990,7 +8069,7 @@ components: description: The Products contained in the Product Collection. type: array items: - type: object + $ref: '#/components/schemas/product' created_at: description: The date with timezone at which the resource was created. type: string @@ -8070,7 +8149,7 @@ components: description: The Product Option Values that are defined for the Product Option. type: array items: - $ref: "#/components/schemas/product_option_value" + $ref: '#/components/schemas/product_option_value' product_id: description: The id of the Product that the Product Option is defined for. type: string @@ -8230,7 +8309,7 @@ components: Region. type: array items: - $ref: "#/components/schemas/money_amount" + $ref: '#/components/schemas/money_amount' sku: description: >- The unique stock keeping unit used to identify the Product Variant. @@ -8311,7 +8390,7 @@ components: description: The Product Option Values specified for the Product Variant. type: array items: - $ref: "#/components/schemas/product_option_value" + $ref: '#/components/schemas/product_option_value' created_at: description: The date with timezone at which the resource was created. type: string @@ -8369,7 +8448,7 @@ components: description: Images of the Product type: array items: - $ref: "#/components/schemas/image" + $ref: '#/components/schemas/image' thumbnail: description: A URL to an image file that can be used to identify the Product. type: string @@ -8380,14 +8459,14 @@ components: Option Values. type: array items: - $ref: "#/components/schemas/product_option" + $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. type: array items: - $ref: "#/components/schemas/product_variant" + $ref: '#/components/schemas/product_variant' profile_id: description: >- The id of the Shipping Profile that the Product belongs to. Shipping @@ -8441,16 +8520,16 @@ components: type: description: The Product Type of the Product (e.g. "Clothing") anyOf: - - $ref: "#/components/schemas/product_type" + - $ref: '#/components/schemas/product_type' collection: description: The Product Collection that the Product belongs to (e.g. "SS20") anyOf: - - $ref: "#/components/schemas/product_collection" + - $ref: '#/components/schemas/product_collection' tags: description: The Product Tags assigned to the Product. type: array items: - $ref: "#/components/schemas/product_tag" + $ref: '#/components/schemas/product_tag' created_at: description: The date with timezone at which the resource was created. type: string @@ -8542,21 +8621,21 @@ components: description: The countries that are included in the Region. type: array items: - $ref: "#/components/schemas/country" + $ref: '#/components/schemas/country' payment_providers: description: >- The Payment Providers that can be used to process Payments in the Region. type: array items: - $ref: "#/components/schemas/payment_provider" + $ref: '#/components/schemas/payment_provider' fulfillment_providers: description: >- The Fulfillment Providers that can be used to fulfill orders in the Region. type: array items: - $ref: "#/components/schemas/fulfillment_provider" + $ref: '#/components/schemas/fulfillment_provider' created_at: description: The date with timezone at which the resource was created. type: string @@ -8588,7 +8667,7 @@ components: item: description: The Line Item that the Return Item references. anyOf: - - $ref: "#/components/schemas/line_item" + - $ref: '#/components/schemas/line_item' quantity: description: The quantity of the Line Item that is included in the Return. type: integer @@ -8606,7 +8685,7 @@ components: reason: description: The reason for returning the item. anyOf: - - $ref: "#/components/schemas/return_reason" + - $ref: '#/components/schemas/return_reason' note: description: An optional note with additional details about the Return. type: string @@ -8668,7 +8747,7 @@ components: items: description: >- The Return Items that will be shipped back to the warehouse. type: - array items: $ref: + array items: $ref: swap_id: description: The id of the Swap that the Return is a part of. type: string @@ -8683,7 +8762,7 @@ components: 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" + - $ref: '#/components/schemas/shipping_method' shipping_data: description: >- Data about the return shipment as provided by the Fulfilment @@ -8734,7 +8813,7 @@ components: shipping_option: description: The Shipping Option that the Shipping Method is built from. anyOf: - - $ref: "#/components/schemas/shipping_option" + - $ref: '#/components/schemas/shipping_option' order_id: description: The id of the Order that the Shipping Method is used on. type: string @@ -8820,7 +8899,7 @@ components: region: description: The id of the Region that the Shipping Option belongs to. anyOf: - - $ref: "#/components/schemas/region" + - $ref: '#/components/schemas/region' profile_id: description: >- The id of the Shipping Profile that the Shipping Option belongs to. @@ -8858,7 +8937,7 @@ components: be available for a Cart. type: array items: - $ref: "#/components/schemas/shipping_option_requirement" + $ref: '#/components/schemas/shipping_option_requirement' data: description: >- The data needed for the Fulfillment Provider to identify the @@ -8909,7 +8988,7 @@ components: description: The Products that the Shipping Profile defines Shipping Options for. type: array items: - $ref: "#/components/schemas/product" + $ref: '#/components/schemas/product' shipping_options: description: >- The Shipping Options that can be used to fulfill the Products in the @@ -8917,7 +8996,7 @@ components: 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 @@ -8963,7 +9042,7 @@ components: type: object store: title: Store - description: "Holds settings for the Store, such as name, currencies, etc." + description: 'Holds settings for the Store, such as name, currencies, etc.' x-resourceId: store properties: id: @@ -8981,7 +9060,7 @@ components: description: The currencies that are enabled for the Store. type: array items: - $ref: "#/components/schemas/currency" + $ref: '#/components/schemas/currency' swap_link_template: description: >- A template to generate Swap links from use {{cart_id}} to include @@ -9047,22 +9126,22 @@ components: description: The new Line Items to ship to the Customer. type: array items: - $ref: "#/components/schemas/line_item" + $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" + - $ref: '#/components/schemas/return' fulfillments: description: The Fulfillments used to send the new Line Items. type: array items: - $ref: "#/components/schemas/fulfillment" + $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" + - $ref: '#/components/schemas/payment' difference_due: description: >- The difference that is paid or refunded as a result of the Swap. May @@ -9074,17 +9153,17 @@ components: 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" + - $ref: '#/components/schemas/address' shipping_methods: description: The Shipping Methods used to fulfill the addtional items purchased. type: array items: - $ref: "#/components/schemas/shipping_method" + $ref: '#/components/schemas/shipping_method' cart_id: description: The id of the Cart that the Customer will use to confirm the Swap. type: string allow_backorder: - description: "If true, swaps can be completed with items out of stock" + description: 'If true, swaps can be completed with items out of stock' type: boolean confirmed_at: description: >- @@ -9105,7 +9184,7 @@ components: type: string format: date-time no_notification: - description: "If set to true, no notification will be sent related to this swap" + description: 'If set to true, no notification will be sent related to this swap' type: boolean metadata: description: An optional key-value map with additional information. @@ -9243,7 +9322,7 @@ components: last_name: description: The Customer's billing address. anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' created_at: type: string format: date-time diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index 1e8028adf1..6cc525b2ab 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -75,89 +75,6 @@ } ], "paths": { - "/collections/{id}": { - "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" - } - } - } - } - } - } - } - } - }, - "/collections": { - "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 - } - } - ], - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - } - }, "/auth": { "post": { "operationId": "PostAuth", @@ -283,137 +200,24 @@ } } }, - "/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, + "/collections/{id}": { + "get": { + "operationId": "GetCollectionsCollection", + "summary": "Retrieve a Product Collection", + "description": "Retrieves a Product Collection.", "parameters": [ { "in": "path", - "name": "address_id", + "name": "id", "required": true, - "description": "The id of the Address to remove.", + "description": "The id of the Product Collection", "schema": { "type": "string" } } ], "tags": [ - "Customer" + "Collection" ], "responses": { "200": { @@ -422,8 +226,8 @@ "application/json": { "schema": { "properties": { - "customer": { - "$ref": "#/components/schemas/customer" + "collection": { + "$ref": "#/components/schemas/product_collection" } } } @@ -431,237 +235,35 @@ } } } - }, - "post": { - "operationId": "PostCustomersCustomerAddressesAddress", - "summary": "Update a Shipping Address", - "description": "Updates a Customer's saved Shipping Address.", - "x-authenticated": true, + } + }, + "/collections": { + "get": { + "operationId": "GetCollections", + "summary": "List Product Collections", + "description": "Retrieve a list of Product Collection.", "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.", + "description": "The number of collections to skip before starting to collect the collections set", "schema": { - "type": "integer" + "type": "integer", + "default": 0 } }, { "in": "query", - "name": "fields", - "description": "(Comma separated string) Which fields should be included in the resulting addresses.", + "name": "limit", + "description": "The number of collections to return", "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "expand", - "description": "(Comma separated string) Which relations should be expanded in the resulting addresses.", - "schema": { - "type": "string" + "type": "integer", + "default": 10 } } ], "tags": [ - "Customer" + "Collection" ], "responses": { "200": { @@ -670,23 +272,8 @@ "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" - } + "collection": { + "$ref": "#/components/schemas/product_collection" } } } @@ -696,95 +283,6 @@ } } }, - "/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." - } - } - } - } - } - } - } - }, "/carts/{id}/shipping-methods": { "post": { "operationId": "PostCartsCartShippingMethod", @@ -1512,7 +1010,7 @@ "/store/carts/{id}": { "post": { "operationId": "PostCartsCartPaymentMethodUpdate", - "summary": "Update a Cart", + "summary": "Update a Cart\"", "description": "Updates a Cart.", "parameters": [ { @@ -1616,34 +1114,45 @@ } } }, - "/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" + "/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": [ - "Product" + "Customer" ], "responses": { "200": { - "description": "OK", + "description": "A successful response", "content": { "application/json": { "schema": { "properties": { - "product": { - "$ref": "#/components/schemas/product" + "customer": { + "$ref": "#/components/schemas/customer" } } } @@ -1653,127 +1162,337 @@ } } }, - "/products": { - "get": { - "operationId": "GetProducts", - "summary": "List Products", - "description": "Retrieves a list of Products.", + "/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": "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", - "description": "Collection ids to search for.", - "schema": { - "type": "array" - } - }, - { - "in": "query", - "name": "tags", - "description": "Tags to search for.", - "schema": { - "type": "array" - } - }, - { - "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.", + "in": "path", + "name": "address_id", + "required": true, + "description": "The id of the Address to remove.", "schema": { "type": "string" } } ], "tags": [ - "Product" + "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": { @@ -1783,7 +1502,7 @@ "schema": { "properties": { "count": { - "description": "The total number of Products.", + "description": "The total number of Orders.", "type": "integer" }, "offset": { @@ -1791,13 +1510,13 @@ "type": "integer" }, "limit": { - "description": "The maxmimum number of Products to return,", + "description": "The maxmimum number of Orders to return,", "type": "integer" }, - "products": { + "orders": { "type": "array", "items": { - "$ref": "#/components/schemas/product" + "$ref": "#/components/schemas/order" } } } @@ -1808,6 +1527,95 @@ } } }, + "/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", @@ -1928,6 +1736,208 @@ } } }, + "/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", @@ -3002,7 +3012,7 @@ "customers": { "type": "array", "items": { - "type": "object" + "$ref": "#/components/schemas/customer" } }, "created_at": { @@ -4328,7 +4338,7 @@ "description": "The Products contained in the Product Collection.", "type": "array", "items": { - "type": "object" + "$ref": "#/components/schemas/product" } }, "created_at": { diff --git a/docs/api/store-spec3.yaml b/docs/api/store-spec3.yaml index fd11e6d96c..915364c7fd 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -122,7 +122,651 @@ paths: properties: exists: type: boolean - "/collections/{id}": + '/carts/{id}/shipping-methods': + 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: A successful response + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + 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. + '/carts/{id}/taxes': + 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: A cart object with the tax_total field populated + content: + application/json: + schema: + oneOf: + - type: object + properties: + cart: + $ref: '#/components/schemas/cart' + '/carts/{id}/complete': + 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: + 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' + /carts: + 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. + country_code: + type: string + description: The 2 character ISO country code to create the Cart in. + items: + description: >- + An optional array of `variant_id`, `quantity` pairs to + generate Line Items from. + type: array + items: + 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 + tags: + - Cart + responses: + '200': + description: Successfully created a new Cart + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/carts/{id}/line-items': + 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' + 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. + '/carts/{id}/payment-sessions': + 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' + '/carts/{id}/discounts/{code}': + 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' + '/carts/{id}/line-items/{line_id}': + 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' + 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" + requestBody: + content: + application/json: + schema: + type: object + required: + - quantity + properties: + quantity: + type: integer + description: The quantity to set the Line Item to. + '/carts/{id}/payment-sessions/{provider_id}': + 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' + 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' + requestBody: + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: object + description: The data to update the payment session with. + '/carts/{id}': + 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' + '/carts/{id}/payment-sessions/{provider_id}/refresh': + 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' + '/carts/{id}/payment-session': + 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" + requestBody: + content: + application/json: + schema: + type: object + required: + - provider_id + properties: + provider_id: + type: string + description: The id of the Payment Provider. + '/store/carts/{id}': + post: + operationId: PostCartsCartPaymentMethodUpdate + 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: + required: + - provider_id + properties: + provider_id: + type: string + description: The id of the Payment Provider. + data: + type: object + description: '' + tags: + - Cart + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + cart: + $ref: '#/components/schemas/cart' + '/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 + 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' + '/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' + '/collections/{id}': get: operationId: GetCollectionsCollection summary: Retrieve a Product Collection @@ -137,14 +781,14 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/product_collection" + $ref: '#/components/schemas/product_collection' /collections: get: operationId: GetCollections @@ -168,14 +812,14 @@ paths: tags: - Collection responses: - "200": + '200': description: OK content: application/json: schema: properties: collection: - $ref: "#/components/schemas/product_collection" + $ref: '#/components/schemas/product_collection' /customers/me/addresses: post: operationId: PostCustomersCustomerAddresses @@ -192,18 +836,18 @@ paths: address: description: The Address to add to the Customer. anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' tags: - Customer responses: - "200": + '200': description: A successful response content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' /customers: post: operationId: PostCustomers @@ -220,7 +864,7 @@ paths: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' requestBody: content: application/json: @@ -247,7 +891,7 @@ paths: phone: type: string description: The Customer's phone number. - "/customers/me/addresses/{address_id}": + '/customers/me/addresses/{address_id}': delete: operationId: DeleteCustomersCustomerAddressesAddress summary: Delete an Address @@ -270,7 +914,7 @@ paths: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' post: operationId: PostCustomersCustomerAddressesAddress summary: Update a Shipping Address @@ -291,7 +935,7 @@ paths: address: description: The updated Address. anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' tags: - Customer responses: @@ -302,7 +946,7 @@ paths: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' /customers/me: get: operationId: GetCustomersCustomer @@ -314,14 +958,14 @@ paths: tags: - Customer responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' post: operationId: PostCustomersCustomer summary: Update Customer details @@ -341,7 +985,7 @@ paths: billing_address: description: The Address to be used for billing purposes. anyOf: - - $ref: "#/components/schemas/address" + - $ref: '#/components/schemas/address' password: description: The Customer's password. type: string @@ -364,7 +1008,7 @@ paths: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' /customers/me/payment-methods: get: operationId: GetCustomersCustomerPaymentMethods @@ -377,7 +1021,7 @@ paths: tags: - Customer responses: - "200": + '200': description: OK content: application/json: @@ -444,12 +1088,12 @@ paths: description: The offset for pagination. type: integer limit: - description: "The maxmimum number of Orders to return," + description: 'The maxmimum number of Orders to return,' type: integer orders: type: array items: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' /customers/password-token: post: operationId: PostCustomersCustomerPasswordToken @@ -462,7 +1106,7 @@ paths: tags: - Customer responses: - "204": + '204': description: OK requestBody: content: @@ -493,7 +1137,7 @@ paths: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' requestBody: content: application/json: @@ -513,20 +1157,20 @@ paths: password: type: string description: The new password to set for the Customer. - "/gift-cards/{code}": + '/regions/{id}': get: - operationId: GetGiftCardsCode - summary: Retrieve Gift Card by Code - description: Retrieves a Gift Card by its associated unqiue code. + operationId: GetRegionsRegion + summary: Retrieves a Region + description: Retrieves a Region. parameters: - in: path - name: code + name: id required: true - description: The unique Gift Card code. + description: The id of the Region. schema: type: string tags: - - Gift Card + - Region responses: "200": description: OK @@ -534,435 +1178,15 @@ 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" - "/carts/{id}/shipping-methods": - 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: A successful response - content: - application/json: - schema: - properties: - cart: - $ref: "#/components/schemas/cart" - 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. - "/carts/{id}/taxes": - 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: A cart object with the tax_total field populated - content: - application/json: - schema: - oneOf: - - type: object - properties: - cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/complete": - 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: - 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" - /carts: - 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. - country_code: - type: string - description: The 2 character ISO country code to create the Cart in. - items: - description: >- - An optional array of `variant_id`, `quantity` pairs to - generate Line Items from. - type: array - items: - 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 - tags: - - Cart - responses: - "200": - description: Successfully created a new Cart - content: - application/json: - schema: - properties: - cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/line-items": - 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" - 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. - "/carts/{id}/payment-sessions": - 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" - "/carts/{id}/discounts/{code}": - 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" - "/carts/{id}/line-items/{line_id}": - 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" - 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" - requestBody: - content: - application/json: - schema: - type: object - required: - - quantity - properties: - quantity: - type: integer - description: The quantity to set the Line Item to. - "/carts/{id}/payment-sessions/{provider_id}": - 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" - 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" - requestBody: - content: - application/json: - schema: - type: object - required: - - data - properties: - data: - type: object - description: The data to update the payment session with. - "/carts/{id}": + $ref: '#/components/schemas/region' + /regions: 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 + operationId: GetRegions + summary: List Regions + description: Retrieves a list of Regions. tags: - - Cart + - Region responses: "200": description: OK @@ -970,194 +1194,20 @@ paths: application/json: schema: properties: - cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/payment-sessions/{provider_id}/refresh": - 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" - "/carts/{id}/payment-session": - 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" - requestBody: - content: - application/json: - schema: - type: object - required: - - provider_id - properties: - provider_id: - type: string - description: The id of the Payment Provider. - "/store/carts/{id}": - post: - operationId: PostCartsCartPaymentMethodUpdate - 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: - required: - - provider_id - properties: - provider_id: - type: string - description: The id of the Payment Provider. - data: - type: object - description: "" - tags: - - Cart - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - cart: - $ref: "#/components/schemas/cart" - "/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}": + 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' + '/products/{id}': get: operationId: GetProductsProduct summary: Retrieves a Product @@ -1198,14 +1248,22 @@ paths: type: string - in: query name: collection_id - description: Collection ids to search for. + style: form + explode: false + description: Collection ids to search for schema: type: array + items: + type: string - in: query name: tags - description: Tags to search for. + style: form + explode: false + description: Tags to search for schema: type: array + items: + type: string - in: query name: title description: to search for. @@ -1283,58 +1341,8 @@ paths: 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" - "/return-reasons/{id}": + $ref: '#/components/schemas/product' + '/return-reasons/{id}': get: operationId: GetReturnReasonsReason summary: Retrieve a Return Reason @@ -2044,7 +2052,7 @@ components: customers: type: array items: - type: object + $ref: '#/components/schemas/customer' created_at: type: string format: date-time @@ -3132,7 +3140,7 @@ components: description: The Products contained in the Product Collection. type: array items: - type: object + $ref: '#/components/schemas/product' created_at: description: The date with timezone at which the resource was created. type: string diff --git a/docs/api/store/endpoints/products.yaml b/docs/api/store/endpoints/products.yaml index ea09aa34eb..29251734b6 100644 --- a/docs/api/store/endpoints/products.yaml +++ b/docs/api/store/endpoints/products.yaml @@ -7,7 +7,7 @@ routes: path: /products/:id route: /products description: > - A product represents the object, that is to be sold on the website. A product can have variants, that differ by e.g. size and color. + 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 diff --git a/docs/content/add-plugins/algolia.md b/docs/content/add-plugins/algolia.md index a5d13f5c62..c6de15bff7 100644 --- a/docs/content/add-plugins/algolia.md +++ b/docs/content/add-plugins/algolia.md @@ -57,7 +57,7 @@ And that's all! You've now enabled Algolia for your Medusa store engine. The plu **Usage** -This article will not go too much into depth about how the search functionality works under the hood when querying the API. We refer to the [previous article on MeiliSearch](https://www.medusajs.com/post/meilisearch-and-medusa) if this is of your interest. In there, you will find a quick showcase using Postman as well as a thorough walkthrough of how you can display the results in your storefront using ReactJS (GatsbyJS). +This article will not go too much into depth about how the search functionality works under the hood when querying the API. We refer to the [previous article on MeiliSearch](https://medusajs.com/blog/meilisearch-medusa) if this is of your interest. In there, you will find a quick showcase using Postman as well as a thorough walkthrough of how you can display the results in your storefront using ReactJS (GatsbyJS). Instead, to illustrate the power of our Search API and search engine plugins, we'll switch out a MeiliSearch plugin with our new Algolia plugin in a store with existing products. Upon restarting the server with the new configuration, your products will automatically be fed into Algolia and the search functionality in your frontend will remain unchanged. diff --git a/docs/content/add-plugins/minio.md b/docs/content/add-plugins/minio.md index 3053b7f007..77a1f16ceb 100644 --- a/docs/content/add-plugins/minio.md +++ b/docs/content/add-plugins/minio.md @@ -1,57 +1,138 @@ # MinIO -In order to work with images in Medusa, you need a file service plugin responsible for hosting. Following this guide will allow you to upload images to MinIO bucket. +This document will guide you through installing the MinIO file service plugin on your Medusa server. -### Before you start +## Overview -At this point, you should have an instance of our store engine running. If not, we have a [full guide](https://docs.medusajs.com/tutorial/set-up-your-development-environment) for setting up your local environment. +To manage images in Medusa, you need a file service plugin responsible for hosting. Without a file service plugin, you will face issues while working with Medusa, such as when uploading images for products. -### Set up MinIO +Medusa provides three different options to handle your file storage. This document will focus on setting up [MinIO](https://min.io) on your local machine and connecting Medusa to it. -#### Create an MinIO bucket +## Prerequisites -In the MinIO console create a new bucket, then click into that bucket and change the `Access Policy` to `public`. +A Medusa server is required to be set up before following along with this document. You can follow the [quickstart guide](../quickstart/quick-start.md) to get started in minutes. -Be aware, that this will allow for anyone to acces your bucket. Avoid storing sensitive data. +## Set up MinIO -#### Generate access keys +You can follow [MinIO’s guide to install it](https://docs.min.io/minio/baremetal/quickstart/quickstart.html) on your machine based on your operating system. -Navigate to users and perform the following steps: +After installing it, make sure MinIO is always running when your Medusa server is running. It’s recommended that you set up an alias to quickly start the MinIO server as instructed at the end of the installation guides in MinIO. -- Enter new `Access Key` and `Secret Key` -- Select readwrite policy -- Submit the details +:::warning -### Installation +In MinIO’s documentation, port `9000` is used for the address of the MinIO server. However, this collides with the port for the Medusa server. You must change the port for MinIO to another one (for example, port `9001`). -First, install the plugin using your preferred package manager: +::: -```bash npm2yarn +### Create a MinIO bucket + +After installing MinIO and logging into the Console, click on “Create Bucket” to create a new bucket that will store the files of your Medusa server. + +![Create Bucket](https://i.imgur.com/PwLldKt.png) + +Then, in the form, enter a name for the bucket and click on Create Bucket. By MinIO’s requirement, the name can only consist of lower case characters, numbers, dots (`.`), and hyphens (`-`). + +![Bucket Info](https://i.imgur.com/UB477rl.png) + +After creating the bucket, click on the cog icon at the top right to configure the bucket. + +![Configure Bucket](https://i.imgur.com/0pB8RIM.png) + +Then, click on the edit icon next to Access Policy. This will open a pop-up. + +![Access Policy](https://i.imgur.com/qo3QQz4.png) + +In the pop-up, change the selected value to “public” and click Set. + +:::warning + +Changing the Access Policy to public will allow anyone to access your bucket. Avoid storing sensitive data in the bucket. + +::: + +### Generate Access Keys + +From the sidebar of your MinIO console, click on Identity then Service Accounts. + +![Service Accounts Sidebar](https://i.imgur.com/CkTbrEc.png) + +Then, click on Create Service Account. + +![Create Service Account](https://i.imgur.com/a000HQf.png) + +This will generate a random Access Key and Secret Key for you. + +![Generated Keys](https://i.imgur.com/my4c7zU.png) + +Click on Create. A pop-up will then show the value for your Access Key and Secret Key. Copy them to use in the next section. + +:::caution + +You will not be able to access the Secret Key after closing the pop-up. So, make sure to store it somewhere to use later when configuring the plugin. + +::: + +## Plugin Installation + +In the directory of your Medusa server, run the following command to install the MinIO plugin: + +```bash npm install medusa-file-minio ``` -Then configure your `medusa-config.js` to include the plugin alongside the required options: +Then, add the following environment variables in `.env`: -```=javascript +```bash +MINIO_ENDPOINT= +MINIO_BUCKET= +MINIO_ACCESS_KEY= +MINIO_SECRET_KEY= +``` + +Where `` is the URL of your MinIO server, `` is the name of the bucket you created earlier, and `` and `` are the keys you generated in the previous section. + +Finally, configure your `medusa-config.js` to include the plugin with the required options: + +```bash { resolve: `medusa-file-minio`, options: { - endpoint: "minio.server.com", - bucket: "test", - access_key_id: "YOUR-ACCESS-KEY", - secret_access_key: "YOUR-SECRET-KEY", + endpoint: process.env.MINIO_ENDPOINT, + bucket: process.env.MINIO_BUCKET, + access_key_id: process.env.MINIO_ACCESS_KEY, + secret_access_key: process.env.MINIO_SECRET_KEY, }, }, ``` -The two access keys in the options are the ones created in the previous section. +## Test it Out -:::tip +Run your Medusa server alongside the [Medusa Admin](../admin/quickstart.md) to try out your new file service. Upon editing or creating products, you can now upload thumbnails and images, that are stored in a MinIO server. -Make sure to use an environment variable for the secret key in a live environment. +![Image Uploaded on Admin](https://i.imgur.com/alabX2i.png) -::: +## Next.js Storefront Configuration -### Try it out +If you’re using a [Next.js](../starters/nextjs-medusa-starter.md) storefront, you need to add an additional configuration that adds the MinIO domain name into the configured images domain names. This is because all URLs of product images will be from the MinIO server. -Finally, run your Medusa server alongside our admin system to try out your new file service. Upon editing or creating products, you can now upload thumbnails and images, that are stored in an MinIO server. +If this configuration is not added, you’ll receive the error ["next/image Un-configured Host”](https://nextjs.org/docs/messages/next-image-unconfigured-host). + +In `next.config.js` add the following option in the exported object: + +```jsx +module.exports = { + //other options + images: { + domains: [ + "127.0.0.1", + //any other domains... + ], + }, +} +``` + +Where `127.0.0.1` is the domain of your local MinIO server. + +## What’s Next 🚀 + +- Check out [more plugins](https://github.com/medusajs/medusa/tree/master/packages) you can add to your store. diff --git a/docs/content/add-plugins/sendgrid.mdx b/docs/content/add-plugins/sendgrid.mdx index 9696b0f2ed..9f602f1601 100644 --- a/docs/content/add-plugins/sendgrid.mdx +++ b/docs/content/add-plugins/sendgrid.mdx @@ -24,7 +24,7 @@ By integrating SendGrid with Medusa, you’ll be sending email notifications to Before going further with this guide make sure you have a Medusa server set up. You can follow our [Quickstart guide](../quickstart/quick-start.md). -You also must have [Redis configured on your Medusa server](../tutorial/0-set-up-your-development-environment.md). Sending emails is done through Subscribers, which uses Redis as the event queue. If you don’t set up Redis, the plugin will not send emails. +You also must have [Redis configured on your Medusa server](/tutorial/set-up-your-development-environment#redis). Sending emails is done through Subscribers, which uses Redis as the event queue. If you don’t set up Redis, the plugin will not send emails. ## Create a SendGrid Account diff --git a/docs/content/add-plugins/stripe.md b/docs/content/add-plugins/stripe.md index 4ca268ad95..76388d2b48 100644 --- a/docs/content/add-plugins/stripe.md +++ b/docs/content/add-plugins/stripe.md @@ -48,8 +48,8 @@ const plugins = [ { resolve: `medusa-payment-stripe`, options: { - api_key: STRIPE_API_KEY, - webhook_secret: STRIPE_WEBHOOK_SECRET, + api_key: process.env.STRIPE_API_KEY, + webhook_secret: process.env.STRIPE_WEBHOOK_SECRET, }, }, ]; @@ -57,7 +57,7 @@ const plugins = [ :::note -You might find that this code is already available but commented out. You can proceed with removing the comments instead of adding the code again. +You might find that this code is already available but commented out. You can proceed with removing the comments instead of adding the code again, but make sure to replace `STRIPE_API_KEY` and `STRIPE_WEBHOOK_SECRET` with `process.env.STRIPE_API_KEY` and `process.env.STRIPE_WEBHOOK_SECRET` respectively. ::: @@ -131,7 +131,7 @@ All storefronts require that you obtain your Stripe’s Publishable Key. You can Medusa has a Next.js storefront that you can easily use with your Medusa server. If you don’t have the storefront installed, you can follow [this quickstart guide](../starters/nextjs-medusa-starter). -In your `.env` file, add the following variable with its value set to the Publishable Key: +In your `.env.local` file (or the file you’re using for your environment variables), add the following variable with its value set to the Publishable Key: ```jsx NEXT_PUBLIC_STRIPE_KEY=pk_... diff --git a/docs/content/add-plugins/twilio-sms.md b/docs/content/add-plugins/twilio-sms.md index af30de60f9..44b09d9436 100644 --- a/docs/content/add-plugins/twilio-sms.md +++ b/docs/content/add-plugins/twilio-sms.md @@ -66,7 +66,7 @@ In this example, you’ll create a subscriber that listens to the `order.placed` :::tip -For this example to work, you’ll need to install and configure Redis on your server. You can refer to the [development guide](../tutorial/0-set-up-your-development-environment.md#redis) to learn how to do that. +For this example to work, you’ll need to install and configure Redis on your server. You can refer to the [development guide](/tutorial/set-up-your-development-environment#redis) to learn how to do that. ::: diff --git a/docs/content/advanced/backend/endpoints/add-admin.md b/docs/content/advanced/backend/endpoints/add-admin.md index 3a85231e7f..65d9ff7117 100644 --- a/docs/content/advanced/backend/endpoints/add-admin.md +++ b/docs/content/advanced/backend/endpoints/add-admin.md @@ -66,11 +66,11 @@ const corsOptions = { } ``` -Finally, for each route you add, create an `OPTIONS` request: +Finally, for each route you add, create an `OPTIONS` request and add `cors` as a middleware for the route: ```js router.options("/admin/hello", cors(corsOptions)) -router.get("/admin/hello", (req, res) => { +router.get("/admin/hello", cors(corsOptions), (req, res) => { //... }) ``` diff --git a/docs/content/advanced/backend/endpoints/add-storefront.md b/docs/content/advanced/backend/endpoints/add-storefront.md index 7f67980631..adb738edbe 100644 --- a/docs/content/advanced/backend/endpoints/add-storefront.md +++ b/docs/content/advanced/backend/endpoints/add-storefront.md @@ -46,6 +46,34 @@ npm run build ::: +## Accessing Endpoints from Storefront + +If you’re customizing one of our storefronts or creating your own, you need to use the `cors` library. + +First, you need to import your Medusa’s configurations along with the `cors` library: + +```js +import cors from "cors" +import { projectConfig } from "../../medusa-config" +``` + +Then, create an object that will hold the CORS configurations: + +```js +const corsOptions = { + origin: projectConfig.store_cors.split(","), + credentials: true, +} +``` + +Finally, for each route add `cors` as a middleware for the route passing it `corsOptions`: + +```js +router.get("/store/hello", cors(corsOptions), (req, res) => { + //... +}) +``` + ## Multiple Endpoints ### Same File diff --git a/docs/content/advanced/backend/migrations.md b/docs/content/advanced/backend/migrations.md new file mode 100644 index 0000000000..6fec10cb73 --- /dev/null +++ b/docs/content/advanced/backend/migrations.md @@ -0,0 +1,97 @@ +# Migrations + +In this document, you’ll learn about what Migrations are, their purpose, how you can run them, and how you can create your own Migrations. + +:::note + +Medusa’s Migrations do not work with SQLite databases. They are intended to be used with PostgreSQL databases, which is the recommended Database for your Medusa production server. + +::: + +## Overview + +Migrations are scripts that are used to make additions or changes to your database schema. In Medusa, they are essential for both when you first install your server and for subsequent server upgrades later on. + +When you first create your Medusa server, the database schema used must have all the tables necessary for the server to run. + +When a new Medusa version introduces changes to the database schema, you'll have to run migrations to apply them to your own database. + +:::tip + +Migrations are used to apply changes to the database schema. However, there are some version updates of Medusa that require updating the data in your database to fit the new schema. Those are specific to each version and you should check out the version under Upgrade Guides for details on the steps. + +::: + +## How to Run Migrations + +Migrations in Medusa can be done in one of two ways: + +### Migrate Command + +Using the Medusa CLI tool, you can run migrations with the following command: + +```bash +medusa migrations run +``` + +This will check for any migrations that contain changes to your database schema that aren't applied yet and run them on your server. + +### Seed Command + +Seeding is the process of filling your database with data that is either essential or for testing and demo purposes. In Medusa, the `seed` command will run the migrations to your database if necessary before it seeds your database with dummy data. + +You can use the following command to seed your database: + +```bash npm2yarn +npm run seed +``` + +This will use the underlying `seed` command provided by Medusa's CLI to seed your database with data from the file `data/seed.json` on your Medusa server. + +## How to Create Migrations + +In this section, you’ll learn how to create your own migrations using [Typeorm](https://typeorm.io). This will allow you to modify Medusa’s predefined tables or create your own tables. + +### Create Migration + +To create a migration that makes changes to your Medusa schema, run the following command: + +```bash +npx typeorm migration:create -n UserChanged --dir src/path +``` + +:::tip + +The migration file should be inside the src directory to make sure it is built when the build command is run next. + +::: + +This will create the migration file in the path you specify. You can use this without the need to install Typeorm's CLI tool. You can then go ahead and make changes to it as necessary. + +:::tip + +You can learn more about writing migrations in [Typeorm’s Documentation](https://typeorm.io/migrations). + +::: + +### Build Files + +Before you can run the migrations you need to run the build command to transpile the TypeScript files to JavaScript files: + +```bash npm2yarn +npm run build +``` + +### Run Migration + +The last step is to run the migration with the command detailed earlier + +```bash +medusa migrations run +``` + +If you check your database now you should see that the change defined by the migration has been applied successfully. + +## What’s Next 🚀 + +- Learn more about [setting up your development server](/tutorial/set-up-your-development-environment). diff --git a/docs/content/advanced/backend/payment/how-to-create-payment-provider.md b/docs/content/advanced/backend/payment/how-to-create-payment-provider.md index 53295890ce..8037f3374f 100644 --- a/docs/content/advanced/backend/payment/how-to-create-payment-provider.md +++ b/docs/content/advanced/backend/payment/how-to-create-payment-provider.md @@ -6,7 +6,7 @@ In this document, you’ll learn how to add a Payment Provider to your Medusa se A Payment Provider is the payment method used to authorize, capture, and refund payment, among other actions. An example of a Payment Provider is Stripe. -By default, Medusa has a [manual payment provider](https://github.com/medusajs/medusa/tree/2e6622ec5d0ae19d1782e583e099000f0a93b051/packages/medusa-fulfillment-manual) that has minimal implementation. It can be synonymous with a Cash on Delivery payment method. It allows store operators to manage the payment themselves but still keep track of its different stages on Medusa. +By default, Medusa has a [manual payment provider](https://github.com/medusajs/medusa/tree/master/packages/medusa-payment-manual) that has minimal implementation. It can be synonymous with a Cash on Delivery payment method. It allows store operators to manage the payment themselves but still keep track of its different stages on Medusa. Adding a Payment Provider is as simple as creating a [service](../services/create-service.md) file in `src/services`. A Payment Provider is essentially a service that extends `PaymentService` from `medusa-interfaces`. @@ -42,9 +42,9 @@ These methods are used at different points in the Checkout flow as well as when ![Payment Flows.jpg](https://i.imgur.com/WeDr0ph.jpg) -## Create a Fulfillment Provider +## Create a Payment Provider -The first step to create a fulfillment provider is to create a file in `src/services` with the following content: +The first step to create a payment provider is to create a file in `src/services` with the following content: ```jsx import { PaymentService } from "medusa-interfaces" diff --git a/docs/content/advanced/backend/payment/overview.md b/docs/content/advanced/backend/payment/overview.md index c65119176a..a34c19e4e3 100644 --- a/docs/content/advanced/backend/payment/overview.md +++ b/docs/content/advanced/backend/payment/overview.md @@ -127,4 +127,4 @@ This prevents any payment issues from occurring with the customers and allows fo ## What’s Next 🚀 - [Check out how the checkout flow is implemented on the frontend.](./frontend-payment-flow-in-checkout.md) -- Check out payment plugins like [Stripe](../../../add-plugins/stripe.md), [Paypal](../../../add-plugins/paypal.md), and [Klarna](../../../add-plugins/klarna.md). +- Check out payment plugins like [Stripe](../../../add-plugins/stripe.md), [Paypal](/add-plugins/paypal), and [Klarna](../../../add-plugins/klarna.md). diff --git a/docs/content/advanced/backend/services/create-service.md b/docs/content/advanced/backend/services/create-service.md index 6ddfc01017..d7b2e692b1 100644 --- a/docs/content/advanced/backend/services/create-service.md +++ b/docs/content/advanced/backend/services/create-service.md @@ -102,4 +102,5 @@ constructor({ helloService, eventBusService }) { ## What’s Next 🚀 +- Check out the [Services Reference](/references/services/classes/AuthService) to see a list of all services in Medusa. - [Learn How to Create an Endpoint.](/advanced/backend/endpoints/add-storefront) diff --git a/docs/content/advanced/backend/subscribers/create-subscriber.md b/docs/content/advanced/backend/subscribers/create-subscriber.md index f8e711419d..2f9c057d9e 100644 --- a/docs/content/advanced/backend/subscribers/create-subscriber.md +++ b/docs/content/advanced/backend/subscribers/create-subscriber.md @@ -93,4 +93,5 @@ You can then use `this.productService` anywhere in your subscriber’s methods. ## What’s Next 🚀 +- [View the list of all events](events-list.md) - [Learn how to create a service.](/advanced/backend/services/create-service) diff --git a/docs/content/advanced/backend/subscribers/events-list.md b/docs/content/advanced/backend/subscribers/events-list.md new file mode 100644 index 0000000000..1f76d6fa2d --- /dev/null +++ b/docs/content/advanced/backend/subscribers/events-list.md @@ -0,0 +1,1865 @@ +# Events List + +This document details all events in Medusa, when they are triggered, and what data your handler method will receive when the event is triggered. + +## Prerequisites + +It is assumed you’re already familiar with [Subscribers in Medusa and how to listen to events](create-subscriber.md). You can then use the name of events from this documentation in your subscriber to listen to events. + +## Legend + +Events in this document are listed under the entity they’re associated with. They’re listed in a table of 3 columns: + +1. **Event Name:** The name you use to subscribe a handler for the event. +2. **Description:** When this event is triggered. +3. **Event Data Payload**: The data your handler receives as a parameter. + +## Batch Jobs Events + +This section holds all events related to batch jobs. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`batch.created` + + +Triggered when a batch job is created. + +Object of the following format: + +```js +{ + id //string ID of batch job +} +``` + +
+ +`batch.updated` + + +Triggered when a batch job is updated. + +Object of the following format: + +```js +{ + id //string ID of batch job +} +``` + +
+ +`batch.canceled` + + +Triggered when a batch job is canceled. + +Object of the following format: + +```js +{ + id //string ID of batch job +} +``` + +
+ +## Cart Events + +This section holds all events related to a cart. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`cart.customer_updated` + + +Triggered when a cart is associated with a different email than it was already associated with, or if a customer logs in after adding items to their cart as a guest. + +The cart ID passed as a string parameter. +
+ +`cart.created` + + +Triggered when a cart is created. + +Object of the following format: + +```js +{ + id //string ID of cart +} +``` + +
+ +`cart.updated` + + + +Triggered when a cart and data associated with it (payment sessions, shipping methods, user details, etc…) are updated. + + + +The entire cart as an object. You can refer to the [Cart model](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/models/cart.ts) for an idea of what fields to expect. + +
+ +## Claim Events + +This section holds all events related to claims. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`claim.created` + + + +Triggered when a claim is created. + + + +Object of the following format: + +```js +{ + id, //string ID of claim + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`claim.updated` + + + +Triggered when a claim is updated. + + + +Object of the following format: + +```js +{ + id, //string ID of claim + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`claim.canceled` + + + +Triggered when a claim is canceled. + + + +Object of the following format: + +```js +{ + id, //string ID of claim + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`claim.fulfillment_created` + + + +Triggered when fulfillment is created for a claim. + + + +Object of the following format: + +```js +{ + id, //string ID of claim + fulfillment_id, //string ID of the fulfillment created + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`claim.shipment_created` + + + +Triggered when a claim fulfillment is set as “shipped”. + + + +Object of the following format: + +```js +{ + id, //string ID of claim + fulfillment_id, //string ID of the fulfillment created + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`claim.refund_processed` + + + +Triggered when a claim of type “refunded” has been refunded. + + + +Object of the following format: + +```js +{ + id, //string ID of claim + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +## Claim Item Events + +This section holds all events related to claim items. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`claim_item.created` + + + +Triggered when claim items are created and associated with a claim. This happens during the creation of claims. + + + +Object of the following format: + +```js +{ + id //string ID of claim item +} +``` + +
+ +`claim_item.updated` + + + +Triggered when a claim item is updated. This happens when a claim is updated. + + + +Object of the following format: + +```js +{ + id //string ID of claim item +} +``` + +
+ +`claim_item.canceled` + + + +Triggered when a claim is canceled. + + + +Object of the following format: + +```js +{ + id //string ID of claim item +} +``` + +
+ +## Customer Events + +This section holds all events related to customers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`customer.created` + + + +Triggered when a customer is created. + + + +The entire customer passed as an object. You can refer to the [Customer model](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/models/customer.ts) for an idea of what fields to expect. + +
+ +`customer.updated` + + + +Triggered when a customer is updated including their information or password, or when a customer account is created that is associated with an existing email (for example, if a customer placed an order with their email as a guest, then created an account with that email). + + + +The entire customer passed as an object. You can refer to the [Customer model](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/models/customer.ts) for an idea of what fields to expect. + +
+ +`customer.password_reset` + + + +Triggered when a customer requests to reset their password. + + + +Object of the following format: + +```js +{ + id, //string ID of customer + email, //string email of the customer + first_name, //string first name of the customer + last_name, //string last name of the customer + token //string reset password token +} +``` + +
+ +## Draft Order Events + +This section holds all events related to draft orders. + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`draft_order.created` + + + +Triggered when a draft order is created. + + + +Object of the following format: + +```js +{ + id //string ID of draft order +} +``` + +
+ +`draft_order.updated` + + + +Triggered when a draft order and data associated with it (email, billing address, discount, etc…) are updated. + + + +Object of the following format: + +```js +{ + id //string ID of draft order +} +``` + +
+ +## Gift Card Events + +This section holds all events related to gift cards. + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`gift_card.created` + + + +Triggered when a gift card is created. + + + +Object of the following format: + +``` +{ + id //string ID of gift card +} +``` + +
+ +## Invite Events + +This section holds all events related to invites. + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`invite.created` + + + +Triggered when an invite is created for a user to join the admin team. + + + +Object of the following format: + +```js +{ + id //string ID of invite + token, //string token generated to validate the invited user + user_email //string email of invited user +} +``` + +
+ +## Note Events + +This section holds all events related to notes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`note.created` + + + +Triggered when a note is created. + + + +Object of the following format: + +```js +{ + id //string ID of note +} +``` + +
+ +`note.updated` + + + +Triggered when a note is updated. + + + +Object of the following format: + +```js +{ + id //string ID of note +} +``` + +
+ +`note.deleted` + + + +Triggered when a note is deleted. + + + +Object of the following format: + +```js +{ + id //string ID of note +} +``` + +
+ +## App Authentication Events + +This section holds all events related to app authentications. + +:::note + +Event names of app authentication are scoped specifically towards each application. When listening to these events, you must replace `` with the name of the application you’re targeting. + +::: + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`oauth.token_generated.` + + + +Triggered when a token is generated for an application. + + + +The returned data from the method `generateToken` in the auth handler service of the application. + +
+ +`oauth.token_refreshed.` + + + +Triggered when the token of an application is refreshed. + + + +The returned data from the method `refreshToken` in the auth handler service of the application. + +
+ +## Order Events + +This section holds all events related to orders. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`order.placed` + + + +Triggered when a new order is placed. + + + +Object of the following format: + +```js +{ + id, //string ID of order + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.updated` + + + +Triggered when an order and data associated with it (shipping method, shipping address, etc…) are updated. + + + +Object of the following format: + +```js +{ + id, //string ID of order + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.canceled` + + + +Triggered when an order is canceled. + + + +Object of the following format: + +```js +{ + id, //string ID of order + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.completed` + + + +Triggered when an order is completed. + + + +Object of the following format: + +```js +{ + id, //string ID of order + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.gift_card_created` + + + +Triggered when a gift card in an order is created. + + + +Object of the following format: + +```js +{ + id //string ID of order +} +``` + +
+ +`order.payment_captured` + + + +Triggered when the payment of an order is captured. + + + +Object of the following format: + +```js +{ + id, //string ID of order + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.payment_capture_failed` + + + +Triggered when capturing the payment of an order fails. + + + +Object of the following format: + +```js +{ + id, //string ID of order + payment_id, //string ID of Payment + error, //string error message + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.fulfillment_created` + + + +Triggered when fulfillment is created for an order. + + + +Object of the following format: + +```js +{ + id, //string ID of order + fulfillment_id, //string ID of fulfillment + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.shipment_created` + + + +Triggered when a shipment is created for fulfillment and the fulfillment is registered as “shipped”. + + + +Object of the following format: + +```js +{ + id, //string ID of order + fulfillment_id, //string ID of fulfillment + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.fulfillment_canceled` + + + +Triggered when fulfillment of an order is canceled. + + + +Object of the following format: + +```js +{ + id, //string ID of order + fulfillment_id, //string ID of fulfillment + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.return_requested` + + + +Triggered when a return of an order is requested. + + + +Object of the following format: + +```js +{ + id, //string ID of order + return_id, //string ID of return + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.items_returned` + + + +Triggered when the items of an order have been returned and the order has been registered as “returned”. + + + +Object of the following format: + +```js +{ + id, //string ID of order + return_id, //string ID of return + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.return_action_required` + + + +Triggered when the order is being registered as “returned” but there are additional actions required related to refunding the payment. + + + +Object of the following format: + +```js +{ + id, //string ID of order + return_id, //string ID of return + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.refund_created` + + + +Triggered when the order’s payment is refunded. + + + +Object of the following format: + +```js +{ + id, //string ID of order + refund_id, //string ID of refund + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`order.refund_failed` + + + +Triggered when the refund of the order’s payment fails. + + + +Object of the following format: + +```js +{ + id, //string ID of order +} +``` + +
+ +`order.swap_created` + + + +Triggered when a swap for an order is created. + + + +Object of the following format: + +```js +{ + id, //string ID of order +} +``` + +
+ +## Product Events + +This section holds all events related to products. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`product.created` + + + +Triggered when a product is created. + + + +Object of the following format: + +```js +{ + id //string ID of product +} +``` + +
+ +`product.updated` + + + +Triggered when a product and data associated with it (options, variant orders, etc…) is updated. + + + +The entire product passed as an object. You can refer to the [Product model](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/models/product.ts) for an idea of what fields to expect. + +
+ +`product.deleted` + + + +Triggered when a product is deleted. + + + +Object of the following format: + +```js +{ + id //string ID of product +} +``` + +
+ +## Product Variant Events + +This section holds all events related to product variants. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`product-variant.created` + + + +Triggered when a product variant is created. + + + +Object of the following format: + +```js +{ + id, //string ID of variant + product_id //string ID of product +} +``` + +
+ +`product-variant.updated` + + + +Triggered when a product variant is updated. + + + +Object of the following format: + +```js +{ + id, //string ID of variant + product_id, //string ID of product + fields //array of names of updated fields +} +``` + +
+ +`product-variant.deleted` + + + +Triggered when a product variant is deleted. + + + +Object of the following format: + +```js +{ + id, //string ID of variant + product_id, //string ID of product + metadata //object of additional data +} +``` + +
+ +## Region Events + +This section holds all events related to regions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`region.created` + + + +Triggered when a region is created. + + + +Object of the following format: + +```js +{ + id //string ID of region +} +``` + +
+ +`region.updated` + + + +Triggered when a region or data associated with it (countries, fulfillment providers, etc…) are updated. + + + +Object of the following format: + +```js +{ + id, //string ID of region + fields //array of names of updated fields +} +``` + +
+ +`region.deleted` + + + +Triggered when a region is deleted. + + + +Object of the following format: + +```js +{ + id //string ID of region +} +``` + +
+ +## Swap Events + +This section holds all events related to swaps. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`swap.created` + + + +Triggered when a swap is created. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.received` + + + +Triggered when a swap is registered as received. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + order_id, //string ID of order + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.fulfillment_created` + + + +Triggered when fulfillment is created for a swap. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + fulfillment_id, //string ID of fulfillment + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.shipment_created` + + + +Triggered when a shipment is created for a swap and the fulfillment associated with it is set as “shipped”. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + fulfillment_id, //string ID of fulfillment + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.payment_completed` + + + +Triggered when payment is completed for a swap which happens when the cart associated with the swap is registered as completed. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.payment_captured` + + + +Triggered when the payment is captured for a swap. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.payment_capture_failed` + + + +Triggered when the capturing of the payment of a swap fails. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.refund_processed` + + + +Triggered when a swap’s amount difference is processed and refunded. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +`swap.process_refund_failed` + + + +Triggered when processing and refunding a swap’s amount difference fails. + + + +Object of the following format: + +```js +{ + id, //string ID of swap + no_notification //boolean indicating whether a notification should be sent or not +} +``` + +
+ +## User Events + +This section holds all events related to users. + + + + + + + + + + + + + + + + +
+Event Name + +Description + +Event Data Payload +
+ +`user.password_reset` + + + +Triggered when a user requests to reset their password. + + + +Object of the following format: + +```js +{ + email, //string email of user requesting to reset their password + token //token create to reset the password +} +``` + +
+ +## What’s Next 🚀 + +- Learn how you can [use services in subscribers](create-subscriber.md#using-services-in-subscribers). +- Learn how to [create notifications](../../../how-to/notification-api.md) in Medusa. diff --git a/docs/content/advanced/backend/upgrade-guides/1-3-0.md b/docs/content/advanced/backend/upgrade-guides/1-3-0.md new file mode 100644 index 0000000000..8c34f81a2b --- /dev/null +++ b/docs/content/advanced/backend/upgrade-guides/1-3-0.md @@ -0,0 +1,89 @@ +# v1.3.0 + +Version 1.3.0 of Medusa introduces new features including the addition of Line Item Adjustments and a more advanced Promotions API, as well as a change in loading environment variables into your Medusa server. The changes do not affect the public APIs and require only running necessary data migrations. + +## Prerequisites + +Both the actions required for this update need you to set the following environment variables: + +```bash +TYPEORM_CONNECTION=postgres +TYPEORM_URL= +TYPEORM_LOGGING=true +TYPEORM_ENTITIES=./node_modules/@medusajs/medusa/dist/models/*.js +TYPEORM_MIGRATIONS=./node_modules/@medusajs/medusa/dist/migrations/*.js +``` + +These environment variables are used in the data migration scripts in this upgrade. Make sure to replace `` with your PostgreSQL database URL. + +## Environment Variables + +In previous versions of Medusa, The server automatically loads all environment variables in the `.env` file at the root of the Medusa server. + +This new update removes loading it automatically and gives developers the freedom in how to load their environment variables. All environment variables will be loaded by default from the system’s environment variables. + +### Actions Required + +If you use a `.env` file to load environment variables on your server, you need to load the variables manually in `medusa-config.js`. + +You can add the following code snippet at the top of the file which uses the [dotenv](https://www.npmjs.com/package/dotenv) package to load the environment variables based on the current Node environment: + +```jsx +const dotenv = require('dotenv') + + let ENV_FILE_NAME = ''; + switch (process.env.NODE_ENV) { + case 'production': + ENV_FILE_NAME = '.env.production'; + break; + case 'staging': + ENV_FILE_NAME = '.env.staging'; + break; + case 'test': + ENV_FILE_NAME = '.env.test'; + break; + case 'development': + default: + ENV_FILE_NAME = '.env'; + break; + } + + try { + dotenv.config({ path: process.cwd() + '/' + ENV_FILE_NAME }); + } catch (e) { + } +``` + +## Line Item Adjustments + +This new version of Medusa allows store operators to adjust line items in an order or a swap which provides more customization capabilities. + +It introduces a new model `LineItemAdjustment` which gives more flexibility to adjust the pricing of line items in a cart, order, or swap. A discount can be added, removed, or modified and the price will reflect on the total calculation of the cart, order, or swap. + +This also introduces an optimization to the calculation of totals, as it is no longer necessary to calculate the discounts every time the totals are retrieved. + +### Actions Required + +This new version adds a new data migration script that will go through your list of existing orders and add line item adjustments for each of the line items in the order. + +For that reason, it’s essential to run the data migration script after upgrading your server and before starting your Medusa server: + +```bash +node ./node_modules/@medusajs/medusa/dist/scripts/line-item-adjustment-migration.js +``` + +## Advanced Discount Conditions + +This new version of Medusa holds advanced promotions functionalities to provide store operators with even more customization capabilities when creating discounts. You can now add even more conditions to your discounts to make them specific for a set of products, collections, customer groups, and more. + +This change required creating a new model `DiscountCondition` which belongs to `DiscountRule` and includes a few relationships with other models to make the aforementioned feature possible. + +### Actions Required + +To ensure your old discount rules play well with the new Promotions API and schema, this version includes a migration script that will go through your existing discount rules, create discount conditions for these rules, and move the former direct relationship between discount rules and products to become between discount conditions and products. + +For that reason, it’s essential to run the data migration script after upgrading your server and before starting your Medusa server: + +```bash +node ./node_modules/@medusajs/medusa/dist/scripts/discount-rule-migration.js +``` diff --git a/docs/content/how-to/create-medusa-app.md b/docs/content/how-to/create-medusa-app.md index ef514a8678..27c78a2267 100644 --- a/docs/content/how-to/create-medusa-app.md +++ b/docs/content/how-to/create-medusa-app.md @@ -55,7 +55,7 @@ For the walkthrough purposes, we assume that the selected starter is `medusa-sta ### Selecting a Storefront -After selecting your Medusa starter you will be given the option to install one of our storefront starters. At the moment we have starters for Gatsby and Next.js: +After selecting your Medusa starter, you will be given the option to install one of our storefront starters. At the moment, we have starters for Gatsby and Next.js: ```bash Which storefront starter would you like to install? … @@ -74,7 +74,7 @@ Creating new project from git: https://github.com/medusajs/medusa-starter-defaul Installing packages... ``` -Once the installation has been completed you will have a Medusa backend, a demo storefront, and an admin dashboard. +Once the installation has been completed, you will have a Medusa backend, a Demo storefront, and an Admin dashboard. ## What's inside @@ -87,7 +87,7 @@ Inside the root folder which was specified at the beginning of the installation /admin // Medusa admin panel ``` -`create-medusa-app` prints out the commands that are available to you after installation. When each project is started you can visit your storefront, complete the order, and view the order in Medusa admin. +`create-medusa-app` prints out the commands that are available to you after installation. When each project is started, you can visit your storefront, complete the order, and view the order in Medusa admin. ```bash ⠴ Installing packages... @@ -112,10 +112,10 @@ Create initial git commit in my-medusa-store/admin ## **What's next?** -To learn more about Medusa to go through our docs to get some inspiration and guidance for the next steps and further development: +To learn more about Medusa, go through our docs to get some inspiration and guidance for the next steps and further development: - [Find out how to set up a Medusa project with Gatsby and Contentful](https://docs.medusajs.com/how-to/headless-ecommerce-store-with-gatsby-contentful-medusa) - [Move your Medusa setup to the next level with some custom functionality](https://docs.medusajs.com/tutorial/adding-custom-functionality) - [Create your own Medusa plugin](https://docs.medusajs.com/guides/plugins) -If you have any follow-up questions or want to chat directly with our engineering team we are always happy to meet you at our [Discord](https://discord.gg/DSHySyMu). +If you have any follow-up questions or want to chat directly with our engineering team, we are always happy to meet you at our [Discord](https://discord.gg/DSHySyMu). diff --git a/docs/content/how-to/deploying-on-heroku.md b/docs/content/how-to/deploying-on-heroku.md index 7695b94217..204032730d 100644 --- a/docs/content/how-to/deploying-on-heroku.md +++ b/docs/content/how-to/deploying-on-heroku.md @@ -4,7 +4,7 @@ title: "Deploying on Heroku" # Deploying on Heroku -This is a guide for deploying a Medusa project on Heroku. Heroku is at PaaS that allows you to easily deploy your applications in the cloud. +This is a guide for deploying a Medusa project on Heroku. Heroku is a PaaS (Platform as a Service) that allows you to easily deploy your applications in the cloud.