-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGetCollectionItems.ts
More file actions
42 lines (39 loc) · 1.82 KB
/
GetCollectionItems.ts
File metadata and controls
42 lines (39 loc) · 1.82 KB
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
37
38
39
40
41
42
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).
* @param {string} [searchServiceName] - The search service name on which to execute the search (optional).
* @param {boolean} [showTypeCounts] - If true, the response will include the count per object type (optional).
* @returns {Promise<CollectionItemSubset>}
*/
async execute(
collectionId?: string,
limit?: number,
offset?: number,
collectionSearchCriteria?: CollectionSearchCriteria,
searchServiceName?: string,
showTypeCounts = false
): Promise<CollectionItemSubset> {
return await this.collectionsRepository.getCollectionItems(
collectionId,
limit,
offset,
collectionSearchCriteria,
searchServiceName,
showTypeCounts
)
}
}