diff --git a/docs/api/admin-spec3-base.json b/docs/api/admin-spec3-base.json index e0586ca4e1..f809364d5b 100644 --- a/docs/api/admin-spec3-base.json +++ b/docs/api/admin-spec3-base.json @@ -63,6 +63,10 @@ { "name": "Product Variant", "x-resourceId": "product_variant" + }, + { + "name": "OAuth", + "x-resourceId": "OAuth" } ], "servers": [ diff --git a/docs/api/admin-spec3.yaml b/docs/api/admin-spec3.yaml index 7e0daf692e..f0967aa938 100644 --- a/docs/api/admin-spec3.yaml +++ b/docs/api/admin-spec3.yaml @@ -35,13 +35,67 @@ tags: x-resourceId: swap - name: Product Variant x-resourceId: product_variant + - name: OAuth + x-resourceId: OAuth servers: - url: "https://api.medusa-commerce.com/admin" paths: + /apps: + post: + operationId: PostApps + summary: Generates a token for an application. + description: Generates a token for an application. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - application_name + - state + - code + properties: + application_name: + type: string + description: Name of the application for the token to be generated for. + state: + type: string + description: State of the application. + code: + type: string + description: The code for the generated token. + tags: + - Apps + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + apps: + $ref: "#/components/schemas/OAuth" + get: + operationId: GetApps + summary: List applications + description: Retrieve a list of applications. + x-authenticated: true + tags: + - Apps + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + collection: + $ref: "#/components/schemas/OAuth" /auth: post: operationId: PostAuth summary: Authenticate a User + x-authenticated: false description: Logs a User in and authorizes them to manage Store settings. parameters: [] tags: @@ -73,6 +127,7 @@ paths: get: operationId: GetAuth summary: Get Session + x-authenticated: true description: Gets the currently logged in User. tags: - Auth @@ -85,11 +140,77 @@ paths: properties: user: $ref: "#/components/schemas/user" + "/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: @@ -125,6 +246,49 @@ paths: 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: @@ -141,6 +305,7 @@ paths: operationId: DeleteCollectionsCollection summary: Delete a Product Collection description: Deletes a Product Collection. + x-authenticated: true parameters: - in: path name: id @@ -169,6 +334,7 @@ paths: operationId: GetCollectionsCollection summary: Retrieve a Product Collection description: Retrieves a Product Collection. + x-authenticated: true parameters: - in: path name: id @@ -191,6 +357,7 @@ paths: operationId: PostCollectionsCollection summary: Update a Product Collection description: Updates a Product Collection. + x-authenticated: true parameters: - in: path name: id @@ -227,11 +394,135 @@ paths: properties: collection: $ref: "#/components/schemas/product_collection" + /customer-groups: + post: + operationId: PostCustomerGroups + summary: Create a CustomerGroup + description: Creates a CustomerGroup. + x-authenticated: true + parameters: [] + tags: + - CustomerGroup + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: "#/components/schemas/customer_group" + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + description: Name of the customer group + metadata: + type: object + description: Metadata for the customer. + "/customer-groups/{id}": + delete: + operationId: DeleteCustomerGroupsCustomerGroup + summary: Delete a CustomerGroup + description: Deletes a CustomerGroup. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The id of the Customer Group + schema: + type: string + tags: + - CustomerGroup + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + id: + type: string + description: The id of the deleted customer group. + object: + type: string + description: The type of the object that was deleted. + deleted: + type: boolean + post: + operationId: PostCustomerGroupsGroup + summary: Update a CustomerGroup + description: Update a CustomerGroup. + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The id of the customer group. + schema: + type: string + tags: + - CustomerGroup + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: "#/components/schemas/customer_group" + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + description: Name of the customer group + metadata: + type: object + description: Metadata for the customer. + "/customer-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: + - CustomerGroup + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + customer_group: + $ref: "#/components/schemas/customer_group" /customers: post: operationId: PostCustomers summary: Create a Customer description: Creates a Customer. + x-authenticated: true parameters: [] tags: - Customer @@ -266,10 +557,14 @@ paths: 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: @@ -286,6 +581,7 @@ paths: operationId: GetCustomersCustomer summary: Retrieve a Customer description: Retrieves a Customer. + x-authenticated: true parameters: - in: path name: id @@ -308,6 +604,7 @@ paths: operationId: PostCustomersCustomer summary: Update a Customer description: Updates a Customer. + x-authenticated: true parameters: - in: path name: id @@ -332,8 +629,24 @@ paths: 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 + description: A list of customer groups to which the customer belongs. + items: + required: + - id + properties: + id: + description: The id of a customer group + type: string + metadata: type: object + description: Metadata for the customer. tags: - Customer responses: @@ -350,6 +663,7 @@ paths: operationId: PostDiscountsDiscountRegionsRegion summary: Adds Region availability description: Adds a Region to the list of Regions that a Discount can be used in. + x-authenticated: true parameters: - in: path name: id @@ -377,6 +691,7 @@ paths: 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. @@ -406,11 +721,41 @@ paths: $ref: "#/components/schemas/discount" "/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 name: id @@ -439,12 +784,16 @@ paths: 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: + required: + - code + - rule schema: properties: code: @@ -505,7 +854,39 @@ paths: 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 responses: @@ -524,6 +905,7 @@ paths: description: >- Creates a unique code that can map to a parent Discount. This is useful if you want to automatically generate codes with the same behaviour. + x-authenticated: true parameters: - in: path name: id @@ -563,6 +945,7 @@ paths: operationId: DeleteDiscountsDiscount summary: Delete a Discount description: Deletes a Discount. + x-authenticated: true parameters: - in: path name: id @@ -591,6 +974,7 @@ paths: operationId: GetDiscountsDiscount summary: Retrieve a Discount description: Retrieves a Discount + x-authenticated: true parameters: - in: path name: id @@ -615,6 +999,7 @@ paths: description: >- Updates a Discount with a given set of rules that define how the Discount behaves. + x-authenticated: true parameters: - in: path name: id @@ -647,12 +1032,10 @@ paths: Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. starts_at: - type: string - format: date-time + type: Date description: The time at which the Discount should be available. ends_at: - type: string - format: date-time + type: Date description: >- The time at which the Discount should no longer be available. @@ -663,6 +1046,9 @@ paths: type: array items: type: string + metadata: + description: An object containing metadata of the discount + type: object tags: - Discount responses: @@ -679,6 +1065,7 @@ paths: operationId: DeleteDiscountsDiscountDynamicCodesCode summary: Delete a dynamic code description: Deletes a dynamic code from a Discount. + x-authenticated: true parameters: - in: path name: id @@ -708,6 +1095,7 @@ paths: operationId: GetDiscountsDiscountCode summary: Retrieve a Discount by code description: Retrieves a Discount by its discount code + x-authenticated: true parameters: - in: path name: code @@ -731,10 +1119,16 @@ paths: 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 @@ -829,6 +1223,7 @@ paths: operationId: GetDraftOrders summary: List Draft Orders description: Retrieves an list of Draft Orders + x-authenticated: true tags: - Draft Order responses: @@ -845,9 +1240,12 @@ paths: operationId: PostDraftOrdersDraftOrderLineItems summary: Create a Line Item for Draft Order description: Creates a Line Item for the Draft Order + x-authenticated: true requestBody: content: application/json: + required: + - quantity schema: properties: variant_id: @@ -885,6 +1283,7 @@ paths: operationId: DeleteDraftOrdersDraftOrder summary: Delete a Draft Order description: Deletes a Draft Order + x-authenticated: true parameters: - in: path name: id @@ -913,6 +1312,7 @@ paths: operationId: GetDraftOrdersDraftOrder summary: Retrieve a Draft Order description: Retrieves a Draft Order. + x-authenticated: true parameters: - in: path name: id @@ -936,6 +1336,7 @@ paths: operationId: DeleteDraftOrdersDraftOrderLineItemsItem summary: Delete a Line Item description: Removes a Line Item from a Draft Order. + x-authenticated: true parameters: - in: path name: id @@ -964,6 +1365,7 @@ paths: operationId: PostDraftOrdersDraftOrderLineItemsItem summary: Update a Line Item for a Draft Order description: Updates a Line Item for a Draft Order + x-authenticated: true requestBody: content: application/json: @@ -999,6 +1401,7 @@ paths: summary: Registers a payment for a Draft Order operationId: PostDraftOrdersDraftOrderRegisterPayment description: Registers a payment for a Draft Order. + x-authenticated: true parameters: - in: path name: id @@ -1022,6 +1425,7 @@ paths: operationId: PostDraftOrdersDraftOrder summary: Update a Draft Order" description: Updates a Draft Order. + x-authenticated: true parameters: - in: path name: id @@ -1082,6 +1486,7 @@ paths: 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: @@ -1128,6 +1533,7 @@ paths: operationId: GetGiftCards summary: List Gift Cards description: Retrieves a list of Gift Cards. + x-authenticated: true tags: - Gift Card responses: @@ -1146,6 +1552,7 @@ paths: operationId: DeleteGiftCardsGiftCard summary: Delete a Gift Card description: Deletes a Gift Card + x-authenticated: true parameters: - in: path name: id @@ -1174,6 +1581,7 @@ paths: operationId: GetGiftCardsGiftCard summary: Retrieve a Gift Card description: Retrieves a Gift Card. + x-authenticated: true parameters: - in: path name: id @@ -1198,6 +1606,7 @@ paths: description: >- Creates a Gift Card that can redeemed by its unique code. The Gift Card is only valid within 1 region. + x-authenticated: true parameters: - in: path name: id @@ -1247,11 +1656,129 @@ paths: properties: gift_card: $ref: "#/components/schemas/gift_card" + /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: @@ -1280,7 +1807,30 @@ paths: 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 responses: @@ -1299,6 +1849,7 @@ paths: operationId: DeleteNotesNote summary: Deletes a Note description: Deletes a Note. + x-authenticated: true parameters: - in: path name: id @@ -1322,9 +1873,10 @@ paths: type: boolean description: Whether or not the Note was deleted. get: - operationId: GetNoteNote + operationId: GetNotesNote summary: Get Note description: Retrieves a single note using its id + x-authenticated: true parameters: - in: path name: id @@ -1346,6 +1898,7 @@ paths: post: operationId: PostNotesNote summary: Updates a Note + x-authenticated: true description: Updates a Note associated with some resource parameters: - in: path @@ -1358,6 +1911,8 @@ paths: content: application/json: schema: + required: + - value properties: value: type: string @@ -1378,6 +1933,53 @@ paths: operationId: GetNotifications summary: List Notifications description: Retrieves a list of Notifications. + x-authenticated: true + parameters: + - in: query + name: offset + description: >- + The number of notifications to skip before starting to collect the + notifications set + schema: + type: integer + default: 0 + - in: query + name: limit + description: The number of notifications to return + schema: + type: integer + default: 50 + - in: query + name: fields + description: The fields to include in the result set + schema: + type: string + - in: query + name: expand + description: The fields to populate + schema: + type: string + - in: query + name: event_name + schema: + type: string + - in: query + name: resource_type + schema: + type: string + - in: query + name: resource_id + schema: + type: string + - in: query + name: to + schema: + type: string + - in: query + name: include_resends + description: Whether the result set should include resent notifications or not + schema: + type: boolean tags: - Notification responses: @@ -1398,6 +2000,7 @@ paths: description: >- Resends a previously sent notifications, with the same data but optionally to a different address + x-authenticated: true parameters: - in: path name: id @@ -1405,6 +2008,16 @@ paths: description: The id of the Notification schema: type: string + requestBody: + content: + application/json: + schema: + properties: + to: + description: >- + The address or user identifier that the Notification was + sent to + type: string tags: - Notification responses: @@ -1424,6 +2037,7 @@ paths: Adds a Shipping Method to an Order. If another Shipping Method exists with the same Shipping Profile, the previous Shipping Method will be replaced. + x-authenticated: true parameters: - in: path name: id @@ -1468,11 +2082,36 @@ paths: The data required for the Shipping Option to create a Shipping Method. This will depend on the Fulfillment Provider. + "/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 name: id @@ -1502,6 +2141,7 @@ paths: operationId: PostOrdersClaimFulfillmentsCancel summary: Cancels a fulfilmment related to a Claim description: Registers a Fulfillment as canceled. + x-authenticated: true parameters: - in: path name: id @@ -1537,6 +2177,7 @@ paths: operationId: PostOrdersSwapFulfillmentsCancel summary: Cancels a fulfilmment related to a Swap description: Registers a Fulfillment as canceled. + x-authenticated: true parameters: - in: path name: id @@ -1572,6 +2213,7 @@ paths: operationId: PostOrdersOrderFulfillmentsCancel summary: Cancels a fulfilmment description: Registers a Fulfillment as canceled. + x-authenticated: true parameters: - in: path name: id @@ -1604,6 +2246,7 @@ paths: Registers an Order as canceled. This triggers a flow that will cancel any created Fulfillments and Payments, may fail if the Payment or Fulfillment Provider is unable to cancel the Payment/Fulfillment. + x-authenticated: true parameters: - in: path name: id @@ -1627,6 +2270,7 @@ paths: operationId: PostOrdersSwapCancel summary: Cancels a Swap description: Cancels a Swap + x-authenticated: true parameters: - in: path name: id @@ -1656,6 +2300,31 @@ paths: 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 name: id @@ -1679,6 +2348,7 @@ paths: operationId: PostOrdersOrderClaimsClaimShipments summary: Create Claim Shipment description: Registers a Claim Fulfillment as shipped. + x-authenticated: true parameters: - in: path name: id @@ -1696,6 +2366,8 @@ paths: content: application/json: schema: + required: + - fulfillment_id properties: fulfillment_id: description: The id of the Fulfillment. @@ -1721,6 +2393,7 @@ paths: operationId: PostOrdersOrderClaims summary: Create a Claim description: Creates a Claim. + x-authenticated: true parameters: - in: path name: id @@ -1732,6 +2405,9 @@ paths: content: application/json: schema: + required: + - type + - claim_items properties: type: description: >- @@ -1859,6 +2535,7 @@ paths: description: >- Creates a Fulfillment of an Order - will notify Fulfillment Providers to prepare a shipment. + x-authenticated: true parameters: - in: path name: id @@ -1870,6 +2547,8 @@ paths: content: application/json: schema: + required: + - items properties: items: description: The Line Items to include in the Fulfillment. @@ -1903,11 +2582,235 @@ paths: properties: order: $ref: "#/components/schemas/order" + /orders: + post: + operationId: PostOrders + summary: Create an order + description: Creates and order + x-authenticated: true + requestBody: + content: + application/json: + required: + - email + - billing_address + - shipping_address + - items + - region + - customer_id + - payment_method + - shipping_method + schema: + 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 + region: + description: Region where the order belongs + type: string + discounts: + description: Discounts applied to the order + type: array + 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 + 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 + description: Status to search for. + schema: + 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 name: id @@ -1919,6 +2822,8 @@ paths: content: application/json: schema: + required: + - fulfillment_id properties: fulfillment_id: description: The id of the Fulfillment. @@ -1949,6 +2854,7 @@ paths: operationId: PostOrdersOrderSwapsSwapShipments summary: Create Swap Shipment description: Registers a Swap Fulfillment as shipped. + x-authenticated: true parameters: - in: path name: id @@ -1966,6 +2872,8 @@ paths: content: application/json: schema: + required: + - fulfillment_id properties: fulfillment_id: description: The id of the Fulfillment. @@ -1998,6 +2906,7 @@ paths: description: >- Creates a Swap. Swaps are used to handle Return of previously purchased goods and Fulfillment of replacements simultaneously. + x-authenticated: true parameters: - in: path name: id @@ -2009,11 +2918,16 @@ paths: 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. @@ -2037,6 +2951,9 @@ paths: 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. @@ -2050,6 +2967,9 @@ paths: Method from. type: array items: + required: + - option_id + - price properties: option_id: description: >- @@ -2083,6 +3003,7 @@ paths: operationId: DeleteOrdersOrderMetadataKey summary: Delete Metadata description: Deletes a metadata key. + x-authenticated: true parameters: - in: path name: id @@ -2112,6 +3033,7 @@ paths: operationId: PostOrdersOrderClaimsClaimFulfillments summary: Create a Claim Fulfillment description: Creates a Fulfillment for a Claim. + x-authenticated: true parameters: - in: path name: id @@ -2156,6 +3078,7 @@ paths: operationId: PostOrdersOrderSwapsSwapFulfillments summary: Create a Swap Fulfillment description: Creates a Fulfillment for a Swap. + x-authenticated: true parameters: - in: path name: id @@ -2200,6 +3123,7 @@ paths: operationId: GetOrdersOrder summary: Retrieve an Order description: Retrieves an Order + x-authenticated: true parameters: - in: path name: id @@ -2218,11 +3142,78 @@ paths: properties: order: $ref: "#/components/schemas/order" - /orders: - get: - operationId: GetOrders - summary: List Orders - description: Retrieves a list of Orders + post: + operationId: PostOrdersOrder + summary: Update an order + description: Updates and order + x-authenticated: true + parameters: + - in: path + name: id + required: true + description: The id of the Order. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + email: + description: the email for the order + type: string + billing_address: + description: Billing address + anyOf: + - $ref: >- + #/components/schemas/address shipping_address: + description: Shipping address anyOf: - $ref: + items: + description: The Line Items for the order + type: array + region: + description: Region where the order belongs + type: string + discounts: + description: Discounts applied to the order + type: array + customer_id: + description: id of the customer + type: string + payment_method: + description: null + 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 + 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: @@ -2232,10 +3223,8 @@ paths: application/json: schema: properties: - orders: - type: array - items: - $ref: "#/components/schemas/order" + order: + $ref: "#/components/schemas/order" "/orders/{id}/swaps/{swap_id}/process-payment": post: operationId: PostOrdersOrderSwapsSwapProcessPayment @@ -2244,6 +3233,7 @@ paths: 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 @@ -2268,56 +3258,12 @@ paths: 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: - 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 - 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 name: id @@ -2365,6 +3311,7 @@ paths: description: >- Requests a Return. If applicable a return label will be created and other plugins notified. + x-authenticated: true parameters: - in: path name: id @@ -2376,6 +3323,8 @@ paths: content: application/json: schema: + required: + - items properties: items: description: The Line Items that will be returned. @@ -2437,6 +3386,7 @@ paths: operationId: PostOrdersOrderClaimsClaim summary: Update a Claim description: Updates a Claim. + x-authenticated: true parameters: - in: path name: id @@ -2530,10 +3480,642 @@ paths: properties: order: $ref: "#/components/schemas/order" + /product-tags: + get: + operationId: GetProductTags + summary: List Product Tags + description: Retrieve a list of Product Tags. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of tags to return. + schema: + type: string + - in: query + name: offset + description: The offset of tags to return. + schema: + type: string + - in: query + name: value + description: The value of tags to return. + schema: + type: string + - in: query + name: id + description: The id of tags to return. + schema: + type: string + - in: query + name: created_at + description: >- + Date comparison for when resulting tas was created, i.e. less than, + greater than etc. + schema: + type: object + - in: query + name: updated_at + description: >- + Date comparison for when resulting tas was updated, i.e. less than, + greater than etc. + schema: + type: object + tags: + - Product Tag + responses: + "200": + description: OK + content: + application/json: + schema: + properties: + tags: + $ref: "#/components/schemas/product_tag" + /product-types: + get: + operationId: GetProductTypes + summary: List Product Types + description: Retrieve a list of Product Types. + x-authenticated: true + parameters: + - in: query + name: limit + description: The number of types to return. + schema: + type: string + - in: query + name: offset + description: The offset of types to return. + schema: + type: string + - in: query + name: value + description: The value of types to return. + schema: + type: string + - in: query + name: id + description: The id of types to return. + schema: + type: string + - in: query + name: created_at + description: >- + Date comparison for when resulting tas was created, i.e. less than, + greater than etc. + schema: + type: datecomparisonoperator + - in: query + name: updated_at + description: >- + Date comparison for when resulting tas was updated, i.e. less than, + greater than etc. + schema: + type: datecomparisonoperator + tags: + - Product Tag + responses: + "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": post: operationId: PostProductsProductOptions summary: Add an Option + x-authenticated: true description: Adds a Product Option to a Product parameters: - in: path @@ -2546,6 +4128,8 @@ paths: content: application/json: schema: + required: + - title properties: title: description: >- @@ -2567,11 +4151,18 @@ paths: post: operationId: PostProducts summary: Create a Product + x-authenticated: true description: Creates a Product requestBody: content: application/json: + required: + - title + - subtitle + - description schema: + required: + - title properties: title: description: The title of the Product @@ -2771,6 +4362,108 @@ paths: 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 + description: Status to search for. + schema: + type: array + - 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: 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 responses: @@ -2800,6 +4493,7 @@ paths: description: >- Creates a Product Variant. Each Product Variant must have a unique combination of Product Option Values. + x-authenticated: true parameters: - in: path name: id @@ -2811,6 +4505,10 @@ paths: content: application/json: schema: + required: + - title + - prices + - options properties: title: description: The title to identify the Product Variant by. @@ -2914,6 +4612,7 @@ paths: operationId: GetProductsProductVariants summary: List a Product's Product Variants description: Retrieves a list of the Product Variants associated with a Product. + x-authenticated: true parameters: - in: path name: id @@ -2943,6 +4642,7 @@ paths: Option Values for the Product Option must be the same. You may, for example, have to delete some of your variants prior to deleting the Product Option + x-authenticated: true parameters: - in: path name: id @@ -2979,6 +4679,7 @@ paths: operationId: PostProductsProductOptionsOption summary: Update a Product Option. description: Updates a Product Option + x-authenticated: true parameters: - in: path name: id @@ -2995,6 +4696,8 @@ paths: requestBody: content: application/json: + required: + - title schema: properties: title: @@ -3016,6 +4719,7 @@ paths: operationId: DeleteProductsProduct summary: Delete a Product description: Deletes a Product and it's associated Product Variants. + x-authenticated: true parameters: - in: path name: id @@ -3044,6 +4748,7 @@ paths: operationId: GetProductsProduct summary: Retrieve a Product description: Retrieves a Product. + x-authenticated: true parameters: - in: path name: id @@ -3066,6 +4771,7 @@ paths: operationId: PostProductsProduct summary: Update a Product description: Updates a Product + x-authenticated: true parameters: - in: path name: id @@ -3277,6 +4983,7 @@ paths: operationId: DeleteProductsProductVariantsVariant summary: Delete a Product Variant description: Deletes a Product Variant. + x-authenticated: true parameters: - in: path name: id @@ -3311,6 +5018,7 @@ paths: operationId: PostProductsProductVariantsVariant summary: Update a Product Variant description: Update a Product Variant. + x-authenticated: true parameters: - in: path name: id @@ -3432,6 +5140,7 @@ paths: operationId: GetProductsTypes summary: List Product Types description: Retrieves a list of Product Types. + x-authenticated: true tags: - Product responses: @@ -3445,15 +5154,57 @@ paths: type: array items: $ref: "#/components/schemas/product_type" + "/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" /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. @@ -3463,6 +5214,9 @@ paths: 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 @@ -3486,6 +5240,7 @@ paths: operationId: GetReturnReasons summary: List Return Reasons description: Retrieves a list of Return Reasons. + x-authenticated: true tags: - Return Reason responses: @@ -3499,11 +5254,12 @@ paths: type: array items: $ref: "#/components/schemas/return_reason" - "/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 name: id @@ -3528,11 +5284,11 @@ paths: description: The type of the object that was deleted. deleted: type: boolean - "/return-reasons/{id}": get: operationId: GetReturnReasonsReason summary: Retrieve a Return Reason description: Retrieves a Return Reason. + x-authenticated: true parameters: - in: path name: id @@ -3555,6 +5311,7 @@ paths: operationId: PostReturnReasonsReason summary: Update a Return Reason description: Updates a Return Reason + x-authenticated: true parameters: - in: path name: id @@ -3570,11 +5327,6 @@ paths: label: description: The label to display to the Customer. type: string - value: - description: >- - The value that the Return Reason will be identified by. Must - be unique. - type: string description: description: An optional description to for the Reason. type: string @@ -3594,418 +5346,6 @@ paths: properties: return_reason: $ref: "#/components/schemas/return_reason" - "/regions/{id}/countries": - post: - operationId: PostRegionsRegionCountries - summary: Add Country - description: Adds a Country to the list of Countries in a Region - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - schema: - 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 - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - 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 - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - requestBody: - content: - application/json: - 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 - 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 - 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. - 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. - 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. - 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. - 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 - 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 - 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. - parameters: - - in: path - name: id - required: true - description: The id of the Region. - schema: - type: string - tags: - - Product - 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 - 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. - 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. - 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" "/returns/{id}/cancel": post: operationId: PostReturnsReturnCancel @@ -4034,6 +5374,19 @@ paths: 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: @@ -4065,6 +5418,8 @@ paths: content: application/json: schema: + required: + - items properties: items: description: The Line Items that have been received. @@ -4096,6 +5451,7 @@ paths: operationId: PostShippingOptions summary: Create Shipping Option description: Creates a Shipping Option + x-authenticated: true requestBody: content: application/json: @@ -4152,6 +5508,14 @@ paths: 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 tags: - Shipping Option responses: @@ -4167,6 +5531,26 @@ paths: operationId: GetShippingOptions summary: List Shipping Options description: Retrieves a list of Shipping Options. + x-authenticated: true + parameters: + - in: path + name: region_id + schema: + type: string + required: false + description: Region to fetch options from + - in: path + name: is_return + schema: + type: boolean + required: false + description: Flag for fetching return options + - in: path + name: admin_only + schema: + type: boolean + required: false + description: Flag for fetching admin specific options tags: - Shipping Option responses: @@ -4185,6 +5569,7 @@ paths: operationId: DeleteShippingOptionsOption summary: Delete a Shipping Option description: Deletes a Shipping Option. + x-authenticated: true parameters: - in: path name: id @@ -4213,6 +5598,7 @@ paths: operationId: GetShippingOptionsOption summary: Retrieve a Shipping Option description: Retrieves a Shipping Option. + x-authenticated: true parameters: - in: path name: id @@ -4235,6 +5621,7 @@ paths: operationId: PostShippingOptionsOption summary: Update Shipping Option description: Updates a Shipping Option + x-authenticated: true parameters: - in: path name: id @@ -4253,6 +5640,14 @@ paths: amount: description: The amount to charge for the Shipping Option. type: integer + admin_only: + description: "If true, the option can be used for draft orders" + type: boolean + metadata: + description: >- + An optional set of key-value pairs with additional + information. + type: object requirements: description: >- The requirements that must be satisfied for the Shipping @@ -4285,10 +5680,13 @@ paths: 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 @@ -4308,6 +5706,7 @@ paths: operationId: GetShippingProfiles summary: List Shipping Profiles description: Retrieves a list of Shipping Profile. + x-authenticated: true tags: - Shipping Profile responses: @@ -4326,6 +5725,7 @@ paths: operationId: DeleteShippingProfilesProfile summary: Delete a Shipping Profile description: Deletes a Shipping Profile. + x-authenticated: true parameters: - in: path name: id @@ -4354,6 +5754,7 @@ paths: operationId: GetShippingProfilesProfile summary: Retrieve a Shipping Profile description: Retrieves a Shipping Profile. + x-authenticated: true parameters: - in: path name: id @@ -4407,6 +5808,7 @@ paths: operationId: PostStoreCurrenciesCode summary: Add a Currency Code description: Adds a Currency Code to the available currencies. + x-authenticated: true parameters: - in: path name: code @@ -4427,8 +5829,9 @@ paths: $ref: "#/components/schemas/store" 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 name: code @@ -4452,6 +5855,7 @@ paths: operationId: GetStore summary: Retrieve Store details. description: Retrieves the Store details + x-authenticated: true tags: - Store responses: @@ -4467,6 +5871,7 @@ paths: operationId: PostStore summary: Update Store details. description: Updates the Store details + x-authenticated: true requestBody: content: application/json: @@ -4480,6 +5885,16 @@ paths: 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 @@ -4499,6 +5914,7 @@ paths: operationId: GetStorePaymentProviders summary: Retrieve configured Payment Providers description: Retrieves the configured Payment Providers + x-authenticated: true tags: - Store responses: @@ -4512,11 +5928,31 @@ paths: type: array items: $ref: "#/components/schemas/store" + /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 name: id @@ -4540,6 +5976,7 @@ paths: operationId: GetSwaps summary: List Swaps description: Retrieves a list of Swaps. + x-authenticated: true tags: - Swap responses: @@ -4553,11 +5990,317 @@ paths: type: array items: $ref: "#/components/schemas/swap" + "/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 + 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: @@ -4571,6 +6314,194 @@ paths: type: array items: $ref: "#/components/schemas/product_variant" + /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 + 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" components: schemas: address: @@ -4959,6 +6890,30 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: + type: object + 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 @@ -5386,6 +7341,39 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: >- @@ -5682,6 +7670,23 @@ components: description: The date with timezone at which the resource was last updated. type: string format: date-time + 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 @@ -5726,7 +7731,7 @@ components: currency_code: type: string tax_rate: - type: integer + type: number discounts: type: array items: @@ -6110,6 +8115,62 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: >- @@ -6872,6 +8933,34 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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." @@ -7021,6 +9110,86 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: >- diff --git a/docs/api/store-spec3.json b/docs/api/store-spec3.json index ea00c44b90..b72d490f15 100644 --- a/docs/api/store-spec3.json +++ b/docs/api/store-spec3.json @@ -75,6 +75,89 @@ } ], "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", @@ -141,6 +224,7 @@ "operationId": "GetAuth", "summary": "Get Session", "description": "Gets the currently logged in Customer.", + "x-authenticated": true, "tags": [ "Auth" ], @@ -199,6 +283,508 @@ } } }, + "/customers/me/addresses": { + "post": { + "operationId": "PostCustomersCustomerAddresses", + "summary": "Add a Shipping Address", + "description": "Adds a Shipping Address to a Customer's saved addresses.", + "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "address" + ], + "properties": { + "address": { + "description": "The Address to add to the Customer.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "A successful response", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers": { + "post": { + "operationId": "PostCustomers", + "summary": "Create a Customer", + "description": "Creates a Customer account.", + "parameters": [], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "first_name", + "last_name", + "password" + ], + "properties": { + "email": { + "type": "string", + "description": "The Customer's email address." + }, + "first_name": { + "type": "string", + "description": "The Customer's first name." + }, + "last_name": { + "type": "string", + "description": "The Customer's last name." + }, + "password": { + "type": "string", + "description": "The Customer's password for login." + }, + "phone": { + "type": "string", + "description": "The Customer's phone number." + } + } + } + } + } + } + } + }, + "/customers/me/addresses/{address_id}": { + "delete": { + "operationId": "DeleteCustomersCustomerAddressesAddress", + "summary": "Delete an Address", + "description": "Removes an Address from the Customer's saved addresse.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "address_id", + "required": true, + "description": "The id of the Address to remove.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCustomersCustomerAddressesAddress", + "summary": "Update a Shipping Address", + "description": "Updates a Customer's saved Shipping Address.", + "x-authenticated": true, + "parameters": [ + { + "in": "path", + "name": "address_id", + "required": true, + "description": "The id of the Address to update.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "address": { + "description": "The updated Address.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers/me": { + "get": { + "operationId": "GetCustomersCustomer", + "summary": "Retrieves a Customer", + "description": "Retrieves a Customer - the Customer must be logged in to retrieve their details.", + "x-authenticated": true, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "PostCustomersCustomer", + "summary": "Update Customer details", + "description": "Updates a Customer's saved details.", + "x-authenticated": true, + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "first_name": { + "description": "The Customer's first name.", + "type": "string" + }, + "last_name": { + "description": "The Customer's last name.", + "type": "string" + }, + "billing_address": { + "description": "The Address to be used for billing purposes.", + "anyOf": [ + { + "$ref": "#/components/schemas/address" + } + ] + }, + "password": { + "description": "The Customer's password.", + "type": "string" + }, + "phone": { + "description": "The Customer's phone number.", + "type": "string" + }, + "email": { + "description": "The email of the customer.", + "type": "string" + }, + "metadata": { + "description": "Metadata about the customer.", + "type": "object" + } + } + } + } + } + }, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + } + } + }, + "/customers/me/payment-methods": { + "get": { + "operationId": "GetCustomersCustomerPaymentMethods", + "summary": "Retrieve saved payment methods", + "description": "Retrieves a list of a Customer's saved payment methods. Payment methods are saved with Payment Providers and it is their responsibility to fetch saved methods.", + "x-authenticated": true, + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "payment_methods": { + "type": "array", + "items": { + "properties": { + "provider_id": { + "type": "string", + "description": "The id of the Payment Provider where the payment method is saved." + }, + "data": { + "type": "object", + "description": "The data needed for the Payment Provider to use the saved payment method." + } + } + } + } + } + } + } + } + } + } + } + }, + "/customers/me/orders": { + "get": { + "operationId": "GetCustomersCustomerOrders", + "summary": "Retrieve Customer Orders", + "description": "Retrieves a list of a Customer's Orders.", + "x-authenticated": true, + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "How many addresses to return.", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "offset", + "description": "The offset in the resulting addresses.", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "fields", + "description": "(Comma separated string) Which fields should be included in the resulting addresses.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "expand", + "description": "(Comma separated string) Which relations should be expanded in the resulting addresses.", + "schema": { + "type": "string" + } + } + ], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "count": { + "description": "The total number of Orders.", + "type": "integer" + }, + "offset": { + "description": "The offset for pagination.", + "type": "integer" + }, + "limit": { + "description": "The maxmimum number of Orders to return,", + "type": "integer" + }, + "orders": { + "type": "array", + "items": { + "$ref": "#/components/schemas/order" + } + } + } + } + } + } + } + } + } + }, + "/customers/password-token": { + "post": { + "operationId": "PostCustomersCustomerPasswordToken", + "summary": "Creates a reset password token", + "description": "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.", + "parameters": [], + "tags": [ + "Customer" + ], + "responses": { + "204": { + "description": "OK" + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "email": { + "type": "string", + "description": "Email of the user whose password should be reset." + } + } + } + } + } + } + } + }, + "/customers/reset-password": { + "post": { + "operationId": "PostCustomersResetPassword", + "summary": "Resets Customer password", + "description": "Resets a Customer's password using a password token created by a previous /password-token request.", + "parameters": [], + "tags": [ + "Customer" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "customer": { + "$ref": "#/components/schemas/customer" + } + } + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "token", + "password" + ], + "properties": { + "email": { + "type": "string", + "description": "The Customer's email." + }, + "token": { + "type": "string", + "description": "The password token created by a /password-token request." + }, + "password": { + "type": "string", + "description": "The new password to set for the Customer." + } + } + } + } + } + } + } + }, "/carts/{id}/shipping-methods": { "post": { "operationId": "PostCartsCartShippingMethod", @@ -258,6 +844,48 @@ } } }, + "/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", @@ -299,6 +927,14 @@ "$ref": "#/components/schemas/cart" } } + }, + { + "type": "object", + "properties": { + "cart": { + "$ref": "#/components/schemas/swap" + } + } } ] } @@ -721,14 +1357,9 @@ "schema": { "type": "object", "required": [ - "provider_id", "data" ], "properties": { - "provider_id": { - "type": "string", - "description": "The id of the Payment Provider responsible for the Payment Session to update." - }, "data": { "type": "object", "description": "The data to update the payment session with." @@ -777,6 +1408,52 @@ } } }, + "/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", @@ -834,7 +1511,7 @@ }, "/store/carts/{id}": { "post": { - "operationId": "PostCartsCart", + "operationId": "PostCartsCartPaymentMethodUpdate", "summary": "Update a Cart\"", "description": "Updates a Cart.", "parameters": [ @@ -852,66 +1529,17 @@ "content": { "application/json": { "schema": { + "required": [ + "provider_id" + ], "properties": { - "region_id": { + "provider_id": { "type": "string", - "description": "The id of the Region to create the Cart in." + "description": "The id of the Payment Provider." }, - "country_code": { - "type": "string", - "description": "The 2 character ISO country code to create the Cart in." - }, - "email": { - "type": "string", - "description": "An email to be used on the Cart." - }, - "billing_address": { - "description": "The Address to be used for billing purposes.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "shipping_address": { - "description": "The Address to be used for shipping.", - "anyOf": [ - { - "$ref": "#/components/schemas/address" - } - ] - }, - "gift_cards": { - "description": "An array of Gift Card codes to add to the Cart.", - "type": "array", - "items": { - "properties": { - "code": { - "description": "The code that a Gift Card is identified by.", - "type": "string" - } - } - } - }, - "discounts": { - "description": "An array of Discount codes to add to the Cart.", - "type": "array", - "items": { - "properties": { - "code": { - "description": "The code that a Discount is identifed by.", - "type": "string" - } - } - } - }, - "customer_id": { - "description": "The id of the Customer to associate the Cart with.", - "type": "string" - }, - "context": { - "description": "An optional object to provide context to the Cart.", - "type": "object" + "data": { + "type": "object", + "description": "" } } } @@ -939,518 +1567,6 @@ } } }, - "/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.", - "tags": [ - "Collection" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "collection": { - "$ref": "#/components/schemas/product_collection" - } - } - } - } - } - } - } - } - }, - "/customers/{id}/addresses": { - "post": { - "operationId": "PostCustomersCustomerAddresses", - "summary": "Add a Shipping Address", - "description": "Adds a Shipping Address to a Customer's saved addresses.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The Customer id.", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "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/{id}/addresses/{address_id}": { - "delete": { - "operationId": "DeleteCustomersCustomerAddressesAddress", - "summary": "Delete an Address", - "description": "Removes an Address from the Customer's saved addresse.", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "The id of the Customer.", - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "address_id", - "required": true, - "description": "The id of the Address to remove.", - "schema": { - "type": "string" - } - } - ], - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "customer": { - "$ref": "#/components/schemas/customer" - } - } - } - } - } - } - } - } - }, - "/customers/me": { - "get": { - "operationId": "GetCustomersCustomer", - "summary": "Retrieves a Customer", - "description": "Retrieves a Customer - the Customer must be logged in to retrieve their details.", - "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.", - "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.", - "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.", - "tags": [ - "Customer" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "properties": { - "payment_methods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - } - } - } - } - } - } - } - } - }, - "/customers/password-token": { - "post": { - "operationId": "PostCustomersCustomerPasswordToken", - "summary": "Creates a reset password token", - "description": "Creates a reset password token to be used in a subsequent /reset-password request. The password token should be sent out of band e.g. via email and will not be returned.", - "tags": [ - "Customer" - ], - "responses": { - "204": { - "description": "OK" - } - } - } - }, - "/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." - } - } - } - } - } - } - } - }, - "/customers/me/addresses/{address_id}": { - "post": { - "operationId": "PostCustomersCustomerAddressesAddress", - "summary": "Update a Shipping Address", - "description": "Updates a Customer's saved Shipping Address.", - "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" - } - } - } - } - } - } - } - } - }, "/gift-cards/{code}": { "get": { "operationId": "GetGiftCardsCode", @@ -1500,6 +1616,198 @@ } } }, + "/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", + "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.", + "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" + } + } + } + } + } + } + } + } + } + }, "/orders/cart/{cart_id}": { "get": { "operationId": "GetOrdersOrderCartId", @@ -1620,84 +1928,6 @@ } } }, - "/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.", - "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", @@ -1869,7 +2099,11 @@ "description": "The quantity to return.", "type": "integer" } - } + }, + "required": [ + "item_id", + "quantity" + ] } }, "return_shipping": { @@ -1880,9 +2114,16 @@ "type": "string", "description": "The id of the Shipping Option to create the Shipping Method from." } - } + }, + "required": [ + "option_id" + ] } - } + }, + "required": [ + "order_id", + "items" + ] } } } @@ -2012,6 +2253,11 @@ "content": { "application/json": { "schema": { + "required": [ + "order_id", + "return_items", + "additional_items" + ], "properties": { "order_id": { "type": "string", @@ -2021,6 +2267,10 @@ "description": "The items to include in the Return.", "type": "array", "items": { + "required": [ + "item_id", + "quantity" + ], "properties": { "item_id": { "description": "The id of the Line Item from the Order.", @@ -2029,6 +2279,14 @@ "quantity": { "description": "The quantity to return.", "type": "integer" + }, + "reason_id": { + "description": "The id of the reason of this return", + "type": "string" + }, + "note_id": { + "description": "The id of the note", + "type": "string" } } } @@ -2041,6 +2299,10 @@ "description": "The items to exchange the returned items to.", "type": "array", "items": { + "required": [ + "variant_id", + "quantity" + ], "properties": { "variant_id": { "description": "The id of the Product Variant to send.", @@ -2166,6 +2428,29 @@ "schema": { "type": "string" } + }, + { + "in": "query", + "name": "expand", + "description": "A comma separated list of Product Variant relations to load.", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "number" + } + }, + { + "in": "query", + "name": "limit", + "description": "Maximum number of Product Variants to return.", + "schema": { + "type": "number" + } } ], "tags": [ @@ -2703,6 +2988,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": { + "type": "object" + } + }, + "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", @@ -3226,6 +3545,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.", @@ -3563,6 +3928,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", @@ -3617,7 +4007,7 @@ "type": "string" }, "tax_rate": { - "type": "integer" + "type": "number" }, "discounts": { "type": "array", @@ -4083,6 +4473,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.", @@ -4873,6 +5331,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.", @@ -5044,6 +5536,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/store-spec3.yaml b/docs/api/store-spec3.yaml index a8b7148278..a9c4648621 100644 --- a/docs/api/store-spec3.yaml +++ b/docs/api/store-spec3.yaml @@ -38,7 +38,7 @@ tags: - name: Product Variant x-resourceId: product_variant servers: - - url: "https://api.medusa-commerce.com/store" + - url: 'https://api.medusa-commerce.com/store' paths: /auth: post: @@ -51,14 +51,14 @@ paths: tags: - Auth responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' requestBody: content: application/json: @@ -81,24 +81,25 @@ paths: tags: - Auth responses: - "200": + '200': description: OK get: operationId: GetAuth summary: Get Session description: Gets the currently logged in Customer. + x-authenticated: true tags: - Auth responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" - "/auth/{email}": + $ref: '#/components/schemas/customer' + '/auth/{email}': get: operationId: GetAuthEmail summary: Check if email has account @@ -113,7 +114,7 @@ paths: tags: - Auth responses: - "200": + '200': description: OK content: application/json: @@ -121,7 +122,429 @@ paths: properties: exists: type: boolean - "/carts/{id}/shipping-methods": + '/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' + /customers/me/addresses: + post: + operationId: PostCustomersCustomerAddresses + summary: Add a Shipping Address + description: Adds a Shipping Address to a Customer's saved addresses. + x-authenticated: true + requestBody: + content: + application/json: + schema: + required: + - address + properties: + address: + description: The Address to add to the Customer. + anyOf: + - $ref: '#/components/schemas/address' + tags: + - Customer + responses: + '200': + description: A successful response + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /customers: + post: + operationId: PostCustomers + summary: Create a Customer + description: Creates a Customer account. + parameters: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - first_name + - last_name + - password + properties: + email: + type: string + description: The Customer's email address. + first_name: + type: string + description: The Customer's first name. + last_name: + type: string + description: The Customer's last name. + password: + type: string + description: The Customer's password for login. + phone: + type: string + description: The Customer's phone number. + '/customers/me/addresses/{address_id}': + delete: + operationId: DeleteCustomersCustomerAddressesAddress + summary: Delete an Address + description: Removes an Address from the Customer's saved addresse. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to remove. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + post: + operationId: PostCustomersCustomerAddressesAddress + summary: Update a Shipping Address + description: Updates a Customer's saved Shipping Address. + x-authenticated: true + parameters: + - in: path + name: address_id + required: true + description: The id of the Address to update. + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + address: + description: The updated Address. + anyOf: + - $ref: '#/components/schemas/address' + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /customers/me: + get: + operationId: GetCustomersCustomer + summary: Retrieves a Customer + description: >- + Retrieves a Customer - the Customer must be logged in to retrieve their + details. + x-authenticated: true + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + post: + operationId: PostCustomersCustomer + summary: Update Customer details + description: Updates a Customer's saved details. + x-authenticated: true + requestBody: + content: + application/json: + schema: + properties: + first_name: + description: The Customer's first name. + type: string + last_name: + description: The Customer's last name. + type: string + billing_address: + description: The Address to be used for billing purposes. + anyOf: + - $ref: '#/components/schemas/address' + password: + description: The Customer's password. + type: string + phone: + description: The Customer's phone number. + type: string + email: + description: The email of the customer. + type: string + metadata: + description: Metadata about the customer. + type: object + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + /customers/me/payment-methods: + get: + operationId: GetCustomersCustomerPaymentMethods + summary: Retrieve saved payment methods + description: >- + Retrieves a list of a Customer's saved payment methods. Payment methods + are saved with Payment Providers and it is their responsibility to fetch + saved methods. + x-authenticated: true + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + payment_methods: + type: array + items: + properties: + provider_id: + type: string + description: >- + The id of the Payment Provider where the payment + method is saved. + data: + type: object + description: >- + The data needed for the Payment Provider to use the + saved payment method. + /customers/me/orders: + get: + operationId: GetCustomersCustomerOrders + summary: Retrieve Customer Orders + description: Retrieves a list of a Customer's Orders. + x-authenticated: true + parameters: + - in: query + name: limit + description: How many addresses to return. + schema: + type: integer + - in: query + name: offset + description: The offset in the resulting addresses. + schema: + type: integer + - in: query + name: fields + description: >- + (Comma separated string) Which fields should be included in the + resulting addresses. + schema: + type: string + - in: query + name: expand + description: >- + (Comma separated string) Which relations should be expanded in the + resulting addresses. + schema: + type: string + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + count: + description: The total number of Orders. + type: integer + offset: + description: The offset for pagination. + type: integer + limit: + description: 'The maxmimum number of Orders to return,' + type: integer + orders: + type: array + items: + $ref: '#/components/schemas/order' + /customers/password-token: + post: + operationId: PostCustomersCustomerPasswordToken + summary: Creates a reset password token + description: >- + Creates a reset password token to be used in a subsequent + /reset-password request. The password token should be sent out of band + e.g. via email and will not be returned. + parameters: [] + tags: + - Customer + responses: + '204': + description: OK + requestBody: + content: + application/json: + schema: + type: object + required: + - email + properties: + email: + type: string + description: Email of the user whose password should be reset. + /customers/reset-password: + post: + operationId: PostCustomersResetPassword + summary: Resets Customer password + description: >- + Resets a Customer's password using a password token created by a + previous /password-token request. + parameters: [] + tags: + - Customer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + customer: + $ref: '#/components/schemas/customer' + requestBody: + content: + application/json: + schema: + type: object + required: + - email + - token + - password + properties: + email: + type: string + description: The Customer's email. + token: + type: string + description: The password token created by a /password-token request. + password: + type: string + description: The new password to set for the Customer. + '/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' + '/carts/{id}/shipping-methods': post: operationId: PostCartsCartShippingMethod description: Adds a Shipping Method to the Cart. @@ -136,14 +559,14 @@ paths: schema: type: string responses: - "200": + '200': description: A successful response content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' requestBody: content: application/json: @@ -162,7 +585,34 @@ paths: process the fulfillment of the order. Look at the documentation for your installed fulfillment providers to find out what to send. - "/carts/{id}/complete": + '/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 @@ -183,7 +633,7 @@ paths: tags: - Cart responses: - "200": + '200': description: >- If a cart was successfully authorized, but requires further action from the user the response body will contain the cart with an @@ -196,11 +646,15 @@ paths: - type: object properties: order: - $ref: "#/components/schemas/order" + $ref: '#/components/schemas/order' - type: object properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' + - type: object + properties: + cart: + $ref: '#/components/schemas/swap' /carts: post: summary: Create a Cart @@ -246,15 +700,15 @@ paths: tags: - Cart responses: - "200": + '200': description: Successfully created a new Cart content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/line-items": + $ref: '#/components/schemas/cart' + '/carts/{id}/line-items': post: operationId: PostCartsCartLineItems summary: Add a Line Item @@ -271,14 +725,14 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' requestBody: content: application/json: @@ -301,7 +755,7 @@ paths: description: >- An optional key-value map with additional details about the Line Item. - "/carts/{id}/payment-sessions": + '/carts/{id}/payment-sessions': post: operationId: PostCartsCartPaymentSessions summary: Initialize Payment Sessions @@ -318,15 +772,15 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/discounts/{code}": + $ref: '#/components/schemas/cart' + '/carts/{id}/discounts/{code}': delete: operationId: DeleteCartsCartDiscountsDiscount description: Removes a Discount from a Cart. @@ -347,15 +801,15 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/line-items/{line_id}": + $ref: '#/components/schemas/cart' + '/carts/{id}/line-items/{line_id}': delete: operationId: DeleteCartsCartLineItemsItem summary: Delete a Line Item @@ -376,14 +830,14 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' post: operationId: PostCartsCartLineItemsItem summary: Update a Line Item @@ -404,14 +858,14 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' requestBody: content: application/json: @@ -423,7 +877,7 @@ paths: quantity: type: integer description: The quantity to set the Line Item to. - "/carts/{id}/payment-sessions/{provider_id}": + '/carts/{id}/payment-sessions/{provider_id}': delete: operationId: DeleteCartsCartPaymentSessionsSession summary: Delete a Payment Session @@ -448,14 +902,14 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' post: operationId: PostCartsCartPaymentSessionUpdate summary: Update a Payment Session @@ -476,32 +930,26 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' requestBody: content: application/json: schema: type: object required: - - provider_id - data properties: - provider_id: - type: string - description: >- - The id of the Payment Provider responsible for the Payment - Session to update. data: type: object description: The data to update the payment session with. - "/carts/{id}": + '/carts/{id}': get: operationId: GetCartsCart summary: Retrieve a Cart @@ -516,15 +964,48 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" - "/carts/{id}/payment-session": + $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 @@ -541,14 +1022,14 @@ paths: tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" + $ref: '#/components/schemas/cart' requestBody: content: application/json: @@ -560,9 +1041,9 @@ paths: provider_id: type: string description: The id of the Payment Provider. - "/store/carts/{id}": + '/store/carts/{id}': post: - operationId: PostCartsCart + operationId: PostCartsCartPaymentMethodUpdate summary: Update a Cart" description: Updates a Cart. parameters: @@ -576,424 +1057,27 @@ paths: content: application/json: schema: + required: + - provider_id properties: - region_id: + provider_id: type: string - description: The id of the Region to create the Cart in. - country_code: - type: string - description: The 2 character ISO country code to create the Cart in. - email: - type: string - description: An email to be used on the Cart. - billing_address: - description: The Address to be used for billing purposes. - anyOf: - - $ref: "#/components/schemas/address" - shipping_address: - description: The Address to be used for shipping. - anyOf: - - $ref: "#/components/schemas/address" - gift_cards: - description: An array of Gift Card codes to add to the Cart. - type: array - items: - properties: - code: - description: The code that a Gift Card is identified by. - type: string - discounts: - description: An array of Discount codes to add to the Cart. - type: array - items: - properties: - code: - description: The code that a Discount is identifed by. - type: string - customer_id: - description: The id of the Customer to associate the Cart with. - type: string - context: - description: An optional object to provide context to the Cart. + description: The id of the Payment Provider. + data: type: object + description: '' tags: - Cart responses: - "200": + '200': description: OK content: application/json: schema: properties: cart: - $ref: "#/components/schemas/cart" - "/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. - tags: - - Collection - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - collection: - $ref: "#/components/schemas/product_collection" - "/customers/{id}/addresses": - post: - operationId: PostCustomersCustomerAddresses - summary: Add a Shipping Address - description: Adds a Shipping Address to a Customer's saved addresses. - parameters: - - in: path - name: id - required: true - description: The Customer id. - schema: - type: string - requestBody: - content: - application/json: - schema: - 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/{id}/addresses/{address_id}": - delete: - operationId: DeleteCustomersCustomerAddressesAddress - summary: Delete an Address - description: Removes an Address from the Customer's saved addresse. - parameters: - - in: path - name: id - required: true - description: The id of the Customer. - schema: - type: string - - in: path - name: address_id - required: true - description: The id of the Address to remove. - schema: - type: string - tags: - - Customer - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - customer: - $ref: "#/components/schemas/customer" - /customers/me: - get: - operationId: GetCustomersCustomer - summary: Retrieves a Customer - description: >- - Retrieves a Customer - the Customer must be logged in to retrieve their - details. - 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. - 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. - 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. - tags: - - Customer - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - payment_methods: - type: array - items: - $ref: "#/components/schemas/order" - /customers/password-token: - post: - operationId: PostCustomersCustomerPasswordToken - summary: Creates a reset password token - description: >- - Creates a reset password token to be used in a subsequent - /reset-password request. The password token should be sent out of band - e.g. via email and will not be returned. - tags: - - Customer - responses: - "204": - description: OK - /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. - "/customers/me/addresses/{address_id}": - post: - operationId: PostCustomersCustomerAddressesAddress - summary: Update a Shipping Address - description: Updates a Customer's saved Shipping Address. - 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" - "/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}": + $ref: '#/components/schemas/cart' + '/orders/cart/{cart_id}': get: operationId: GetOrdersOrderCartId summary: Retrieves Order by Cart id @@ -1010,15 +1094,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: Retrieves an Order @@ -1033,14 +1117,14 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: customer: - $ref: "#/components/schemas/customer" + $ref: '#/components/schemas/customer' /orders: get: operationId: GetOrders @@ -1065,15 +1149,15 @@ paths: tags: - Order responses: - "200": + '200': description: OK content: application/json: schema: properties: order: - $ref: "#/components/schemas/order" - "/products/{id}": + $ref: '#/components/schemas/order' + '/products/{id}': get: operationId: GetProductsProduct summary: Retrieves a Product @@ -1088,23 +1172,100 @@ paths: tags: - Product responses: - "200": + '200': description: OK content: application/json: schema: properties: product: - $ref: "#/components/schemas/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 + 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. + schema: + type: string tags: - Product responses: - "200": + '200': description: OK content: application/json: @@ -1117,13 +1278,13 @@ paths: description: The offset for pagination. type: integer limit: - description: "The maxmimum number of Products to return," + description: 'The maxmimum number of Products to return,' type: integer products: type: array items: - $ref: "#/components/schemas/product" - "/regions/{id}": + $ref: '#/components/schemas/product' + '/regions/{id}': get: operationId: GetRegionsRegion summary: Retrieves a Region @@ -1138,14 +1299,14 @@ paths: tags: - Region responses: - "200": + '200': description: OK content: application/json: schema: properties: region: - $ref: "#/components/schemas/region" + $ref: '#/components/schemas/region' /regions: get: operationId: GetRegions @@ -1154,7 +1315,7 @@ paths: tags: - Region responses: - "200": + '200': description: OK content: application/json: @@ -1167,13 +1328,13 @@ paths: description: The offset for pagination. type: integer limit: - description: "The maxmimum number of regions to return," + description: 'The maxmimum number of regions to return,' type: integer regions: type: array items: - $ref: "#/components/schemas/region" - "/return-reasons/{id}": + $ref: '#/components/schemas/region' + '/return-reasons/{id}': get: operationId: GetReturnReasonsReason summary: Retrieve a Return Reason @@ -1188,14 +1349,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' /return-reasons: get: operationId: GetReturnReasons @@ -1204,7 +1365,7 @@ paths: tags: - Return Reason responses: - "200": + '200': description: OK content: application/json: @@ -1213,7 +1374,62 @@ paths: return_reasons: type: array items: - $ref: "#/components/schemas/return_reason" + $ref: '#/components/schemas/return_reason' + /returns: + post: + operationId: PostReturns + summary: Create Return + description: Creates a Return for an Order. + requestBody: + content: + application/json: + schema: + properties: + order_id: + type: string + description: The id of the Order to create the Return from. + items: + description: The items to include in the Return. + type: array + items: + properties: + item_id: + description: The id of the Line Item from the Order. + type: string + quantity: + description: The quantity to return. + type: integer + required: + - item_id + - quantity + return_shipping: + description: >- + If the Return is to be handled by the store operator the + Customer can choose a Return Shipping Method. Alternatvely + the Customer can handle the Return themselves. + type: object + properties: + option_id: + type: string + description: >- + The id of the Shipping Option to create the Shipping + Method from. + required: + - option_id + required: + - order_id + - items + tags: + - Return + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + return: + $ref: '#/components/schemas/return' /shipping-options: get: operationId: GetShippingOptions @@ -1240,7 +1456,7 @@ paths: tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: @@ -1249,8 +1465,8 @@ paths: shipping_options: type: array items: - $ref: "#/components/schemas/shipping_option" - "/shipping-options/{cart_id}": + $ref: '#/components/schemas/shipping_option' + '/shipping-options/{cart_id}': get: operationId: GetShippingOptionsCartId summary: Retrieve Shipping Options for Cart @@ -1265,7 +1481,7 @@ paths: tags: - Shipping Option responses: - "200": + '200': description: OK content: application/json: @@ -1274,54 +1490,7 @@ paths: shipping_options: type: array items: - $ref: "#/components/schemas/shipping_option" - /returns: - post: - operationId: PostReturns - summary: Create Return - description: Creates a Return for an Order. - requestBody: - content: - application/json: - schema: - properties: - order_id: - type: string - description: The id of the Order to create the Return from. - items: - description: The items to include in the Return. - type: array - items: - properties: - item_id: - description: The id of the Line Item from the Order. - type: string - quantity: - description: The quantity to return. - type: integer - return_shipping: - description: >- - If the Return is to be handled by the store operator the - Customer can choose a Return Shipping Method. Alternatvely - the Customer can handle the Return themselves. - type: object - properties: - option_id: - type: string - description: >- - The id of the Shipping Option to create the Shipping - Method from. - tags: - - Return - responses: - "200": - description: OK - content: - application/json: - schema: - properties: - return: - $ref: "#/components/schemas/return" + $ref: '#/components/schemas/shipping_option' /swaps: post: operationId: PostSwaps @@ -1333,6 +1502,10 @@ paths: content: application/json: schema: + required: + - order_id + - return_items + - additional_items properties: order_id: type: string @@ -1341,6 +1514,9 @@ paths: description: The items to include in the Return. type: array items: + required: + - item_id + - quantity properties: item_id: description: The id of the Line Item from the Order. @@ -1348,6 +1524,12 @@ paths: quantity: description: The quantity to return. type: integer + reason_id: + description: The id of the reason of this return + type: string + note_id: + description: The id of the note + type: string return_shipping_option: type: string description: >- @@ -1357,6 +1539,9 @@ paths: description: The items to exchange the returned items to. type: array items: + required: + - variant_id + - quantity properties: variant_id: description: The id of the Product Variant to send. @@ -1367,15 +1552,15 @@ paths: tags: - Swap responses: - "200": + '200': description: OK content: application/json: schema: properties: swap: - $ref: "#/components/schemas/swap" - "/swaps/{cart_id}": + $ref: '#/components/schemas/swap' + '/swaps/{cart_id}': get: operationId: GetSwapsSwapCartId summary: Retrieve Swap by Cart id @@ -1390,15 +1575,15 @@ paths: tags: - Swap responses: - "200": + '200': description: OK content: application/json: schema: properties: swap: - $ref: "#/components/schemas/swap" - "/variants/{variant_id}": + $ref: '#/components/schemas/swap' + '/variants/{variant_id}': get: operationId: GetVariantsVariant summary: Retrieve a Product Variant @@ -1413,14 +1598,14 @@ paths: tags: - Product Variant responses: - "200": + '200': description: OK content: application/json: schema: properties: variant: - $ref: "#/components/schemas/product_variant" + $ref: '#/components/schemas/product_variant' /variants: get: operationId: GetVariants @@ -1432,10 +1617,24 @@ paths: description: A comma separated list of Product Variant ids to filter by. schema: type: string + - in: query + name: expand + description: A comma separated list of Product Variant relations to load. + schema: + type: string + - in: query + name: offset + schema: + type: number + - in: query + name: limit + description: Maximum number of Product Variants to return. + schema: + type: number tags: - Product Variant responses: - "200": + '200': description: OK content: application/json: @@ -1444,7 +1643,7 @@ paths: variants: type: array items: - $ref: "#/components/schemas/product_variant" + $ref: '#/components/schemas/product_variant' components: schemas: address: @@ -1471,7 +1670,7 @@ components: country_code: type: string country: - $ref: "#/components/schemas/country" + $ref: '#/components/schemas/country' cart: title: Cart description: Represents a user cart @@ -1484,43 +1683,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: @@ -1587,19 +1786,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 @@ -1609,7 +1808,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: >- @@ -1620,7 +1819,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 @@ -1669,36 +1868,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 @@ -1813,11 +2012,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 @@ -1833,6 +2032,30 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: + type: object + 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 @@ -1847,11 +2070,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: @@ -1909,7 +2132,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 @@ -1948,7 +2171,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 @@ -1971,7 +2194,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 @@ -2011,12 +2234,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 @@ -2054,7 +2277,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 @@ -2109,7 +2332,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 @@ -2117,7 +2340,7 @@ components: Provider. type: array items: - $ref: "#/components/schemas/tracking_link" + $ref: '#/components/schemas/tracking_link' tracking_numbers: deprecated: true description: >- @@ -2168,7 +2391,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 @@ -2206,7 +2429,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 @@ -2260,6 +2483,39 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: >- @@ -2321,7 +2577,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 @@ -2386,7 +2642,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 @@ -2422,7 +2678,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 @@ -2481,7 +2737,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 @@ -2502,7 +2758,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 @@ -2556,6 +2812,23 @@ components: description: The date with timezone at which the resource was last updated. type: string format: date-time + 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 @@ -2600,80 +2873,80 @@ components: currency_code: type: string tax_rate: - type: integer + type: number 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 @@ -2939,7 +3212,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 @@ -2984,6 +3257,62 @@ components: metadata: description: An optional key-value map with additional information. type: object + 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: >- @@ -3043,7 +3372,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. @@ -3124,7 +3453,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 @@ -3182,7 +3511,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 @@ -3193,14 +3522,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 @@ -3254,16 +3583,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 @@ -3355,21 +3684,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 @@ -3401,7 +3730,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 @@ -3419,7 +3748,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 @@ -3481,7 +3810,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 @@ -3496,7 +3825,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 @@ -3547,7 +3876,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 @@ -3633,7 +3962,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. @@ -3671,7 +4000,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 @@ -3722,7 +4051,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 @@ -3730,7 +4059,35 @@ 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 + 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 + 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 @@ -3748,7 +4105,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: @@ -3766,7 +4123,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 @@ -3832,22 +4189,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 @@ -3859,17 +4216,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: >- @@ -3890,11 +4247,91 @@ 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. type: object + 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: >- @@ -3948,7 +4385,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/www/reference/src/components/content/method.js b/www/reference/src/components/content/method.js index e9efcd3626..773844dee7 100644 --- a/www/reference/src/components/content/method.js +++ b/www/reference/src/components/content/method.js @@ -1,16 +1,17 @@ +import { Box, Flex, Heading, Text } from "theme-ui" import React, { useContext, useEffect, useRef } from "react" -import Markdown from "react-markdown" -import { Flex, Text, Box, Heading } from "theme-ui" -import { convertToKebabCase } from "../../utils/convert-to-kebab-case" -import Parameters from "./parameters" -import Route from "./route" -import JsonContainer from "./json-container" + import Description from "./description" -import ResponsiveContainer from "./responsive-container" -import { formatMethodParams } from "../../utils/format-parameters" -import useInView from "../../hooks/use-in-view" +import JsonContainer from "./json-container" +import Markdown from "react-markdown" import NavigationContext from "../../context/navigation-context" +import Parameters from "./parameters" +import ResponsiveContainer from "./responsive-container" +import Route from "./route" +import { convertToKebabCase } from "../../utils/convert-to-kebab-case" +import { formatMethodParams } from "../../utils/format-parameters" import { formatRoute } from "../../utils/format-route" +import useInView from "../../hooks/use-in-view" const Method = ({ data, section, pathname, api }) => { const { parameters, requestBody, description, method, summary } = data @@ -86,7 +87,7 @@ const Method = ({ data, section, pathname, api }) => { } const getCurlJson = (properties, prefix, bodyParameters) => { - if (!properties[0]) { + if (!properties[0] || !jsonResponse) { return } const jsonObject = JSON.parse(jsonResponse)