feat: creates support for swaps on the storefront (#355)
This commit is contained in:
@@ -40,6 +40,345 @@ tags:
|
||||
servers:
|
||||
- url: 'https://api.medusa-commerce.com/store'
|
||||
paths:
|
||||
'/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'
|
||||
post:
|
||||
operationId: PostCustomersCustomerAddressesAddress
|
||||
summary: Update a Shipping Address
|
||||
description: Updates a Customer's saved Shipping Address.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The Customer id.
|
||||
schema:
|
||||
type: string
|
||||
- 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/{id}':
|
||||
get:
|
||||
operationId: GetCustomersCustomer
|
||||
summary: Retrieves a Customer
|
||||
description: >-
|
||||
Retrieves a Customer - the Customer must be logged in to retrieve their
|
||||
details.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
customer:
|
||||
$ref: '#/components/schemas/customer'
|
||||
post:
|
||||
operationId: PostCustomersCustomer
|
||||
summary: Update Customer details
|
||||
description: Updates a Customer's saved details.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
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
|
||||
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/{id}/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.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
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/{id}/orders':
|
||||
get:
|
||||
operationId: GetCustomersCustomerOrders
|
||||
summary: Retrieve Customer Orders
|
||||
description: Retrieves a list of a Customer's Orders.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
payment_methods:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/order'
|
||||
'/customers/{id}/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:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'204':
|
||||
description: OK
|
||||
'/customers/{id}/reset-password':
|
||||
post:
|
||||
operationId: PostCustomersCustomerResetPassword
|
||||
summary: Resets Customer password
|
||||
description: >-
|
||||
Resets a Customer's password using a password token created by a
|
||||
previous /password-token request.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
customer:
|
||||
$ref: '#/components/schemas/customer'
|
||||
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
|
||||
@@ -546,345 +885,6 @@ paths:
|
||||
properties:
|
||||
cart:
|
||||
$ref: '#/components/schemas/cart'
|
||||
'/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'
|
||||
post:
|
||||
operationId: PostCustomersCustomerAddressesAddress
|
||||
summary: Update a Shipping Address
|
||||
description: Updates a Customer's saved Shipping Address.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The Customer id.
|
||||
schema:
|
||||
type: string
|
||||
- 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/{id}':
|
||||
get:
|
||||
operationId: GetCustomersCustomer
|
||||
summary: Retrieves a Customer
|
||||
description: >-
|
||||
Retrieves a Customer - the Customer must be logged in to retrieve their
|
||||
details.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
customer:
|
||||
$ref: '#/components/schemas/customer'
|
||||
post:
|
||||
operationId: PostCustomersCustomer
|
||||
summary: Update Customer details
|
||||
description: Updates a Customer's saved details.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
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
|
||||
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/{id}/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.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
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/{id}/orders':
|
||||
get:
|
||||
operationId: GetCustomersCustomerOrders
|
||||
summary: Retrieve Customer Orders
|
||||
description: Retrieves a list of a Customer's Orders.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
payment_methods:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/order'
|
||||
'/customers/{id}/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:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'204':
|
||||
description: OK
|
||||
'/customers/{id}/reset-password':
|
||||
post:
|
||||
operationId: PostCustomersCustomerResetPassword
|
||||
summary: Resets Customer password
|
||||
description: >-
|
||||
Resets a Customer's password using a password token created by a
|
||||
previous /password-token request.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Customer.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Customer
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
customer:
|
||||
$ref: '#/components/schemas/customer'
|
||||
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.
|
||||
/auth:
|
||||
post:
|
||||
operationId: PostAuth
|
||||
@@ -1326,6 +1326,66 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
/swaps:
|
||||
post:
|
||||
operationId: PostSwaps
|
||||
summary: Create a Swap
|
||||
description: >-
|
||||
Creates a Swap on an Order by providing some items to return along with
|
||||
some items to send back
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
order_id:
|
||||
type: string
|
||||
description: The id of the Order to create the Swap for.
|
||||
return_items:
|
||||
description: The items to include in the Return.
|
||||
type: array
|
||||
items:
|
||||
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.
|
||||
additional_items:
|
||||
description: The items to exchange the returned items to.
|
||||
type: array
|
||||
items:
|
||||
properties:
|
||||
variant_id:
|
||||
description: The id of the Product Variant to send.
|
||||
type: string
|
||||
quantity:
|
||||
description: The quantity to send of the variant.
|
||||
type: integer
|
||||
tags:
|
||||
- Swap
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
swap:
|
||||
$ref: '#/components/schemas/swap'
|
||||
'/swaps/{cart_id}':
|
||||
get:
|
||||
operationId: GetSwapsSwapCartId
|
||||
|
||||
Reference in New Issue
Block a user