// Copyright (c) 2023 Sourcefuse Technologies // // This software is released under the MIT License. // https://opensource.org/licenses/MIT import {Provider, service} from '@loopback/core'; import {VonageSessionWebhookPayload} from '.'; import {VideoChatFeatures} from '../..'; import { ArchiveResponse, ArchiveResponseList, SessionResponse, } from '../../types'; import { VonageAzureTargetOptions, VonageMeetingOptions, VonageMeetingResponse, VonageS3TargetOptions, VonageSessionOptions, VonageVideoChat, } from './types'; import {VonageService} from './vonage.service'; export class VonageProvider implements Provider { constructor( @service(VonageService) private readonly vonageService: VonageService, ) {} value() { return { getMeetingLink: async ( meetingOptions: VonageMeetingOptions, ): Promise => this.vonageService.getMeetingLink(meetingOptions), getToken: async ( sessionId: string, options: VonageSessionOptions, ): Promise => this.vonageService.getToken(sessionId, options), getArchives: async ( archiveId: string | null, ): Promise => this.vonageService.getArchives(archiveId), deleteArchive: async (archiveId: string) => { await this.vonageService.deleteArchive(archiveId); }, setUploadTarget: async ( storageConfig: VonageS3TargetOptions | VonageAzureTargetOptions, ): Promise => { await this.vonageService.setUploadTarget(storageConfig); }, getFeatures: (): VideoChatFeatures => this.vonageService.getFeatures(), checkWebhookPayload: ( webhookPayload: VonageSessionWebhookPayload, ): Promise => this.vonageService.checkWebhookPayload(webhookPayload), }; } }