ProductCollectionService
Provides layer to manipulate product collections.
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "product-collection.created"
Events.UPDATED
stringRequiredDefault: "product-collection.updated"
Events.DELETED
stringRequiredDefault: "product-collection.deleted"
Events.PRODUCTS_ADDED
stringRequiredDefault: "product-collection.products_added"
Events.PRODUCTS_REMOVED
stringRequiredDefault: "product-collection.products_removed"
__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<TResult>Requiredthe result of the transactional work
retrieve
Retrieves a product collection by id.
Parameters
collectionId
stringRequiredthe id of the collection to retrieve.
the config of the collection to retrieve.
Default: {}
Returns
the collection.
retrieveByHandle
Retrieves a product collection by id.
Parameters
collectionHandle
stringRequiredthe handle of the collection to retrieve.
query config for request
Default: {}
Returns
the collection.
create
Creates a product collection
Parameters
collection
CreateProductCollectionRequiredthe collection to create
Returns
created collection
update
Updates a product collection
Parameters
collectionId
stringRequiredid of collection to update
update
UpdateProductCollectionRequiredupdate object
Returns
update collection
delete
Deletes a product collection idempotently
Parameters
collectionId
stringRequiredid of collection to delete
Returns
Promise
Promise<void>Requiredempty promise
addProducts
Parameters
collectionId
stringRequiredproductIds
string[]RequiredReturns
removeProducts
Parameters
collectionId
stringRequiredproductIds
string[]RequiredReturns
Promise
Promise<void>Requiredlist
Lists product collections
Parameters
the query object for find
Default: {}
config
objectRequiredthe config to be used for find
config.skip
numberRequiredDefault: 0
config.take
numberRequiredDefault: 20
Returns
the result of the find operation
listAndCount
Lists product collections and add count.
Parameters
selector
ListAndCountSelectorRequiredthe query object for find
Default: {}
the config to be used for find
Returns
the result of the find operation
Was this section helpful?