import Medusa from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.return.list()
.then(({ returns, count, limit, offset }) => {
console.log(returns)
}){
"limit": 123,
"offset": 123,
"count": 123,
"returns": [
{
"id": "<string>",
"order_id": "<string>",
"items": [
{
"id": "<string>",
"quantity": 123,
"received_quantity": 123,
"damaged_quantity": 123,
"item_id": "<string>",
"return_id": "<string>",
"reason_id": "<string>",
"note": "<string>",
"metadata": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"order_version": 123,
"display_id": 123,
"received_at": "<string>",
"status": "canceled",
"refund_amount": 123,
"exchange_id": "<string>",
"location_id": "<string>",
"claim_id": "<string>",
"no_notification": true
}
]
}Retrieve a list of returns. The returns can be filtered by fields such as id. The returns can also be sorted or paginated.
import Medusa from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.return.list()
.then(({ returns, count, limit, offset }) => {
console.log(returns)
}){
"limit": 123,
"offset": 123,
"count": 123,
"returns": [
{
"id": "<string>",
"order_id": "<string>",
"items": [
{
"id": "<string>",
"quantity": 123,
"received_quantity": 123,
"damaged_quantity": 123,
"item_id": "<string>",
"return_id": "<string>",
"reason_id": "<string>",
"note": "<string>",
"metadata": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"order_version": 123,
"display_id": 123,
"received_at": "<string>",
"status": "canceled",
"refund_amount": 123,
"exchange_id": "<string>",
"location_id": "<string>",
"claim_id": "<string>",
"no_notification": true
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Filter by a return's ID.
Filter by a return status.
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by sales channel IDs to retrieve their associated returns.
A sales channel's ID.
Filter by region IDs to retrieve their associated returns. The return's region id.
Search term to filter the return's searchable properties.
Filter by the return's creation date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
The value to match.
Filter by values not in this array.
The value not to match.
Filter by values not matching this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
The values to match.
Filter arrays that contain some of the values of this parameter.
The values to match.
Filter arrays that contain all values of this parameter.
The values to match.
Filter by whether a value for this parameter exists (not null).
Filter by the return's update date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
The value to match.
Filter by values not in this array.
The value not to match.
Filter by values not matching this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
The values to match.
Filter arrays that contain some of the values of this parameter.
The values to match.
Filter arrays that contain all values of this parameter.
The values to match.
Filter by whether a value for this parameter exists (not null).
The return's customer id.
Whether to include deleted records in the result.
OK
The paginated list of returns. The paginated list of returns.
The maximum number of items returned.
The number of items skipped before retrieving the returned items.
The total number of items.
The return's returns.
Show child attributes
The return's ID.
The ID of the associated order.
The return's items.
Show child attributes
The return item's ID.
The return item's quantity.
The received quantity of the item. This quantity is added to the stocked inventory quantity of the item.
The received damaged quantity of the item, which isn't added to the stocked inventory quantity of the item.
The ID of the associated order item.
The ID of the return this return item belongs to.
The ID of the return reason associated with the item.
A note about why the item was returned.
The return item's metadata, can hold custom key-value pairs.
The date the return was created.
The date the return was canceled.
The return's order version.
The return's display id.
The date the return was received.
The return's status.
canceled, requested, received, partially_received The amount refunded by this return.
The return's exchange id.
The return's location id.
The return's claim id.
Whether the customer should receive notifications about the return's updates.