-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGetFileCitationByFormat.ts
More file actions
22 lines (19 loc) · 969 Bytes
/
GetFileCitationByFormat.ts
File metadata and controls
22 lines (19 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { IFilesRepository } from '../repositories/IFilesRepository'
import { FileCitationFormat } from '../models/FileCitationFormat'
export class GetFileCitationByFormat implements UseCase<string> {
private filesRepository: IFilesRepository
constructor(filesRepository: IFilesRepository) {
this.filesRepository = filesRepository
}
/**
* Returns the File citation in the requested format (EndNote XML, RIS, BibTeX, CSL JSON, or Internal HTML).
*
* @param {number | string} [fileId] - The File identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers).
* @param {FileCitationFormat} [format] - The citation format to return.
* @returns {Promise<string>}
*/
async execute(fileId: number | string, format: FileCitationFormat): Promise<string> {
return await this.filesRepository.getFileCitationByFormat(fileId, format)
}
}