forked from uncch-rdmc/dataverse-client-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetFileCitation.ts
31 lines (28 loc) · 1.41 KB
/
GetFileCitation.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
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { IFilesRepository } from '../repositories/IFilesRepository'
import { DatasetNotNumberedVersion } from '../../../datasets'
export class GetFileCitation implements UseCase<string> {
private filesRepository: IFilesRepository
constructor(filesRepository: IFilesRepository) {
this.filesRepository = filesRepository
}
/**
* Returns the File citation text.
*
* @param {number | string} [fileId] - The File identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers).
* @param {string | DatasetNotNumberedVersion} [datasetVersionId=DatasetNotNumberedVersion.LATEST] - The dataset version identifier, which can be a version-specific numeric string (for example, 1.0) or a DatasetNotNumberedVersion enum value. If this parameter is not set, the default value is: DatasetNotNumberedVersion.LATEST
* @param {boolean} [includeDeaccessioned=false] - Indicates whether to consider deaccessioned versions in the dataset search or not. The default value is false
* @returns {Promise<string>}
*/
async execute(
fileId: number,
datasetVersionId: string | DatasetNotNumberedVersion = DatasetNotNumberedVersion.LATEST,
includeDeaccessioned = false
): Promise<string> {
return await this.filesRepository.getFileCitation(
fileId,
datasetVersionId,
includeDeaccessioned
)
}
}