chore(docs): Generated References (automated) (#12154)
Generated the following references: - `api_key` - `auth` - `cart` - `cart_models` - `core_flows` - `currency` - `customer` - `event` - `file_service` - `fulfillment` - `fulfillment_provider` - `inventory_next` - `js_sdk` - `locking` - `medusa` - `modules` - `modules_sdk` - `notification_service` - `order` - `payment` - `payment_provider` - `pricing` - `product` - `promotion` - `region` - `sales_channel` - `stock_location_next` - `store` - `tax` - `types` - `user` - `utils` - `workflows` Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
1790 files changed
+220057
-187216
No files matched your search
+18
-2
@@ -2,10 +2,26 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# batchProducts
|
||||
|
||||
This method manages the products in a sales channel to add or remove them. It sends a request to the
|
||||
[Manage Products in Sales Channel](https://docs.medusajs.com/api/admin#sales-channels\_postsaleschannelsidproducts)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.batchProducts("sc_123", {
|
||||
add: ["prod_123", "prod_456"],
|
||||
remove: ["prod_789"]
|
||||
})
|
||||
.then(({ sales_channel }) => {
|
||||
console.log(sales_channel)
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"[AdminBatchLink](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminBatchLink/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"add","type":"`string`[]","description":"The items to create an association to.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"remove","type":"`string`[]","description":"The items to remove association from.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="batchProducts"/>
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the sales channel to manage the products for.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"[AdminUpdateSalesChannelProducts](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminUpdateSalesChannelProducts/page.mdx)","description":"The details of the products to add or remove from the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"add","type":"`string`[]","description":"The IDs of the products to add to the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"remove","type":"`string`[]","description":"The IDs of the products to remove from the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="batchProducts"/>
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="batchProducts"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The sales channel's details.","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"The sales channel's details.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The sales channel's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The sales channel's name.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"The sales channel's description.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"The sales channel's creation date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"The sales channel's last updated date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"The sales channel's deletion date.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="batchProducts"/>
|
||||
+17
-2
@@ -2,10 +2,25 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# create
|
||||
|
||||
This method creates a new sales channel. It sends a request to the
|
||||
[Create Sales Channel](https://docs.medusajs.com/api/admin#sales-channels\_postsaleschannels)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.create({
|
||||
name: "Storefront",
|
||||
})
|
||||
.then(({ salesChannel }) => {
|
||||
console.log(salesChannel)
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"body","type":"[AdminCreateSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminCreateSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="create"/>
|
||||
<TypeList types={[{"name":"body","type":"[AdminCreateSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminCreateSalesChannel/page.mdx)","description":"The details of the sales channel to create.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"name","type":"`string`","description":"The sales channel's name.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`string`","description":"The sales channel's description.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":true,"defaultValue":"`false`","expandable":false,"children":[]},{"name":"metadata","type":"`Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"Configure the fields and relations to retrieve in the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="create"/>
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="create"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The sales channel's details.","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"The sales channel's details.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The sales channel's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The sales channel's name.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"The sales channel's description.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"The sales channel's creation date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"The sales channel's last updated date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"The sales channel's deletion date.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="create"/>
|
||||
+15
-2
@@ -2,10 +2,23 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# delete
|
||||
|
||||
This method deletes a sales channel. It sends a request to the
|
||||
[Delete Sales Channel](https://docs.medusajs.com/api/admin#sales-channels\_deletesaleschannelsid)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.delete("sc_123")
|
||||
.then(({ deleted }) => {
|
||||
console.log(deleted)
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the sales channel to delete.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelDeleteResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelDeleteResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the item that was deleted.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`\"sales-channel\"`","description":"The type of the item that was deleted.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted","type":"`boolean`","description":"Whether the item was deleted successfully.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelDeleteResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelDeleteResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The deletion's details.","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the item that was deleted.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"object","type":"`\"sales-channel\"`","description":"The type of the item that was deleted.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted","type":"`boolean`","description":"Whether the item was deleted successfully.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
|
||||
+45
-2
@@ -2,10 +2,53 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# list
|
||||
|
||||
This method retrieves a list of sales channels. It sends a request to the
|
||||
[List Sales Channels](https://docs.medusajs.com/api/admin#sales-channels\_getsaleschannels)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve the list of sales channels:
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.list()
|
||||
.then(({ sales_channels, count, limit, offset }) => {
|
||||
console.log(sales_channels)
|
||||
})
|
||||
```
|
||||
|
||||
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.salesChannel.list({
|
||||
limit: 10,
|
||||
offset: 10
|
||||
})
|
||||
.then(({ sales_channels, count, limit, offset }) => {
|
||||
console.log(sales_channels)
|
||||
})
|
||||
```
|
||||
|
||||
Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
||||
in each sales channel:
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.list({
|
||||
fields: "id,*products"
|
||||
})
|
||||
.then(({ sales_channels, count, limit, offset }) => {
|
||||
console.log(sales_channels)
|
||||
})
|
||||
```
|
||||
|
||||
Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"query","type":"[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"$or","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"limit","type":"`number`","description":"The maximum number of items to retrieve.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"offset","type":"`number`","description":"The number of items to skip before retrieving the returned items.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"`string`","description":"The field to sort by and in which order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"id","type":"`string` \\| `string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"q","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string` \\| `string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"location_id","type":"`string` \\| `string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"publishable_key_id","type":"`string` \\| `string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"[OperatorMap](../../../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"[OperatorMap](../../../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"[OperatorMap](../../../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"$or","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelLisLine truncated
|
||||
<TypeList types={[{"name":"query","type":"[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)","description":"Filters and pagination configurations.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"$and","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"$or","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx) \\| [BaseFilterable](../../../../../types/DAL/interfaces/types.DAL.BaseFilterable/page.mdx)<[AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParams/page.mdx)>)[]","description":"An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"limit","type":"`number`","description":"The maximum number of items to retrieve.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"offset","type":"`number`","description":"The number of items to skip before retrieving the returned items.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"`string`","description":"The field to sort by and in which order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"id","type":"`string` \\| `string`[]","description":"Filter by sales channel ID(s).","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"q","type":"`string`","description":"Query or keywords to search the sales channel's searchable fields.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string` \\| `string`[]","description":"Filter by sales channel name.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`string`","description":"Filter by sales channel description.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Filter by whether the sales channel is disabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"location_id","type":"`string` \\| `string`[]","description":"Filter by the ID(s) of the location(s) to retrieve the\nsales channels for.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"publishable_key_id","type":"`string` \\| `string`[]","description":"Filter by the ID(s) of the publishable key(s) to retrieve the\nsales channels for.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"[OperatorMap](../../../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"Filter by the date when the sales channel was created.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"[OperatorMap](../../../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"Filter by the date when the sales channel was updated.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"[OperatorMap](../../../../../types/DAL/types/types.DAL.OperatorMap/page.mdx)<string>","description":"Filter by the date when the sales channel was deleted.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"$or","type":"([AdminSalesChannelListParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelListParaLine truncated
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelListResponse](../../../../../types/HttpTypes/types/types.HttpTypes.AdminSalesChannelListResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"limit","type":"`number`","description":"The maximum number of items retrieved.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"offset","type":"`number`","description":"The number of items to skip before retrieving the returned items.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"count","type":"`number`","description":"The total number of items.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="list"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelListResponse](../../../../../types/HttpTypes/types/types.HttpTypes.AdminSalesChannelListResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The list of sales channels.","expandable":false,"children":[{"name":"limit","type":"`number`","description":"The maximum number of items retrieved.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"offset","type":"`number`","description":"The number of items to skip before retrieving the returned items.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"count","type":"`number`","description":"The total number of items.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="list"/>
|
||||
+30
-2
@@ -2,10 +2,38 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# retrieve
|
||||
|
||||
This method retrieves a sales channel. It sends a request to the
|
||||
[Retrieve Sales Channel](https://docs.medusajs.com/api/admin#sales-channels\_getsaleschannelsid)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a sales channel by its ID:
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.retrieve("sc_123")
|
||||
.then(({ sales_channel }) => {
|
||||
console.log(sales_channel)
|
||||
})
|
||||
```
|
||||
|
||||
To specify the fields and relations to retrieve:
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.retrieve("sc_123", {
|
||||
fields: "id,*products"
|
||||
})
|
||||
.then(({ sales_channel }) => {
|
||||
console.log(sales_channel)
|
||||
})
|
||||
```
|
||||
|
||||
Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieve"/>
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the sales channel to retrieve.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"Configure the fields and relations to retrieve in the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieve"/>
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieve"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The sales channel's details.","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"The sales channel's details.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The sales channel's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The sales channel's name.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"The sales channel's description.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"The sales channel's creation date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"The sales channel's last updated date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"The sales channel's deletion date.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieve"/>
|
||||
+20
-2
@@ -2,10 +2,28 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# update
|
||||
|
||||
This method updates a sales channel. It sends a request to the
|
||||
[Update Sales Channel](https://docs.medusajs.com/api/admin#sales-channels\_postsaleschannelsid)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.update(
|
||||
"sc_123",
|
||||
{
|
||||
name: "Storefront",
|
||||
}
|
||||
)
|
||||
.then(({ salesChannel }) => {
|
||||
console.log(salesChannel)
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"[AdminUpdateSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminUpdateSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"name","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="update"/>
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the sales channel to update.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"[AdminUpdateSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminUpdateSalesChannel/page.mdx)","description":"The details of the sales channel to update.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"name","type":"`string`","description":"The sales channel's name.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"The sales channel's description.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"Configure the fields and relations to retrieve in the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"The fields and relations to retrieve separated by commas.\n\nLearn more in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="update"/>
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="update"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The sales channel's details.","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"The sales channel's details.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The sales channel's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The sales channel's name.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"The sales channel's description.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"The sales channel's creation date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"The sales channel's last updated date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"The sales channel's deletion date.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="update"/>
|
||||
+24
-2
@@ -2,10 +2,32 @@ import { TypeList } from "docs-ui"
|
||||
|
||||
# updateProducts
|
||||
|
||||
This method manages the products in a sales channel to add or remove them. It sends a request to the
|
||||
[Manage Products in Sales Channel](https://docs.medusajs.com/api/admin#sales-channels\_postsaleschannelsidproducts)
|
||||
API route.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
sdk.admin.salesChannel.updateProducts("sc_123", {
|
||||
add: ["prod_123", "prod_456"],
|
||||
remove: ["prod_789"]
|
||||
})
|
||||
.then(({ sales_channel }) => {
|
||||
console.log(sales_channel)
|
||||
})
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"[AdminUpdateSalesChannelProducts](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminUpdateSalesChannelProducts/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"add","type":"`string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"remove","type":"`string`[]","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="updateProducts"/>
|
||||
<TypeList types={[{"name":"id","type":"`string`","description":"The ID of the sales channel to manage the products for.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"[AdminUpdateSalesChannelProducts](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminUpdateSalesChannelProducts/page.mdx)","description":"The details of the products to add or remove from the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"add","type":"`string`[]","description":"The IDs of the products to add to the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"remove","type":"`string`[]","description":"The IDs of the products to remove from the sales channel.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="updateProducts"/>
|
||||
|
||||
## Returns
|
||||
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="updateProducts"/>
|
||||
<TypeList types={[{"name":"Promise","type":"Promise<[AdminSalesChannelResponse](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannelResponse/page.mdx)>","optional":false,"defaultValue":"","description":"The sales channel's details.","expandable":false,"children":[{"name":"sales_channel","type":"[AdminSalesChannel](../../../../../types/HttpTypes/interfaces/types.HttpTypes.AdminSalesChannel/page.mdx)","description":"The sales channel's details.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The sales channel's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"name","type":"`string`","description":"The sales channel's name.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"description","type":"`null` \\| `string`","description":"The sales channel's description.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"is_disabled","type":"`boolean`","description":"Whether the sales channel is disabled.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"metadata","type":"`null` \\| `Record<string, unknown>`","description":"Custom key-value pairs that can be added to the sales channel.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string`","description":"The sales channel's creation date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string`","description":"The sales channel's last updated date.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"deleted_at","type":"`null` \\| `string`","description":"The sales channel's deletion date.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="updateProducts"/>
|
||||
|
||||
:::note[Deprecated]
|
||||
|
||||
Use [batchProducts](../js_sdk.admin.SalesChannel.batchProducts/page.mdx) instead
|
||||
|
||||
:::
|
||||
Reference in new issue
Block a user