-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGetDatasetVersions.ts
More file actions
30 lines (27 loc) · 1.4 KB
/
GetDatasetVersions.ts
File metadata and controls
30 lines (27 loc) · 1.4 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
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { DatasetVersionSubset } from '../models/DatasetVersion'
import { IDatasetsRepository } from '../repositories/IDatasetsRepository'
export class GetDatasetVersions implements UseCase<DatasetVersionSubset> {
private datasetsRepository: IDatasetsRepository
constructor(datasetsRepository: IDatasetsRepository) {
this.datasetsRepository = datasetsRepository
}
/**
* Returns a list of versions for a given dataset including (optionally) metadata blocks and files.
* Draft versions will only be available to users who have permission to view unpublished drafts.
*
* @param {number | string} [datasetId] - The dataset identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers).
* @param {number} [limit] - Limit for pagination (optional).
* @param {number} [offset] - Offset for pagination (optional).
* @param {boolean} [excludeMetadataBlocks] - Exclude metadata blocks (optional, default: false).
* @returns {Promise<DatasetVersionSubset>} - A DatasetVersionSubset containing the versions and total count.
*/
async execute(
datasetId: number | string,
limit?: number,
offset?: number,
excludeMetadataBlocks?: boolean
): Promise<DatasetVersionSubset> {
return await this.datasetsRepository.getDatasetVersions(datasetId, limit, offset, excludeMetadataBlocks)
}
}