Skip to main content

Class: ProductCollectionService

Provides layer to manipulate product collections.

Hierarchy

  • "medusa-interfaces"

    ProductCollectionService

Constructors

constructor

new ProductCollectionService(__namedParameters)

Parameters

NameType
__namedParametersObject

Overrides

BaseService.constructor

Defined in

services/product-collection.js:11

Methods

addProducts

addProducts(collectionId, productIds): Promise<any>

Parameters

NameType
collectionIdany
productIdsany

Returns

Promise<any>

Defined in

services/product-collection.js:170


create

create(collection): Promise<ProductCollection>

Creates a product collection

Parameters

NameTypeDescription
collectionanythe collection to create

Returns

Promise<ProductCollection>

created collection

Defined in

services/product-collection.js:104


delete

delete(collectionId): Promise<any>

Deletes a product collection idempotently

Parameters

NameTypeDescription
collectionIdstringid of collection to delete

Returns

Promise<any>

empty promise

Defined in

services/product-collection.js:152


list

list(selector?, config?): Promise<any>

Lists product collections

Parameters

NameTypeDescription
selectoranythe query object for find
configanythe config to be used for find

Returns

Promise<any>

the result of the find operation

Defined in

services/product-collection.js:206


listAndCount

listAndCount(selector?, config?): Promise<any>

Lists product collections and add count.

Parameters

NameTypeDescription
selectoranythe query object for find
configanythe config to be used for find

Returns

Promise<any>

the result of the find operation

Defined in

services/product-collection.js:221


removeProducts

removeProducts(collectionId, productIds): Promise<any>

Parameters

NameType
collectionIdany
productIdsany

Returns

Promise<any>

Defined in

services/product-collection.js:188


retrieve

retrieve(collectionId, config?): Promise<ProductCollection>

Retrieves a product collection by id.

Parameters

NameTypeDescription
collectionIdstringthe id of the collection to retrieve.
configanythe config of the collection to retrieve.

Returns

Promise<ProductCollection>

the collection.

Defined in

services/product-collection.js:55


retrieveByHandle

retrieveByHandle(collectionHandle, config?): Promise<ProductCollection>

Retrieves a product collection by id.

Parameters

NameTypeDescription
collectionHandlestringthe handle of the collection to retrieve.
configanyquery config for request

Returns

Promise<ProductCollection>

the collection.

Defined in

services/product-collection.js:81


update

update(collectionId, update): Promise<ProductCollection>

Updates a product collection

Parameters

NameTypeDescription
collectionIdstringid of collection to update
updateanyupdate object

Returns

Promise<ProductCollection>

update collection

Defined in

services/product-collection.js:125


withTransaction

withTransaction(transactionManager): ProductCollectionService

Parameters

NameType
transactionManagerany

Returns

ProductCollectionService

Defined in

services/product-collection.js:32