forked from IQSS/dataverse-client-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetMetadataBlockByName.ts
More file actions
21 lines (18 loc) · 830 Bytes
/
Copy pathGetMetadataBlockByName.ts
File metadata and controls
21 lines (18 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { IMetadataBlocksRepository } from '../repositories/IMetadataBlocksRepository'
import { MetadataBlock } from '../models/MetadataBlock'
export class GetMetadataBlockByName implements UseCase<MetadataBlock> {
private metadataBlocksRepository: IMetadataBlocksRepository
constructor(metadataBlocksRepository: IMetadataBlocksRepository) {
this.metadataBlocksRepository = metadataBlocksRepository
}
/**
* Returns a MetadataBlock instance, given its name.
*
* @param {string} [metadataBlockName] - The requested metadata block name.
* @returns {Promise<MetadataBlock>}
*/
async execute(metadataBlockName: string): Promise<MetadataBlock> {
return await this.metadataBlocksRepository.getMetadataBlockByName(metadataBlockName)
}
}