-
Notifications
You must be signed in to change notification settings - Fork 1
/
get.ts
37 lines (31 loc) · 1.04 KB
/
get.ts
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
35
36
37
import {
getConferenceIdFromConfig,
getPrintFormat,
initVoiceService,
printFullResponse,
} from '../../config';
import { Voice, VoiceRegion } from '@sinch/sdk-core';
(async () => {
console.log('*********************');
console.log('* GetConferenceInfo *');
console.log('*********************');
const conferenceId = getConferenceIdFromConfig();
const requestData: Voice.GetConferenceInfoRequestData = {
conferenceId,
};
const voiceService = initVoiceService();
voiceService.setRegion(VoiceRegion.EUROPE);
let response;
try {
response = await voiceService.conferences.get(requestData);
} catch (error) {
console.log(`Impossible get information about conference Id '${requestData.conferenceId}'`);
throw error;
}
const printFormat = getPrintFormat(process.argv);
if (printFormat === 'pretty') {
console.log(`The conference contains ${response.participants?.length} participants: ${response.participants?.map((participant) => participant.id).join(',')}`);
} else {
printFullResponse(response);
}
})();