From 82f8f9fbdb21cff0139284a94d5f003376799810 Mon Sep 17 00:00:00 2001 From: Antoine Sein Date: Fri, 26 Apr 2024 15:57:38 +0200 Subject: [PATCH] Fix comments --- packages/elastic-sip-trunking/README.md | 34 +++++++++++++--------- packages/elastic-sip-trunking/package.json | 3 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/elastic-sip-trunking/README.md b/packages/elastic-sip-trunking/README.md index 36224e99..28da3020 100644 --- a/packages/elastic-sip-trunking/README.md +++ b/packages/elastic-sip-trunking/README.md @@ -47,16 +47,20 @@ const credentials: UnifiedCredentials = { keySecret: 'KEY_SECRET', }; -// Access the 'fax' service registered on the Sinch Client +// Access the 'elasticSipTrunking' service registered on the Sinch Client const sinch = new SinchClient(credentials); const elasticSipTrunkingService: ElasticSipTrunkingService = sinch.elasticSipTrunking; // Build the request data -const requestData: ElasticSipTrunking.InterfaceTBD = { +const requestData: ElasticSipTrunking.CreateSipTrunkRequestData = { + createSipTrunkRequestBody: { + name: 'Acme Trunk', + hostName: 'acme-domain-1', + } }; -// Access the 'elasticSipTrunking' service registered on the Sinch Client -const result = await sinch.elasticSipTrunking.tag.method(requestData); +// Use the 'elasticSipTrunking' service registered on the Sinch Client +const result = await sinch.elasticSipTrunking.sipTrunks.create(requestData); ``` ### Standalone @@ -82,11 +86,15 @@ const credentials: UnifiedCredentials = { const elasticSipTrunkingService = new ElasticSipTrunkingService(options); // Build the request data -const requestData: ElasticSipTrunking.InterfaceTBD = { +const requestData: ElasticSipTrunking.CreateSipTrunkRequestData = { + createSipTrunkRequestBody: { + name: 'Acme Trunk', + hostName: 'acme-domain-1', + } }; // Use the standalone declaration of the 'elasticSipTrunking' service -const result = await elasticSipTrunkingService.tag.method(requestData); +const result = await elasticSipTrunkingService.sipTrunks.create(requestData); ``` ## Promises @@ -95,18 +103,18 @@ All the methods that interact with the Sinch APIs use Promises. You can use `awa ```typescript // Method 1: Wait for the Promise to complete -let result: ElasticSipTrunking.ResultInterfaceTBD; +let result: ElasticSipTrunking.SipTrunk; try { - result = await elasticSipTrunkingService.tag.method(requestData); - console.log(``); + result = await elasticSipTrunkingService.sipTrunks.create(requestData); + console.log(`SIP trunk successfully created at '${response.createTime.toISOString()}' with the id '${response.id}'`); } catch (error: any) { - console.error(`ERROR ${error.statusCode}: `); + console.error(`ERROR ${error.statusCode}: Impossible to create a SIP Trunk with the hostname '${requestData.hostName}'`); } // Method 2: Resolve the promise -elasticSipTrunkingService.tag.method(requestData) - .then(response => console.log(``)) - .catch(error => console.error(`ERROR ${error.statusCode}: `)); +elasticSipTrunkingService.sipTrunks.create(requestData) + .then(response => console.log(`SIP trunk successfully created at '${response.createTime.toISOString()}' with the id '${response.id}'`)) + .catch(error => console.error(`ERROR ${error.statusCode}: Impossible to create a SIP Trunk with the hostname '${requestData.hostName}'`)); ``` ## Contact diff --git a/packages/elastic-sip-trunking/package.json b/packages/elastic-sip-trunking/package.json index 3e4b71a1..37f893b1 100644 --- a/packages/elastic-sip-trunking/package.json +++ b/packages/elastic-sip-trunking/package.json @@ -4,8 +4,7 @@ "description": "Sinch Elastic SIP Trunking API", "homepage": "", "repository": { - "type": "git", - "url": "" + "type": "git" }, "license": "Apache-2.0", "author": "Sinch",