-
Notifications
You must be signed in to change notification settings - Fork 1
/
get.ts
34 lines (27 loc) · 1 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
import { ElasticSipTrunking } from '@sinch/sdk-core';
import {
getPrintFormat,
getSipEndpointIdFromConfig,
getSipTrunkIdFromConfig,
initElasticSipTrunkingService,
printFullResponse,
} from '../../config';
(async () => {
console.log('**********************');
console.log('* getSipEndpointById *');
console.log('**********************');
const sipTrunkId = getSipTrunkIdFromConfig();
const sipEndpointId = getSipEndpointIdFromConfig();
const requestData: ElasticSipTrunking.GetSipEndpointByIdRequestData = {
sipTrunkId,
sipEndpointId,
};
const elasticSipTrunkingService = initElasticSipTrunkingService();
const response = await elasticSipTrunkingService.sipEndpoints.get(requestData);
const printFormat = getPrintFormat(process.argv);
if (printFormat === 'pretty') {
console.log(`The SIP Endpoint with the id '${response.id}' is named '${response.name}' and has been created at '${response.createTime?.toISOString()}'`);
} else {
printFullResponse(response);
}
})();