Files
medusa-store/www/apps/docs/content/references/js-client/classes/AdminCollectionsResource.mdx
github-actions[bot] cdd42dbdcd chore(docs): Generated References (#5743)
Generated the following references:
- `entities`
- `inventory`
- `js-client`
- `pricing`
- `product`
- `services`
- `stock-location`
- `workflows`

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2023-11-27 18:58:52 +00:00

1286 lines
39 KiB
Plaintext

---
displayed_sidebar: jsClientSidebar
slug: /references/js-client/AdminCollectionsResource
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# AdminCollectionsResource
This class is used to send requests to [Admin Product Collection API Routes](https://docs.medusajs.com/api/admin#product-collections). All its method
are available in the JS Client under the `medusa.admin.collections` property.
All methods in this class require [user authentication](AdminAuthResource.mdx#createsession).
A product collection is used to organize products for different purposes such as marketing or discount purposes. For example, you can create a Summer Collection.
## Methods
#### addProducts
Add products to collection.
##### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.addProducts(collectionId, {
product_ids: [productId1, productId2],
})
.then(({ collection }) => {
console.log(collection.products)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "payload",
"type": "[AdminPostProductsToCollectionReq](../internal/classes/internal.AdminPostProductsToCollectionReq.mdx)",
"description": "The products to add.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "product_ids",
"type": "`string`[]",
"description": "An array of Product IDs to add to the Product Collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[AdminCollectionsRes](../internal/types/internal.AdminCollectionsRes.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the product collection's details.",
"expandable": false,
"children": [
{
"name": "AdminCollectionsRes",
"type": "`object`",
"description": "The collection's details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "collection",
"type": "[ProductCollection](../internal/classes/internal.ProductCollection.mdx)",
"description": "Product Collection details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "A unique string that identifies the Product Collection - can for example be used in slug structures.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product collection's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[Product](../internal/classes/internal.Product.mdx)[]",
"description": "The details of the products that belong to this product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title that the Product Collection is identified by.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />
___
#### create
Create a product collection.
##### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.create({
title: "New Collection",
})
.then(({ collection }) => {
console.log(collection.id)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "payload",
"type": "[AdminPostCollectionsReq](../internal/classes/internal.AdminPostCollectionsReq.mdx)",
"description": "The data of the product collection to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "handle",
"type": "`string`",
"description": "An optional handle to be used in slugs. If none is provided, the kebab-case version of the title will be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional set of key-value pairs to hold additional information.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[AdminCollectionsRes](../internal/types/internal.AdminCollectionsRes.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the created product collection's details.",
"expandable": false,
"children": [
{
"name": "AdminCollectionsRes",
"type": "`object`",
"description": "The collection's details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "collection",
"type": "[ProductCollection](../internal/classes/internal.ProductCollection.mdx)",
"description": "Product Collection details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "A unique string that identifies the Product Collection - can for example be used in slug structures.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product collection's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[Product](../internal/classes/internal.Product.mdx)[]",
"description": "The details of the products that belong to this product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title that the Product Collection is identified by.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />
___
#### delete
Delete a product collection. This does not delete associated products.
##### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.delete(collectionId)
.then(({ id, object, deleted }) => {
console.log(id)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[DeleteResponse](../internal/interfaces/internal.DeleteResponse.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the deletion operation details.",
"expandable": false,
"children": [
{
"name": "deleted",
"type": "`boolean`",
"description": "Whether the item was deleted successfully.",
"optional": false,
"defaultValue": "true",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the deleted item.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "object",
"type": "`string`",
"description": "The type of the deleted item.",
"optional": false,
"defaultValue": "product-collection",
"expandable": false,
"children": []
}
]
}
]} />
___
#### list
Retrieve a list of product collections. The product collections can be filtered by fields such as `handle` or `title`. The collections can also be sorted or paginated.
##### Example
To list product collections:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.list()
.then(({ collections, limit, offset, count }) => {
console.log(collections.length)
})
```
By default, only the first `10` records are retrieved. You can control pagination by specifying the `limit` and `offset` properties:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.list({
limit,
offset,
})
.then(({ collections, limit, offset, count }) => {
console.log(collections.length)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "query",
"type": "[AdminGetCollectionsParams](../internal/classes/internal.AdminGetCollectionsParams.mdx)",
"description": "Filters and pagination configurations to apply on the retrieved product collections.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "[DateComparisonOperator](../internal/classes/internal.DateComparisonOperator.mdx)",
"description": "Date filters to apply on the product collections' `created_at` date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "gt",
"type": "`Date`",
"description": "The filtered date must be greater than this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gte",
"type": "`Date`",
"description": "The filtered date must be greater than or equal to this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lt",
"type": "`Date`",
"description": "The filtered date must be less than this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lte",
"type": "`Date`",
"description": "The filtered date must be less than or equal to this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "deleted_at",
"type": "[DateComparisonOperator](../internal/classes/internal.DateComparisonOperator.mdx)",
"description": "Date filters to apply on the product collections' `deleted_at` date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "gt",
"type": "`Date`",
"description": "The filtered date must be greater than this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gte",
"type": "`Date`",
"description": "The filtered date must be greater than or equal to this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lt",
"type": "`Date`",
"description": "The filtered date must be less than this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lte",
"type": "`Date`",
"description": "The filtered date must be less than or equal to this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "discount_condition_id",
"type": "`string`",
"description": "Filter product collections by their associated discount condition's ID.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "Handle to filter product collections by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "Limit the number of items returned in the list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "The number of items to skip when retrieving a list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "q",
"type": "`string`",
"description": "Term to search product collections by their title and handle.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "Title to filter product collections by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "[DateComparisonOperator](../internal/classes/internal.DateComparisonOperator.mdx)",
"description": "Date filters to apply on the product collections' `updated_at` date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "gt",
"type": "`Date`",
"description": "The filtered date must be greater than this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "gte",
"type": "`Date`",
"description": "The filtered date must be greater than or equal to this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lt",
"type": "`Date`",
"description": "The filtered date must be less than this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "lte",
"type": "`Date`",
"description": "The filtered date must be less than or equal to this value.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[AdminCollectionsListRes](../internal/types/internal.AdminCollectionsListRes.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the list of product collections with pagination fields.",
"expandable": false,
"children": [
{
"name": "AdminCollectionsListRes",
"type": "[PaginatedResponse](../internal/interfaces/internal.PaginatedResponse.mdx) & ``{ collections: [ProductCollection](../internal/classes/internal.ProductCollection.mdx)[] }``",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "count",
"type": "`number`",
"description": "The total number of items available.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "The maximum number of items that can be returned in the list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "The number of items skipped before the returned items in the list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "collections",
"type": "[ProductCollection](../internal/classes/internal.ProductCollection.mdx)[]",
"description": "an array of collection details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "A unique string that identifies the Product Collection - can for example be used in slug structures.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product collection's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[Product](../internal/classes/internal.Product.mdx)[]",
"description": "The details of the products that belong to this product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title that the Product Collection is identified by.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />
___
#### removeProducts
Remove a list of products from a collection. This would not delete the product, only the association between the product and the collection.
##### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.removeProducts(collectionId, {
product_ids: [productId1, productId2],
})
.then(({ id, object, removed_products }) => {
console.log(removed_products)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "the ID of the product collection",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "payload",
"type": "[AdminDeleteProductsFromCollectionReq](../internal/classes/internal.AdminDeleteProductsFromCollectionReq.mdx)",
"description": "The products to remove from the collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "product_ids",
"type": "`string`[]",
"description": "An array of Product IDs to remove from the Product Collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[AdminDeleteProductsFromCollectionRes](../internal/types/internal.AdminDeleteProductsFromCollectionRes.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the deletion operation details.",
"expandable": false,
"children": [
{
"name": "AdminDeleteProductsFromCollectionRes",
"type": "`object`",
"description": "Deletion operation details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of the collection",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "object",
"type": "`string`",
"description": "The type of object the removal was executed on",
"optional": false,
"defaultValue": "product-collection",
"expandable": false,
"children": []
},
{
"name": "removed_products",
"type": "`string`[]",
"description": "The IDs of the products removed from the collection",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />
___
#### retrieve
Retrieve a product collection by its ID. The products associated with it are expanded and returned as well.
##### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections.retrieve(collectionId).then(({ collection }) => {
console.log(collection.id)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[AdminCollectionsRes](../internal/types/internal.AdminCollectionsRes.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the product collection's details.",
"expandable": false,
"children": [
{
"name": "AdminCollectionsRes",
"type": "`object`",
"description": "The collection's details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "collection",
"type": "[ProductCollection](../internal/classes/internal.ProductCollection.mdx)",
"description": "Product Collection details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "A unique string that identifies the Product Collection - can for example be used in slug structures.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product collection's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[Product](../internal/classes/internal.Product.mdx)[]",
"description": "The details of the products that belong to this product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title that the Product Collection is identified by.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />
___
#### update
Update a product collection's details.
##### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.collections
.update(collectionId, {
title: "New Collection",
})
.then(({ collection }) => {
console.log(collection.id)
})
```
##### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "payload",
"type": "[AdminPostCollectionsCollectionReq](../internal/classes/internal.AdminPostCollectionsCollectionReq.mdx)",
"description": "The data to update in the product collection.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "handle",
"type": "`string`",
"description": "An optional handle to be used in slugs. If none is provided, the kebab-case version of the title will be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional set of key-value pairs to hold additional information.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the collection.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "customHeaders",
"type": "`Record<string, any>`",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
##### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[ResponsePromise](../internal/types/internal.ResponsePromise.mdx)&#60;[AdminCollectionsRes](../internal/types/internal.AdminCollectionsRes.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves to the product collection's details.",
"expandable": false,
"children": [
{
"name": "AdminCollectionsRes",
"type": "`object`",
"description": "The collection's details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "collection",
"type": "[ProductCollection](../internal/classes/internal.ProductCollection.mdx)",
"description": "Product Collection details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "`null` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "handle",
"type": "`string`",
"description": "A unique string that identifies the Product Collection - can for example be used in slug structures.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product collection's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "`Record<string, unknown>`",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "products",
"type": "[Product](../internal/classes/internal.Product.mdx)[]",
"description": "The details of the products that belong to this product collection.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title that the Product Collection is identified by.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />