chore(js-sdk,types): add tsdocs for admin JS SDK methods [2/n] (#9696)

Add TSDocs to admin JS SDK from customer groups to fulfillment providers

[2/n]
This commit is contained in:
Shahed Nasser
2024-10-22 14:53:09 +03:00
committed by GitHub
parent 5ea3100c10
commit 3df7ebe3d1
20 changed files with 1201 additions and 45 deletions

View File

@@ -14,6 +14,38 @@ export class CustomerGroup {
this.client = client
}
/**
* This method retrieves a customer group by its ID. It sends a request to the
* [Get Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_getcustomergroupsid) API route.
*
* @param id - The customer group's ID.
* @param query - Configure the fields to retrieve in the customer group.
* @param headers - Headers to pass in the request
* @returns The group's details.
*
* @example
* To retrieve a customer group by its ID:
*
* ```ts
* sdk.admin.customerGroup.retrieve("cusgroup_123")
* .then(({ customer_group }) => {
* console.log(customer_group)
* })
* ```
*
* To specify the fields and relations to retrieve:
*
* ```ts
* sdk.admin.customerGroup.retrieve("cusgroup_123", {
* fields: "id,*customer"
* })
* .then(({ customer_group }) => {
* console.log(customer_group)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async retrieve(
id: string,
query?: HttpTypes.AdminGetCustomerGroupParams,
@@ -29,6 +61,53 @@ export class CustomerGroup {
)
}
/**
* This method retrieves a paginated list of customer groups. It sends a request to the
* [List Customer Groups](https://docs.medusajs.com/v2/api/admin#customer-groups_getcustomergroups)
* API route.
*
* @param query - Filters and pagination configurations.
* @param headers - Headers to pass in the request.
* @returns The paginated list of customer groups.
*
* @example
* To retrieve the list of customer groups:
*
* ```ts
* sdk.admin.customerGroup.list()
* .then(({ customer_groups, count, limit, offset }) => {
* console.log(customer_groups)
* })
* ```
*
* To configure the pagination, pass the `limit` and `offset` query parameters.
*
* For example, to retrieve only 10 items and skip 10 items:
*
* ```ts
* sdk.admin.customerGroup.list({
* limit: 10,
* offset: 10
* })
* .then(({ customer_groups, count, limit, offset }) => {
* console.log(customer_groups)
* })
* ```
*
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
* in each customer group:
*
* ```ts
* sdk.admin.customerGroup.list({
* fields: "id,*customer"
* })
* .then(({ customer_groups, count, limit, offset }) => {
* console.log(customer_groups)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async list(
query?: HttpTypes.AdminGetCustomerGroupsParams,
headers?: ClientHeaders
@@ -43,9 +122,27 @@ export class CustomerGroup {
)
}
/**
* This method creates a customer group. It sends a request to the
* [Create Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroups)
* API route.
*
* @param body - The customer group's details.
* @param query - Configure the fields to retrieve in the customer group.
* @param headers - Headers to pass in the request.
* @returns The customer group's details.
*
* @example
* sdk.admin.customerGroup.create({
* name: "VIP"
* })
* .then(({ customer_group }) => {
* console.log(customer_group)
* })
*/
async create(
body: HttpTypes.AdminCreateCustomerGroup,
query?: HttpTypes.AdminGetCustomerGroupsParams,
query?: HttpTypes.AdminGetCustomerGroupParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminCustomerGroupResponse>(
@@ -59,10 +156,29 @@ export class CustomerGroup {
)
}
/**
* This method updates a customer group's details. It sends a request to the
* [Update Customer](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroupsid)
* API route.
*
* @param id - The customer group's ID.
* @param body - The details to update in the group.
* @param query - Configure the fields to retrieve in the customer group.
* @param headers - Headers to pass in the request.
* @returns The customer group's details.
*
* @example
* sdk.admin.customerGroup.update("cusgroup_123", {
* name: "VIP"
* })
* .then(({ customer_group }) => {
* console.log(customer_group)
* })
*/
async update(
id: string,
body: HttpTypes.AdminUpdateCustomerGroup,
query?: HttpTypes.AdminGetCustomerGroupsParams,
query?: HttpTypes.AdminGetCustomerGroupParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminCustomerGroupResponse>(
@@ -76,6 +192,21 @@ export class CustomerGroup {
)
}
/**
* This method deletes a customer group. This method sends a request to the
* [Delete Customer Group](https://docs.medusajs.com/v2/api/admin#customer-groups_deletecustomergroupsid)
* API route.
*
* @param id - The customer group's ID.
* @param headers - Headers to pass in the request
* @returns The deletion's details.
*
* @example
* sdk.admin.customerGroup.delete("cusgroup_123")
* .then(({ deleted }) => {
* console.log(deleted)
* })
*/
async delete(id: string, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminCustomerGroupDeleteResponse>(
`/admin/customer-groups/${id}`,
@@ -86,6 +217,25 @@ export class CustomerGroup {
)
}
/**
* This method manages customers of a group to add or remove them from the group.
* It sends a request to the [Manage Customers](https://docs.medusajs.com/v2/api/admin#customer-groups_postcustomergroupsidcustomers)
* API route.
*
* @param id - The group's ID.
* @param body - The customers to add or remove from the group.
* @param headers - Headers to pass in the request
* @returns The customer group's details.
*
* @example
* sdk.admin.customerGroup.batchCustomers("cusgroup_123", {
* add: ["cus_123"],
* remove: ["cus_321"]
* })
* .then(({ customer_group }) => {
* console.log(customer_group)
* })
*/
async batchCustomers(
id: string,
body: HttpTypes.AdminBatchLink,

View File

@@ -1,7 +1,5 @@
import {
FindParams,
HttpTypes,
PaginatedResponse,
SelectParams,
} from "@medusajs/types"
import { Client } from "../client"
@@ -19,14 +17,31 @@ export class Customer {
this.client = client
}
/**
* This method creates a customer. It sends a request to the
* [Create Customer](https://docs.medusajs.com/v2/api/admin#customers_postcustomers) API route.
*
* @param body - The customer's details.
* @param query - Configure the fields to retrieve in the customer.
* @param headers - Headers to pass in the request.
* @returns The customer's details.
*
* @example
* sdk.admin.customer.create({
* email: "customer@gmail.com"
* })
* .then(({ customer }) => {
* console.log(customer)
* })
*/
async create(
body: HttpTypes.AdminCreateCustomer,
query?: SelectParams,
headers?: ClientHeaders
) {
return this.client.fetch<{
customer: HttpTypes.AdminCustomer
}>(`/admin/customers`, {
return this.client.fetch<
HttpTypes.AdminCustomerResponse
>(`/admin/customers`, {
method: "POST",
headers,
body,
@@ -34,13 +49,31 @@ export class Customer {
})
}
/**
* This method updates a customer's details. It sends a request to the
* [Update Customer](https://docs.medusajs.com/v2/api/admin#customers_postcustomersid) API route.
*
* @param id - The customer's ID.
* @param body - The details to update of the customer.
* @param query - Configure the fields to retrieve in the customer.
* @param headers - Headers to pass in the request.
* @returns The customer's details.
*
* @example
* sdk.admin.customer.update("cus_123", {
* first_name: "John"
* })
* .then(({ customer }) => {
* console.log(customer)
* })
*/
async update(
id: string,
body: HttpTypes.AdminUpdateCustomer,
query?: SelectParams,
headers?: ClientHeaders
) {
return this.client.fetch<{ customer: HttpTypes.AdminCustomer }>(
return this.client.fetch<HttpTypes.AdminCustomerResponse>(
`/admin/customers/${id}`,
{
method: "POST",
@@ -51,20 +84,100 @@ export class Customer {
)
}
/**
* This method retrieves a paginated list of customers. It sends a request to the
* [List Customers](https://docs.medusajs.com/v2/api/admin#customers_getcustomers)
* API route.
*
* @param queryParams - Filters and pagination configurations.
* @param headers - Headers to pass in the request.
* @returns The paginated list of customers.
*
* @example
* To retrieve the list of customers:
*
* ```ts
* sdk.admin.customer.list()
* .then(({ customers, count, limit, offset }) => {
* console.log(customers)
* })
* ```
*
* To configure the pagination, pass the `limit` and `offset` query parameters.
*
* For example, to retrieve only 10 items and skip 10 items:
*
* ```ts
* sdk.admin.customer.list({
* limit: 10,
* offset: 10
* })
* .then(({ customers, count, limit, offset }) => {
* console.log(customers)
* })
* ```
*
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
* in each customer:
*
* ```ts
* sdk.admin.customer.list({
* fields: "id,*groups"
* })
* .then(({ customers, count, limit, offset }) => {
* console.log(customers)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async list(
queryParams?: FindParams & HttpTypes.AdminCustomerFilters,
queryParams?: HttpTypes.AdminCustomerFilters,
headers?: ClientHeaders
) {
return this.client.fetch<
PaginatedResponse<{ customers: HttpTypes.AdminCustomer[] }>
HttpTypes.AdminCustomerListResponse
>(`/admin/customers`, {
headers,
query: queryParams,
})
}
/**
* This method retrieves a customer by its ID. It sends a request to the
* [Get Customer](https://docs.medusajs.com/v2/api/admin#customers_getcustomersid)
* API route.
*
* @param id - The customer's ID.
* @param query - Configure the fields to retrieve in the customer.
* @param headers - Headers to pass in the request.
* @returns The customer's details.
*
* @example
* To retrieve a customer by its ID:
*
* ```ts
* sdk.admin.customer.retrieve("cus_123")
* .then(({ customer }) => {
* console.log(customer)
* })
* ```
*
* To specify the fields and relations to retrieve:
*
* ```ts
* sdk.admin.customer.retrieve("cus_123", {
* fields: "id,*groups"
* })
* .then(({ customer }) => {
* console.log(customer)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
return this.client.fetch<{ customer: HttpTypes.AdminCustomer }>(
return this.client.fetch<HttpTypes.AdminCustomerResponse>(
`/admin/customers/${id}`,
{
query,
@@ -73,6 +186,21 @@ export class Customer {
)
}
/**
* This method deletes a customer by its ID. It sends a request to the
* [Delete Customer](https://docs.medusajs.com/v2/api/admin#customers_deletecustomersid)
* API route.
*
* @param id - The customer's ID.
* @param headers - Headers to pass in the request.
* @returns The deletion's details.
*
* @example
* sdk.admin.customer.delete("cus_123")
* .then(({ deleted }) => {
* console.log(deleted)
* })
*/
async delete(id: string, headers?: ClientHeaders) {
return this.client.fetch<HttpTypes.AdminCustomerDeleteResponse>(
`/admin/customers/${id}`,

View File

@@ -1,4 +1,4 @@
import { HttpTypes } from "@medusajs/types"
import { HttpTypes, SelectParams } from "@medusajs/types"
import { Client } from "../client"
import { ClientHeaders } from "../types"
@@ -15,6 +15,53 @@ export class Exchange {
this.client = client
}
/**
* This method retrieves a paginated list of exchanges. It sends a request to the
* [List Exchanges](https://docs.medusajs.com/v2/api/admin#exchanges_getexchanges)
* API route.
*
* @param query - Filters and pagination configurations.
* @param headers - Headers to pass in the request.
* @returns The paginated list of exchanges.
*
* @example
* To retrieve the list of exchanges:
*
* ```ts
* sdk.admin.exchange.list()
* .then(({ exchanges, count, limit, offset }) => {
* console.log(exchanges)
* })
* ```
*
* To configure the pagination, pass the `limit` and `offset` query parameters.
*
* For example, to retrieve only 10 items and skip 10 items:
*
* ```ts
* sdk.admin.exchange.list({
* limit: 10,
* offset: 10
* })
* .then(({ exchanges, count, limit, offset }) => {
* console.log(exchanges)
* })
* ```
*
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
* in each exchange:
*
* ```ts
* sdk.admin.exchange.list({
* fields: "id,*order"
* })
* .then(({ exchanges, count, limit, offset }) => {
* console.log(exchanges)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async list(
query?: HttpTypes.AdminExchangeListParams,
headers?: ClientHeaders
@@ -28,9 +75,42 @@ export class Exchange {
)
}
/**
* This method retrieves an exchange by its ID. It sends a request to the
* [Get Exchange](https://docs.medusajs.com/v2/api/admin#exchanges_getexchangesid)
* API route.
*
* @param id - The exchange's ID.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request.
* @returns The exchange's details.
*
* @example
* To retrieve an exchange by its ID:
*
* ```ts
* sdk.admin.exchange.retrieve("exchange_123")
* .then(({ exchange }) => {
* console.log(exchange)
* })
* ```
*
* To specify the fields and relations to retrieve:
*
* ```ts
* sdk.admin.exchange.retrieve("exchange_123", {
* fields: "id,*order"
* })
* .then(({ exchange }) => {
* console.log(exchange)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async retrieve(
id: string,
query?: HttpTypes.AdminExchangeParams,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
@@ -42,6 +122,23 @@ export class Exchange {
)
}
/**
* This method creates an admin exchange. It sends a request to the
* [Create Exchange](https://docs.medusajs.com/v2/api/admin#exchanges_postexchanges) API route.
*
* @param body - The exchange's details.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request.
* @returns The exchange's details.
*
* @example
* sdk.admin.exchange.create({
* order_id: "order_123"
* })
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async create(
body: HttpTypes.AdminCreateExchange,
query?: HttpTypes.SelectParams,
@@ -58,6 +155,21 @@ export class Exchange {
)
}
/**
* This method cancels an exchange. It sends a request to the
* [Cancel Exchange](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidcancel) API route.
*
* @param id - The exchange's ID.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request.
* @returns The exchange's details.
*
* @example
* sdk.admin.exchange.cancel("exchange_123")
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async cancel(
id: string,
query?: HttpTypes.SelectParams,
@@ -73,13 +185,37 @@ export class Exchange {
)
}
/**
* This method adds inbound (or return) items to an exchange. These inbound items will
* have the action `RETURN_ITEM`.
*
* This method sends a request to the [Add Inbound Items](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidinbounditems)
* API route.
*
* @param id - The exchange's ID.
* @param body - The items to add.
* @param query - Configure the fields to retrieve in the return.
* @param headers - Headers to pass in the request.
* @returns The details of the return associated with the exchange, with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.addInboundItems("exchange_123", {
* items: [{
* id: "orli_123",
* quantity: 1
* }]
* })
* .then(({ return: returnData }) => {
* console.log(returnData)
* })
*/
async addInboundItems(
id: string,
body: HttpTypes.AdminAddExchangeInboundItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeReturnResponse>(
`/admin/exchanges/${id}/inbound/items`,
{
method: "POST",
@@ -90,6 +226,35 @@ export class Exchange {
)
}
/**
* This method updates an inbound (or return) item from an exchange using the ID of
* the item's `RETURN_ITEM` action.
*
* Every item has an `actions` property, whose value is an array of actions. You can
* check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Update Inbound Item](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidinbounditemsaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the return item's `RETURN_ITEM` action.
* @param body - The details to update.
* @param query - Configure the fields to retrieve in the return.
* @param headers - Headers to pass in the request.
* @returns The details of the return associated with the exchange, with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.updateInboundItem(
* "exchange_123",
* "ordchact_123",
* {
* quantity: 1
* }
* )
* .then(({ return: returnData }) => {
* console.log(returnData)
* })
*/
async updateInboundItem(
id: string,
actionId: string,
@@ -97,7 +262,7 @@ export class Exchange {
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeReturnResponse>(
`/admin/exchanges/${id}/inbound/items/${actionId}`,
{
method: "POST",
@@ -108,13 +273,38 @@ export class Exchange {
)
}
/**
* This method removes an inbound (or return) item from an exchange using the ID of the
* item's `RETURN_ITEM` action.
*
* Every item has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Remove Inbound Item](https://docs.medusajs.com/v2/api/admin#exchanges_deleteexchangesidinbounditemsaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the return item's `RETURN_ITEM` action.
* @param query - Configure the fields to retrieve in the return.
* @param headers - Headers to pass in the request.
* @returns The details of the return associated with the exchange, with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.removeInboundItem(
* "exchange_123",
* "ordchact_123",
* )
* .then(({ return: returnData }) => {
* console.log(returnData)
* })
*/
async removeInboundItem(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeReturnResponse>(
`/admin/exchanges/${id}/inbound/items/${actionId}`,
{
method: "DELETE",
@@ -124,13 +314,37 @@ export class Exchange {
)
}
/**
* This method adds an inbound (or return) shipping method to an exchange.
* The inbound shipping method will have a `SHIPPING_ADD` action.
*
* This method sends a request to the [Add Inbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidinboundshippingmethod)
* API route.
*
* This method sends a request to the [Add Inbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidinboundshippingmethod)
* API route.
*
* @param id - The exchange's ID.
* @param body - The shipping method's details.
* @param query - Configure the fields to retrieve in the return.
* @param headers - Headers to pass in the request.
* @returns The details of the return associated with the exchange, with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.addInboundShipping("exchange_123", {
* shipping_option_id: "so_123"
* })
* .then(({ return: returnData }) => {
* console.log(returnData)
* })
*/
async addInboundShipping(
id: string,
body: HttpTypes.AdminExchangeAddInboundShipping,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeReturnResponse>(
`/admin/exchanges/${id}/inbound/shipping-method`,
{
method: "POST",
@@ -141,6 +355,35 @@ export class Exchange {
)
}
/**
* This method updates the shipping method for returning items in the exchange using the ID
* of the method's `SHIPPING_ADD` action.
*
* Every shipping method has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Update Inbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidinboundshippingmethodaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
* @param body - The details to update.
* @param query - Configure the fields to retrieve in the return.
* @param headers - Headers to pass in the request.
* @returns The details of the return associated with the exchange, with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.updateInboundShipping(
* "exchange_123",
* "ordchact_123",
* {
* custom_amount: 10
* }
* )
* .then(({ return: returnData }) => {
* console.log(returnData)
* })
*/
async updateInboundShipping(
id: string,
actionId: string,
@@ -148,7 +391,7 @@ export class Exchange {
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeReturnResponse>(
`/admin/exchanges/${id}/inbound/shipping-method/${actionId}`,
{
method: "POST",
@@ -159,13 +402,38 @@ export class Exchange {
)
}
/**
* This method removes the shipping method for returning items in the exchange using the ID
* of the method's `SHIPPING_ADD` action.
*
* Every shipping method has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Remove Inbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_deleteexchangesidinboundshippingmethodaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
* @param query - Configure the fields to retrieve in the return.
* @param headers - Headers to pass in the request.
* @returns The details of the return associated with the exchange, with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.deleteInboundShipping(
* "exchange_123",
* "ordchact_123",
* )
* .then(({ return: returnData }) => {
* console.log(returnData)
* })
*/
async deleteInboundShipping(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeReturnResponse>(
`/admin/exchanges/${id}/inbound/shipping-method/${actionId}`,
{
method: "DELETE",
@@ -175,13 +443,37 @@ export class Exchange {
)
}
/**
* This method adds outbound (or new) items to an exchange.
* These outbound items will have the action `ITEM_ADD`.
*
* This method sends a request to the [Add Outbound Items](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidoutbounditems)
* API route.
*
* @param id - The exchange's ID.
* @param body - The items to add.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.addOutboundItems("exchange_123", {
* items: [{
* id: "variant_123",
* quantity: 1
* }]
* })
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async addOutboundItems(
id: string,
body: HttpTypes.AdminAddExchangeOutboundItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangePreviewResponse>(
`/admin/exchanges/${id}/outbound/items`,
{
method: "POST",
@@ -192,6 +484,35 @@ export class Exchange {
)
}
/**
* This method updates an outbound (or new) item from an exchange using the ID
* of the item's `ITEM_ADD` action.
*
* Every item has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Update Inbound Item](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidoutbounditemsaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the new exchange item's `ITEM_ADD` action.
* @param body - The item's details to update.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.updateOutboundItem(
* "exchange_123",
* "ordchact_123",
* {
* quantity: 1
* }
* )
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async updateOutboundItem(
id: string,
actionId: string,
@@ -199,7 +520,7 @@ export class Exchange {
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangePreviewResponse>(
`/admin/exchanges/${id}/outbound/items/${actionId}`,
{
method: "POST",
@@ -210,13 +531,38 @@ export class Exchange {
)
}
/**
* This method removes an outbound (or new) item from an exchange using the ID
* of the item's `ITEM_ADD` action.
*
* Every item has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Update Outbound Item](https://docs.medusajs.com/v2/api/admin#exchanges_deleteexchangesidoutbounditemsaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the new exchange item's `ITEM_ADD` action.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.removeOutboundItem(
* "exchange_123",
* "ordchact_123",
* )
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async removeOutboundItem(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangePreviewResponse>(
`/admin/exchanges/${id}/outbound/items/${actionId}`,
{
method: "DELETE",
@@ -226,13 +572,34 @@ export class Exchange {
)
}
/**
* This method adds an outbound shipping method to an exchange. The outbound shipping method
* will have a `SHIPPING_ADD` action.
*
* This method sends a request to the [Add Outbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidoutboundshippingmethod)
* API route.
*
* @param id - The exchange's ID.
* @param body - The shipping method's details.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.addOutboundShipping("exchange_123", {
* shipping_option_id: "so_123"
* })
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async addOutboundShipping(
id: string,
body: HttpTypes.AdminExchangeAddOutboundShipping,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangePreviewResponse>(
`/admin/exchanges/${id}/outbound/shipping-method`,
{
method: "POST",
@@ -243,6 +610,35 @@ export class Exchange {
)
}
/**
* This method updates the shipping method for delivering outbound items in the exchange using
* the ID of the method's `SHIPPING_ADD` action.
*
* Every shipping method has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Update Outbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidoutboundshippingmethodaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
* @param body - The details to update.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.updateOutboundShipping(
* "exchange_123",
* "ordchact_123",
* {
* custom_amount: 10
* }
* )
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async updateOutboundShipping(
id: string,
actionId: string,
@@ -250,7 +646,7 @@ export class Exchange {
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangePreviewResponse>(
`/admin/exchanges/${id}/outbound/shipping-method/${actionId}`,
{
method: "POST",
@@ -261,13 +657,38 @@ export class Exchange {
)
}
/**
* This method removes the shipping method for delivering outbound items in the exchange using
* the ID of the method's `SHIPPING_ADD` action.
*
* Every shipping method has an `actions` property, whose value is an array of actions.
* You can check the action's name using its `action` property, and use the value of the `id` property.
*
* This method sends a request to the [Remove Outbound Shipping](https://docs.medusajs.com/v2/api/admin#exchanges_deleteexchangesidoutboundshippingmethodaction_id)
* API route.
*
* @param id - The exchange's ID.
* @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.deleteOutboundShipping(
* "exchange_123",
* "ordchact_123",
* )
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async deleteOutboundShipping(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangePreviewResponse>(
`/admin/exchanges/${id}/outbound/shipping-method/${actionId}`,
{
method: "DELETE",
@@ -277,13 +698,31 @@ export class Exchange {
)
}
/**
* This method confirms an exchange request, applying its changes on the associated order.
*
* This method sends a request to the [Confirm Exchange](https://docs.medusajs.com/v2/api/admin#exchanges_postexchangesidrequest)
* API route.
*
* @param id - The exchange's ID.
* @param body - The confirmation's details.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The exchange and associated return's details with a preview of the order when the exchange is applied.
*
* @example
* sdk.admin.exchange.request("exchange_123", {})
* .then(({ exchange }) => {
* console.log(exchange)
* })
*/
async request(
id: string,
body: HttpTypes.AdminRequestExchange,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeRequestResponse>(
`/admin/exchanges/${id}/request`,
{
method: "POST",
@@ -294,12 +733,28 @@ export class Exchange {
)
}
/**
* This method cancels an exchange request. It sends a request to the
* [Cancel Exchange Request](https://docs.medusajs.com/v2/api/admin#exchanges_deleteexchangesidrequest)
* API route.
*
* @param id - The exchange's ID.
* @param query - Configure the fields to retrieve in the exchange.
* @param headers - Headers to pass in the request
* @returns The cancelation's details.
*
* @example
* sdk.admin.exchange.cancel("exchange_123")
* .then(({ deleted }) => {
* console.log(deleted)
* })
*/
async cancelRequest(
id: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminExchangeResponse>(
return await this.client.fetch<HttpTypes.AdminExchangeDeleteResponse>(
`/admin/exchanges/${id}/request`,
{
method: "DELETE",

View File

@@ -14,6 +14,53 @@ export class FulfillmentProvider {
this.client = client
}
/**
* This method retrieves a paginated list of fulfillment providers. It sends a request to the
* [List Fulfillment Providers](https://docs.medusajs.com/v2/api/admin#fulfillment-providers_getfulfillmentproviders)
* API route.
*
* @param query - Filters and pagination configurations.
* @param headers - Headers to pass in the request.
* @returns The paginated list of providers.
*
* @example
* To retrieve the list of fulfillment providers:
*
* ```ts
* sdk.admin.fulfillmentProvider.list()
* .then(({ fulfillment_providers, count, limit, offset }) => {
* console.log(fulfillment_providers)
* })
* ```
*
* To configure the pagination, pass the `limit` and `offset` query parameters.
*
* For example, to retrieve only 10 items and skip 10 items:
*
* ```ts
* sdk.admin.fulfillmentProvider.list({
* limit: 10,
* offset: 10
* })
* .then(({ fulfillment_providers, count, limit, offset }) => {
* console.log(fulfillment_providers)
* })
* ```
*
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
* in each fulfillment provider:
*
* ```ts
* sdk.admin.fulfillmentProvider.list({
* fields: "id"
* })
* .then(({ fulfillment_providers, count, limit, offset }) => {
* console.log(fulfillment_providers)
* })
* ```
*
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
*/
async list(
query?: HttpTypes.AdminFulfillmentProviderListParams,
headers?: ClientHeaders

View File

@@ -2,5 +2,8 @@ import { AdminCustomer } from "../../customer/admin"
import { BaseCustomerGroup } from "../common"
export interface AdminCustomerGroup extends BaseCustomerGroup {
/**
* The customers in the group.
*/
customers: AdminCustomer[]
}

View File

@@ -1,9 +1,21 @@
export interface AdminCreateCustomerGroup {
/**
* The customer group's name.
*/
name: string
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown> | null
}
export interface AdminUpdateCustomerGroup {
/**
* The customer group's name.
*/
name?: string
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown> | null
}

View File

@@ -2,34 +2,89 @@ import { BaseFilterable, OperatorMap } from "../../../dal"
import { FindParams, SelectParams } from "../../common"
export interface AdminCustomerInGroupFilters {
/**
* Filter by customer ID(s).
*/
id?: string | string[]
/**
* Filter by email(s).
*/
email?: string | string[] | OperatorMap<string>
/**
* Filter by IDs of default billing addresses to retrieve
* their associated customers.
*/
default_billing_address_id?: string | string[]
/**
* Filter by IDs of default shipping addresses to retrieve
* their associated customers.
*/
default_shipping_address_id?: string | string[]
/**
* Filter by company name(s).
*/
company_name?: string | string[]
/**
* Filter by first name(s).
*/
first_name?: string | string[]
/**
* Filter by last name(s).
*/
last_name?: string | string[]
/**
* Filter by user IDs to retrieve the customers they created.
*/
created_by?: string | string[]
/**
* Apply filters on the customer's creation date.
*/
created_at?: OperatorMap<string>
/**
* Apply filters on the customer's update date.
*/
updated_at?: OperatorMap<string>
/**
* Apply filters on the customer's deletion date.
*/
deleted_at?: OperatorMap<string>
}
export interface AdminGetCustomerGroupsParams
extends FindParams,
BaseFilterable<AdminGetCustomerGroupsParams> {
limit?: number
offset?: number
/**
* Query or keywords to search the customer group's searchable fields.
*/
q?: string
/**
* Filter by customer group ID(s).
*/
id?: string | string[]
/**
* Filter by name(s).
*/
name?: string | string[]
/**
* Filter by customers to retrieve their associated groups.
*/
customers?: string | string[] | AdminCustomerInGroupFilters
/**
* Filter by IDs of users to retrieve the groups they created.
*/
created_by?: string | string[]
/**
* Apply filters on the group's creation date.
*/
created_at?: OperatorMap<string>
/**
* Apply filters on the group's update date.
*/
updated_at?: OperatorMap<string>
/**
* Apply filters on the group's deletion date.
*/
deleted_at?: OperatorMap<string>
$and?: AdminGetCustomerGroupsParams[]
$or?: AdminGetCustomerGroupsParams[]
}
export interface AdminGetCustomerGroupParams extends SelectParams {}

View File

@@ -2,9 +2,15 @@ import { PaginatedResponse } from "../../common"
import { AdminCustomerGroup } from "./entities"
export interface AdminCustomerGroupResponse {
/**
* The customer group's details.
*/
customer_group: AdminCustomerGroup
}
export type AdminCustomerGroupListResponse = PaginatedResponse<{
/**
* The list of customer groups.
*/
customer_groups: AdminCustomerGroup[]
}>

View File

@@ -1,10 +1,28 @@
import { BaseCustomer } from "../customer/common"
export interface BaseCustomerGroup {
/**
* The customer group's ID.
*/
id: string
/**
* The customer group's name.
*/
name: string | null
/**
* The customers in the group.
*/
customers: BaseCustomer[]
/**
* Key-value pairs of custom data.
*/
metadata: Record<string, unknown> | null
/**
* The date the customer group was created.
*/
created_at: string
/**
* The date the customer group was updated.
*/
updated_at: string
}

View File

@@ -2,8 +2,17 @@ import { AdminCustomerGroup } from "../../customer-group"
import { BaseCustomer, BaseCustomerAddress } from "../common"
export interface AdminCustomer extends BaseCustomer {
/**
* Whether the customer is a guest.
*/
has_account: boolean
/**
* The groups the customer is in.
*/
groups?: AdminCustomerGroup[]
/**
* The customer's addresses.
*/
addresses: AdminCustomerAddress[]
}
export interface AdminCustomerAddress extends BaseCustomerAddress {}

View File

@@ -5,7 +5,13 @@ import {
} from "../common"
export interface AdminCustomerFilters extends BaseCustomerFilters {
/**
* Apply customer group filters to retrieve their customers.
*/
groups?: CustomerGroupInCustomerFilters | string[] | string
/**
* Filter by whether the customer is registered.
*/
has_account?: boolean
}
export interface AdminCustomerAddressFilters

View File

@@ -6,10 +6,16 @@ import {
import { AdminCustomer, AdminCustomerAddress } from "./entities"
export interface AdminCustomerResponse {
/**
* The customer's details.
*/
customer: AdminCustomer
}
export type AdminCustomerListResponse = PaginatedResponse<{
/**
* The list of customers.
*/
customers: AdminCustomer[]
}>

View File

@@ -28,7 +28,7 @@ export interface BaseCustomerAddress {
*/
is_default_billing: boolean
/**
* The ID of the customer that the address belongs to.
* The ID of the customer this address belongs to.
*/
customer_id: string
/**
@@ -71,7 +71,7 @@ export interface BaseCustomerAddress {
*/
postal_code: string | null
/**
* The address's phone.
* The address's phone number.
*/
phone: string | null
/**
@@ -148,25 +148,70 @@ export interface BaseCustomer {
}
export interface CustomerGroupInCustomerFilters {
/**
* Filter by customer group ID(s).
*/
id: string[] | string
/**
* Filter by name(s).
*/
name: string[] | string
/**
* Apply filters on the group's creation date.
*/
created_at: OperatorMap<string>
/**
* Apply filters on the group's update date.
*/
updated_at: OperatorMap<string>
/**
* Apply filters on the group's deletion date.
*/
deleted_at: OperatorMap<string>
}
export interface BaseCustomerFilters
extends FindParams,
BaseFilterable<BaseCustomerFilters> {
/**
* Query or keywords to apply on the customer's searchable fields.
*/
q?: string
/**
* Filter by customer ID(s).
*/
id?: string[] | string | OperatorMap<string | string[]>
/**
* Filter by email(s).
*/
email?: string[] | string | OperatorMap<string>
/**
* Filter by company name(s).
*/
company_name?: string[] | string | OperatorMap<string>
/**
* Filter by first name(s).
*/
first_name?: string[] | string | OperatorMap<string>
/**
* Filter by last name(s).
*/
last_name?: string[] | string | OperatorMap<string>
/**
* Filter by user ID(s) to retrieve the customers they created.
*/
created_by?: string[] | string | OperatorMap<string>
/**
* Apply filters on the customer's creation date.
*/
created_at?: OperatorMap<string>
/**
* Apply filters on the customer's update date.
*/
updated_at?: OperatorMap<string>
/**
* Apply filters on the customer's deletion date.
*/
deleted_at?: OperatorMap<string>
}
@@ -216,7 +261,7 @@ export interface BaseCreateCustomer {
*/
last_name?: string
/**
* The customer's phone.
* The customer's phone number.
*/
phone?: string
/**
@@ -239,7 +284,7 @@ export interface BaseUpdateCustomer {
*/
last_name?: string
/**
* The customer's phone.
* The customer's phone number.
*/
phone?: string
/**

View File

@@ -6,41 +6,108 @@ enum ExchangeReason {
}
interface AdminExchangeAddItems {
/**
* The items to add to the exchange.
*/
items: {
/**
* If you're adding an inbound item, this is the ID of the order item returned.
* If you're adding an outbound item, this is the ID of the variant to add.
*/
id: string
/**
* The item's quantity.
*/
quantity: number
/**
* The reason the item is being returned / sent to the customer.
*/
reason?: ExchangeReason
/**
* The item's description.
*/
description?: string
/**
* An internal note viewed by admin users only.
*/
internal_note?: string
}[]
}
interface AdminExchangeUpdateItem {
/**
* The item's quantity.
*/
quantity?: number
/**
* The ID of the associated return reason.
*/
reason_id?: string | null
/**
* The item's description.
*/
description?: string
/**
* An internal note viewed by admin users only.
*/
internal_note?: string | null
}
interface AdminExchangeAddShippingMethod {
/**
* The ID of the shipping option the method is created from.
*/
shipping_option_id: string
/**
* A custom amount for the shipping method. If not specified,
* the shipping option's amount is used.
*/
custom_amount?: number
/**
* The shipping method's description.
*/
description?: string
/**
* An internal note viewed by admin users only.
*/
internal_note?: string
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown> | null
}
interface AdminExchangeUpdateShippingMethod {
/**
* A custom amount for the shipping method.
*/
custom_amount?: number | null
/**
* An internal note viewed by admin users only.
*/
internal_note?: string
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown> | null
}
export interface AdminCreateExchange {
type: "refund" | "replace"
/**
* The ID of the order the exchange is created for.
*/
order_id: string
/**
* The exchange's description.
*/
description?: string
/**
* An internal note viewed by admin users only.
*/
internal_note?: string
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown> | null
}
@@ -63,6 +130,9 @@ export interface AdminExchangeUpdateOutboundShipping
extends AdminExchangeUpdateShippingMethod {}
export interface AdminRequestExchange {
/**
* Whether to send the customer a notification.
*/
no_notification?: boolean
}

View File

@@ -1,15 +1,9 @@
import { BaseFilterable, OperatorMap } from "../../../dal"
import { OperatorMap } from "../../../dal"
import { SelectParams } from "../../common"
import { BaseExchangeListParams } from "../common"
export interface AdminExchangeListParams
extends BaseExchangeListParams,
BaseFilterable<AdminExchangeListParams> {
deleted_at?: OperatorMap<string>
}
export interface AdminExchangeParams extends SelectParams {
export interface AdminExchangeListParams extends SelectParams {
id?: string | string[]
order_id?: string | string[]
status?: string | string[]
created_at?: OperatorMap<string>
updated_at?: OperatorMap<string>

View File

@@ -5,10 +5,16 @@ import { AdminReturn } from "../../return"
import { AdminExchange } from "./entities"
export interface AdminExchangeResponse {
/**
* The exchange's details.
*/
exchange: AdminExchange
}
export type AdminExchangeListResponse = PaginatedResponse<{
/**
* This list of exchanges.
*/
exchanges: AdminExchange[]
}>
@@ -18,17 +24,32 @@ export interface AdminExchangeOrderResponse {
}
export interface AdminExchangePreviewResponse {
/**
* The preview of the order when the exchange is applied.
*/
order_preview: AdminOrderPreview
/**
* The exchange's details.
*/
exchange: AdminExchange
}
export interface AdminExchangeRequestResponse
extends AdminExchangePreviewResponse {
/**
* The return associated with the exchange.
*/
return: AdminReturn
}
export interface AdminExchangeReturnResponse {
/**
* A preview of the order when the exchange is confirmed.
*/
order_preview: AdminOrderPreview
/**
* The return associated with the exchange.
*/
return: AdminReturn
}

View File

@@ -8,45 +8,154 @@ import {
import { AdminReturn, AdminReturnItem } from "../return"
export interface BaseExchangeItem {
/**
* The exchange item's ID.
*/
id: string
/**
* The ID of the exchange this item belongs to.
*/
exchange_id: string
/**
* The ID of the associated order.
*/
order_id: string
/**
* The ID of the order item, which is added
* to the order when the exchange is confirmed.
*/
item_id: string
/**
* The item's quantity.
*/
quantity: number
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown>
/**
* The date the exchange item was created.
*/
created_at: string | null
/**
* The date the exchange item was updated.
*/
updated_at: string | null
}
export interface BaseExchange {
/**
* The exchange's ID.
*/
id: string
/**
* The ID of the order this exchange is created for.
*/
order_id: string
/**
* The ID of the associated return.
*/
return_id?: string
/**
* The exchange's display ID.
*/
display_id?: string
/**
* The version of the order when the exchange is applied.
*/
order_version?: string
/**
* The ID of the user that created the exchange.
*/
created_by?: string
/**
* The date the exchange was created.
*/
created_at: Date | string
/**
* The date the exchange was updated.
*/
updated_at: Date | string
/**
* The date the exchange was canceled.
*/
canceled_at: Date | string
/**
* The date the exchange was deleted.
*/
deleted_at: Date | string
/**
* The exchange's new (outbound) items.
*/
additional_items: BaseExchangeItem[]
/**
* The exchange's returned (inbound) items.
*/
return_items: AdminReturnItem[]
/**
* Whether to notify the customer about changes in the exchange.
*/
no_notification?: boolean
/**
* The exchange's difference amount due, either to the customer or the merchant.
*
* If the value is positive, the customer owes the merchant additional payment of this amount.
* If negative, the merchant owes the customer a refund of this amount.
*/
difference_due?: number
/**
* The associated return.
*/
return?: AdminReturn
/**
* The associated order.
*/
order?: BaseOrder
/**
* Whether out-of-stock variants can be added as new items.
*/
allow_backorder?: boolean
/**
* The shipping methods used to send the outbound items.
*/
shipping_methods?: BaseOrderShippingMethod[]
/**
* The exchange's transactions.
*/
transactions?: BaseOrderTransaction[]
/**
* Key-value pairs of custom data.
*/
metadata?: Record<string, unknown>
}
export interface BaseExchangeListParams extends FindParams {
/**
* Query or keywords to search the exchange's searchable fields.
*/
q?: string
/**
* Filter by exchange ID(s).
*/
id?: string | string[]
/**
* Filter by order IDs to retrieve their exchanges.
*/
order_id?: string | string[]
/**
* Filter by status(es).
*/
status?: string | string[]
/**
* Apply filters on the exchange's creation date.
*/
created_at?: OperatorMap<string>
/**
* Apply filters on the exchange's update date.
*/
updated_at?: OperatorMap<string>
/**
* Apply filters on the exchange's deletion date.
*/
deleted_at?: OperatorMap<string>
}

View File

@@ -1,8 +1,21 @@
import { FindParams } from "../../common"
export interface AdminFulfillmentProviderListParams extends FindParams {
/**
* Filter by provider ID(s).
*/
id?: string | string[]
/**
* Query or keywords to filter the provider's searchable fields.
*/
q?: string
/**
* Filter by whether the provider is enabled.
*/
is_enabled?: boolean
/**
* Filter by stock location ID(s) to retrieve their associated
* fulfillment providers.
*/
stock_location_id?: string | string[]
}

View File

@@ -3,5 +3,8 @@ import { AdminFulfillmentProvider } from "./entities"
export interface AdminFulfillmentProviderListResponse
extends PaginatedResponse<{
/**
* The list of fulfillment providers.
*/
fulfillment_providers: AdminFulfillmentProvider[]
}> {}

View File

@@ -1,4 +1,10 @@
export interface BaseFulfillmentProvider {
/**
* The fulfillment provider's ID.
*/
id: string
/**
* Whether the fulfillment provider is enabled.
*/
is_enabled: boolean
}