AdminSwapsResource
This class is used to send requests to Admin Swap API Routes. All its method
are available in the JS Client under the medusa.admin.swaps
property.
All methods in this class require user authentication.
A swap is created by a customer or an admin to exchange an item with a new one. Creating a swap implicitely includes creating a return for the item being exchanged.
Related Guide: How to manage swaps
Methods
list
Retrieve a list of swaps. The swaps can be paginated.
Example
To list swaps:
By default, only the first 50
records are retrieved. You can control pagination by specifying the limit
and offset
properties:
Parameters
query
AdminGetSwapsParamsPagination configurations to apply on the retrieved swaps.
query
AdminGetSwapsParamscustomHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminSwapsListRes>RequiredResolves to the list of swaps with pagination fields.
ResponsePromise
ResponsePromise<AdminSwapsListRes>Requiredretrieve
Retrieve a swap's details.
Example
Parameters
id
stringRequiredThe swap's ID.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminSwapsRes>RequiredResolves to the swap's details.
ResponsePromise
ResponsePromise<AdminSwapsRes>RequiredWas this section helpful?