-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathGetFileExternalToolResolved.ts
More file actions
34 lines (31 loc) · 1.65 KB
/
Copy pathGetFileExternalToolResolved.ts
File metadata and controls
34 lines (31 loc) · 1.65 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
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { GetExternalToolDTO } from '../dtos/GetExternalToolDTO'
import { FileExternalToolResolved } from '../models/ExternalTool'
import { IExternalToolsRepository } from '../repositories/IExternalToolsRepository'
export class GetFileExternalToolResolved implements UseCase<FileExternalToolResolved> {
private externalToolsRepository: IExternalToolsRepository
constructor(externalToolsRepository: IExternalToolsRepository) {
this.externalToolsRepository = externalToolsRepository
}
/**
* Returns a FileExternalToolResolved object containing the resolved URL for accessing an external tool that operates at the file level.
* The URL includes necessary authentication tokens and parameters based on the user's permissions and the tool's configuration.
* Authentication is required for draft, restricted, embargoed, or expired (retention period) files, the user must have appropriate permissions.
*
* @param {number | string} [fileId] - The File identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers).
* @param {number} toolId - The identifier of the external tool.
* @param {GetExternalToolDTO} getExternalToolDTO - The GetExternalToolDTO object containing additional parameters for the request.
* @returns {Promise<FileExternalToolResolved>}
*/
async execute(
fileId: number | string,
toolId: number,
getExternalToolDTO: GetExternalToolDTO
): Promise<FileExternalToolResolved> {
return await this.externalToolsRepository.getFileExternalToolResolved(
fileId,
toolId,
getExternalToolDTO
)
}
}