-
Notifications
You must be signed in to change notification settings - Fork 8
/
GetCollectionItems.ts
36 lines (33 loc) · 1.5 KB
/
GetCollectionItems.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { CollectionSearchCriteria } from '../../../collections'
import { CollectionItemSubset } from '../models/CollectionItemSubset'
import { ICollectionsRepository } from '../repositories/ICollectionsRepository'
export class GetCollectionItems implements UseCase<CollectionItemSubset> {
private collectionsRepository: ICollectionsRepository
constructor(collectionsRepository: ICollectionsRepository) {
this.collectionsRepository = collectionsRepository
}
/**
* Returns an instance of CollectionItemSubset that contains reduced information for each item that the calling user can access in the installation.
* If the collectionId parameter is not set, the use case will return items starting from the root collection.
*
* @param {string} [collectionId] - Collection id (optional).
* @param {number} [limit] - Limit for pagination (optional).
* @param {number} [offset] - Offset for pagination (optional).
* @param {CollectionSearchCriteria} [collectionSearchCriteria] - Supports filtering the collection items by different properties (optional).
* @returns {Promise<CollectionItemSubset>}
*/
async execute(
collectionId?: string,
limit?: number,
offset?: number,
collectionSearchCriteria?: CollectionSearchCriteria
): Promise<CollectionItemSubset> {
return await this.collectionsRepository.getCollectionItems(
collectionId,
limit,
offset,
collectionSearchCriteria
)
}
}