-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGetDatasetCitationInOtherFormats.ts
More file actions
36 lines (33 loc) · 1.7 KB
/
GetDatasetCitationInOtherFormats.ts
File metadata and controls
36 lines (33 loc) · 1.7 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
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { IDatasetsRepository } from '../repositories/IDatasetsRepository'
import { DatasetNotNumberedVersion } from '../models/DatasetNotNumberedVersion'
import { FormattedCitation } from '../models/FormattedCitation'
import { CitationFormat } from '../models/CitationFormat'
export class GetDatasetCitationInOtherFormats implements UseCase<FormattedCitation> {
private datasetsRepository: IDatasetsRepository
constructor(datasetsRepository: IDatasetsRepository) {
this.datasetsRepository = datasetsRepository
}
/**
* Returns the dataset citation in the specified format.
*
* @param {number | string} datasetId - The dataset identifier.
* @param {string | DatasetNotNumberedVersion} [datasetVersionId=DatasetNotNumberedVersion.LATEST] - The dataset version identifier, which can be a version-specific string (e.g., '1.0') or a DatasetNotNumberedVersion enum value. Defaults to LATEST.
* @param {CitationFormat} format - The citation format to return. One of: 'EndNote', 'RIS', 'BibTeX', 'CSLJson', 'Internal'.
* @param {boolean} [includeDeaccessioned=false] - Whether to include deaccessioned versions in the search. Defaults to false.
* @returns {Promise<FormattedCitation>} The citation content, format, and content type.
*/
async execute(
datasetId: number | string,
datasetVersionId: string | DatasetNotNumberedVersion = DatasetNotNumberedVersion.LATEST,
format: CitationFormat,
includeDeaccessioned = false
): Promise<FormattedCitation> {
return await this.datasetsRepository.getDatasetCitationInOtherFormats(
datasetId,
datasetVersionId,
format,
includeDeaccessioned
)
}
}