import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { ObjectId } from 'mongoose'; import { RestClient } from '../../../clients'; import { IS3File } from '../../../models/s3/interfaces/file.interface'; @Injectable() export class StorageService { //#region Private Members private readonly _client: RestClient; //#endregion //#region Constructor constructor(private _configService: ConfigService) { this._client = new RestClient({ name: 'STORAGE_SERVICE', baseUrl: this._configService.get('EH_STORAGE__REST__BASE_URL', ''), timeout: 30000, accessToken: this._configService.get('EH_STORAGE__REST__ACCESS_TOKEN', ''), }); } //#endregion //#region Public APIs public async fetchMeta(fileId: string | ObjectId, bucketName: string) { return await this._client.get(`/bucket/${bucketName}/file/${fileId}/meta`); } //#endregion }