@fonoster/sdk 0.6.4 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +519 -454
  2. package/dist/node/Acls.d.ts +43 -44
  3. package/dist/node/Acls.js +62 -49
  4. package/dist/node/Agents.d.ts +44 -45
  5. package/dist/node/Agents.js +47 -46
  6. package/dist/node/ApiKeys.d.ts +29 -29
  7. package/dist/node/ApiKeys.js +29 -29
  8. package/dist/node/Applications.d.ts +39 -39
  9. package/dist/node/Applications.js +52 -40
  10. package/dist/node/Calls.d.ts +28 -29
  11. package/dist/node/Calls.js +32 -27
  12. package/dist/node/Credentials.d.ts +39 -39
  13. package/dist/node/Credentials.js +39 -39
  14. package/dist/node/Domains.d.ts +37 -37
  15. package/dist/node/Domains.js +37 -37
  16. package/dist/node/Numbers.d.ts +40 -40
  17. package/dist/node/Numbers.js +40 -40
  18. package/dist/node/Secrets.d.ts +37 -37
  19. package/dist/node/Secrets.js +37 -37
  20. package/dist/node/Trunks.d.ts +58 -52
  21. package/dist/node/Trunks.js +104 -70
  22. package/dist/node/Users.d.ts +34 -34
  23. package/dist/node/Users.js +34 -34
  24. package/dist/node/Workspaces.d.ts +55 -54
  25. package/dist/node/Workspaces.js +61 -54
  26. package/dist/node/client/jsonToObject.js +1 -1
  27. package/dist/node/client/makeRpcRequest.js +1 -1
  28. package/dist/node/client/objectToJson.d.ts +1 -1
  29. package/dist/node/client/objectToJson.js +12 -2
  30. package/dist/node/client/types/IdentityClient.d.ts +2 -2
  31. package/dist/node/client/utils.js +6 -3
  32. package/dist/node/generated/node/agents_grpc_pb.js +0 -2
  33. package/dist/node/generated/node/agents_pb.js +444 -24
  34. package/dist/node/generated/node/applications_pb.js +6 -6
  35. package/dist/node/generated/node/credentials_pb.js +11 -41
  36. package/dist/node/generated/node/domains_pb.js +30 -30
  37. package/dist/node/generated/node/identity_grpc_pb.js +14 -14
  38. package/dist/node/generated/node/identity_pb.js +37 -37
  39. package/dist/node/generated/node/numbers_grpc_pb.js +0 -1
  40. package/dist/node/generated/node/numbers_pb.js +191 -11
  41. package/dist/node/generated/node/trunks_grpc_pb.js +0 -2
  42. package/dist/node/generated/node/trunks_pb.js +526 -31
  43. package/dist/node/generated/web/IdentityServiceClientPb.ts +5 -5
  44. package/dist/node/generated/web/agents_pb.d.ts +62 -10
  45. package/dist/node/generated/web/agents_pb.js +444 -24
  46. package/dist/node/generated/web/applications_pb.js +6 -6
  47. package/dist/node/generated/web/credentials_pb.d.ts +0 -4
  48. package/dist/node/generated/web/credentials_pb.js +11 -41
  49. package/dist/node/generated/web/domains_pb.js +30 -30
  50. package/dist/node/generated/web/identity_pb.d.ts +13 -13
  51. package/dist/node/generated/web/identity_pb.js +37 -37
  52. package/dist/node/generated/web/numbers_pb.d.ts +26 -4
  53. package/dist/node/generated/web/numbers_pb.js +191 -11
  54. package/dist/node/generated/web/trunks_pb.d.ts +71 -11
  55. package/dist/node/generated/web/trunks_pb.js +526 -31
  56. package/dist/node/tsconfig.node.tsbuildinfo +1 -1
  57. package/dist/node/utils.d.ts +4 -3
  58. package/dist/node/utils.js +36 -0
  59. package/dist/web/fonoster.min.js +1 -1
  60. package/dist/web/index.esm.js +1 -1
  61. package/package.json +5 -4
package/README.md CHANGED
@@ -63,9 +63,9 @@ In Node.js:
63
63
 
64
64
  ```typescript
65
65
  const SDK = require("@fonoster/sdk");
66
- const accessKeyId = "WO00000000000000000000000000000000";
67
- const endpoint = "https://api.fonoster.io";
68
- const client = new SDK.Client({ accessKeyId, endpoint });
66
+ const ACCESS_KEY_ID = "WO00000000000000000000000000000000";
67
+ const ENDPOINT = "api.fonoster.io";
68
+ const client = new SDK.Client({ accessKeyId: ACCESS_KEY_ID, endpoint: ENDPOINT });
69
69
  ```
70
70
 
71
71
  When connecting to Fonoster's cloud services, you can omit the `endpoint` parameter.
@@ -74,9 +74,9 @@ In the browser:
74
74
 
75
75
  ```typescript
76
76
  const SDK = require("@fonoster/sdk");
77
- const accessKeyId = "WO00000000000000000000000000000000";
78
- const url = "https://api.fonoster.io/v1beta2";
79
- const client = new SDK.WebClient({ accessKeyId, url });
77
+ const ACCESS_KEY_ID = "WO00000000000000000000000000000000";
78
+ const URL = "https://api.fonoster.io/v1beta2";
79
+ const client = new SDK.WebClient({ accessKeyId: ACCESS_KEY_ID, url: URL });
80
80
  ```
81
81
 
82
82
  When connecting to Fonoster's cloud services, you can omit the `url` parameter.
@@ -157,12 +157,12 @@ Constructs a new Acls object.
157
157
  const SDK = require("@fonoster/sdk");
158
158
 
159
159
  async function main(request) {
160
- const apiKey = "your-api-key";
161
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
160
+ const API_KEY = "your-api-key";
161
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
162
162
 
163
- try {
164
- const client = SDK.Client({ accessKeyId });
165
- await client.loginWithApiKey(apiKey);
163
+ try {
164
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
165
+ await client.loginWithApiKey(API_KEY);
166
166
 
167
167
  const acls = new SDK.Acls(client);
168
168
  const response = await acls.createAcl(request);
@@ -198,17 +198,18 @@ Creates a new Acl in the Workspace.
198
198
 
199
199
  **Example**
200
200
  ```js
201
+ const acls = new SDK.Acls(client); // Existing client object
202
+
201
203
  const request = {
202
- name: "My ACL",
203
- allow: ["47.132.130.31"], // Allow only this IP
204
- deny: ["0.0.0.0/0"] // Deny all other IPs
204
+ name: "My ACL",
205
+ allow: ["47.132.130.31"], // Allow only this IP
206
+ deny: ["0.0.0.0/0"] // Deny all other IPs
205
207
  };
206
208
 
207
- const acls = new SDK.Acls(client); // Existing client object
208
-
209
- acls.createAcl(request)
210
- .then(console.log) // successful response
211
- .catch(console.error); // an error occurred
209
+ acls
210
+ .createAcl(request)
211
+ .then(console.log) // successful response
212
+ .catch(console.error); // an error occurred
212
213
  ```
213
214
  <a name="Acls+getAcl"></a>
214
215
 
@@ -224,13 +225,14 @@ Retrieves an existing Acl in the Workspace.
224
225
 
225
226
  **Example**
226
227
  ```js
227
- const ref = "00000000-0000-0000-0000-000000000000"
228
-
229
228
  const acls = new SDK.Acls(client); // Existing client object
230
229
 
231
- acls.getAcl(ref)
232
- .then(console.log) // successful response
233
- .catch(console.error); // an error occurred
230
+ const ref = "00000000-0000-0000-0000-000000000000";
231
+
232
+ acls
233
+ .getAcl(ref)
234
+ .then(console.log) // successful response
235
+ .catch(console.error); // an error occurred
234
236
  ```
235
237
  <a name="Acls+updateAcl"></a>
236
238
 
@@ -250,18 +252,19 @@ Updates an existing Acl in the Workspace.
250
252
 
251
253
  **Example**
252
254
  ```js
255
+ const acls = new SDK.Acls(client); // Existing client object
256
+
253
257
  const request = {
254
- ref: "00000000-0000-0000-0000-000000000000",
255
- name: "My ACL",
256
- allow: ["47.132.130.31"] // Allow only this IP
257
- deny: ["0.0.0.0/0"] // Deny all other IPs
258
+ ref: "00000000-0000-0000-0000-000000000000",
259
+ name: "My ACL",
260
+ allow: ["47.132.130.31"] // Allow only this IP
261
+ deny: ["0.0.0.0/0"] // Deny all other IPs
258
262
  };
259
263
 
260
- const acls = new SDK.Acls(client); // Existing client object
261
-
262
- acl.updateAcl(request)
263
- .then(console.log) // successful response
264
- .catch(console.error); // an error occurred
264
+ acls
265
+ .updateAcl(request)
266
+ .then(console.log) // successful response
267
+ .catch(console.error); // an error occurred
265
268
  ```
266
269
  <a name="Acls+listAcls"></a>
267
270
 
@@ -279,16 +282,17 @@ Retrieves a list of Acls from a Workspace.
279
282
 
280
283
  **Example**
281
284
  ```js
285
+ const acls = new SDK.Acls(client); // Existing client object
286
+
282
287
  const request = {
283
- pageSize: 10,
284
- pageToken: "00000000-0000-0000-0000-000000000000"
288
+ pageSize: 10,
289
+ pageToken: "00000000-0000-0000-0000-000000000000"
285
290
  };
286
291
 
287
- const acls = new SDK.Acls(client); // Existing client object
288
-
289
- acls.listAcls(request)
290
- .then(console.log) // successful response
291
- .catch(console.error); // an error occurred
292
+ acls
293
+ .listAcls(request)
294
+ .then(console.log) // successful response
295
+ .catch(console.error); // an error occurred
292
296
  ```
293
297
  <a name="Acls+deleteAcl"></a>
294
298
 
@@ -305,13 +309,14 @@ Note that this operation is irreversible.
305
309
 
306
310
  **Example**
307
311
  ```js
308
- const ref = "00000000-0000-0000-0000-000000000000"
309
-
310
312
  const acls = new SDK.Acls(client); // Existing client object
311
313
 
312
- acls.deleteAcl(ref)
313
- .then(console.log) // successful response
314
- .catch(console.error); // an error occurred
314
+ const ref = "00000000-0000-0000-0000-000000000000";
315
+
316
+ acls
317
+ .deleteAcl(ref)
318
+ .then(console.log) // successful response
319
+ .catch(console.error); // an error occurred
315
320
  ```
316
321
 
317
322
  <a name="Agents"></a>
@@ -351,12 +356,12 @@ Constructs a new Agents object.
351
356
  const SDK = require("@fonoster/sdk");
352
357
 
353
358
  async function main(request) {
354
- const apiKey = "your-api-key";
355
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
359
+ const API_KEY = "your-api-key";
360
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
356
361
 
357
- try {
358
- const client = SDK.Client({ accessKeyId });
359
- await client.loginWithApiKey(apiKey);
362
+ try {
363
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
364
+ await client.loginWithApiKey(API_KEY);
360
365
 
361
366
  const agents = new SDK.Agents(client);
362
367
  const response = await agents.createAgent(request);
@@ -398,20 +403,21 @@ Creates a new Agent in the Workspace.
398
403
 
399
404
  **Example**
400
405
  ```js
406
+ const agents = new SDK.Agents(client); // Existing client object
407
+
401
408
  const request = {
402
- name: "John Doe",
403
- username: "1001",
404
- privacy: "PRIVATE",
405
- enabled: true,
406
- maxContacts: 3
407
- domainRef: "00000000-0000-0000-0000-000000000000"
409
+ name: "John Doe",
410
+ username: "1001",
411
+ privacy: "PRIVATE",
412
+ enabled: true,
413
+ maxContacts: 3
414
+ domainRef: "00000000-0000-0000-0000-000000000000"
408
415
  };
409
416
 
410
- const agents = new SDK.Agents(client); // Existing client object
411
-
412
- agents.createAgent(request)
413
- .then(console.log) // successful response
414
- .catch(console.error); // an error occurred
417
+ agents
418
+ .createAgent(request)
419
+ .then(console.log) // successful response
420
+ .catch(console.error); // an error occurred
415
421
  ```
416
422
  <a name="Agents+getAgent"></a>
417
423
 
@@ -427,13 +433,14 @@ Retrieves an existing Agent in the Workspace.
427
433
 
428
434
  **Example**
429
435
  ```js
430
- const ref = "00000000-0000-0000-0000-000000000000"
431
-
432
436
  const agents = new SDK.Agents(client); // Existing client object
433
437
 
434
- agents.getAgent(ref)
435
- .then(console.log) // successful response
436
- .catch(console.error); // an error occurred
438
+ const ref = "00000000-0000-0000-0000-000000000000";
439
+
440
+ agents
441
+ .getAgent(ref)
442
+ .then(console.log) // successful response
443
+ .catch(console.error); // an error occurred
437
444
  ```
438
445
  <a name="Agents+updateAgent"></a>
439
446
 
@@ -455,20 +462,21 @@ Updates an existing Agent in the Workspace.
455
462
 
456
463
  **Example**
457
464
  ```js
465
+ const agents = new SDK.Agents(client); // Existing client object
466
+
458
467
  const request = {
459
- ref: "00000000-0000-0000-0000-000000000000",
460
- name: "John Doe",
461
- privacy: "PRIVATE",
462
- enabled: true,
463
- maxContacts: 3
464
- domainRef: "00000000-0000-0000-0000-000000000000"
468
+ ref: "00000000-0000-0000-0000-000000000000",
469
+ name: "John Doe",
470
+ privacy: "PRIVATE",
471
+ enabled: true,
472
+ maxContacts: 3
473
+ domainRef: "00000000-0000-0000-0000-000000000000"
465
474
  };
466
475
 
467
- const agents = new SDK.Agents(client); // Existing client object
468
-
469
- agents.updateAgent(request)
470
- .then(console.log) // successful response
471
- .catch(console.error); // an error occurred
476
+ agents
477
+ .updateAgent(request)
478
+ .then(console.log) // successful response
479
+ .catch(console.error); // an error occurred
472
480
  ```
473
481
  <a name="Agents+listAgents"></a>
474
482
 
@@ -486,16 +494,17 @@ Retrieves a list of Agents from a Workspace.
486
494
 
487
495
  **Example**
488
496
  ```js
497
+ const agents = new SDK.Agents(client); // Existing client object
498
+
489
499
  const request = {
490
500
  pageSize: 10,
491
501
  pageToken: "00000000-0000-0000-0000-000000000000"
492
502
  };
493
503
 
494
- const agents = new SDK.Agents(client); // Existing client object
495
-
496
- agents.listAgents(request)
497
- .then(console.log) // successful response
498
- .catch(console.error); // an error occurred
504
+ agents
505
+ .listAgents(request)
506
+ .then(console.log) // successful response
507
+ .catch(console.error); // an error occurred
499
508
  ```
500
509
  <a name="Agents+deleteAgent"></a>
501
510
 
@@ -512,13 +521,14 @@ Note that this operation is irreversible.
512
521
 
513
522
  **Example**
514
523
  ```js
515
- const ref = "00000000-0000-0000-0000-000000000000"
516
-
517
524
  const agents = new SDK.Agents(client); // Existing client object
518
525
 
519
- agents.deleteAgent(ref)
520
- .then(console.log) // successful response
521
- .catch(console.error); // an error occurred
526
+ const ref = "00000000-0000-0000-0000-000000000000";
527
+
528
+ agents
529
+ .deleteAgent(ref)
530
+ .then(console.log) // successful response
531
+ .catch(console.error); // an error occurred
522
532
  ```
523
533
 
524
534
  <a name="ApiKeys"></a>
@@ -557,11 +567,11 @@ Constructs a new ApiKeys object.
557
567
  const SDK = require("@fonoster/sdk");
558
568
 
559
569
  async function main(request) {
560
- const apiKey = "your-api-key";
561
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
570
+ const API_KEY = "your-api-key";
571
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
562
572
 
563
- try {
564
- const client = SDK.Client({ accessKeyId });
573
+ try {
574
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
565
575
  await client.loginWithApiKey(apiKey);
566
576
 
567
577
  const apiKeys = new SDK.ApiKeys(client);
@@ -594,15 +604,16 @@ Creates a new ApiKey for a Workspace.
594
604
 
595
605
  **Example**
596
606
  ```js
607
+ const apiKeys = new SDK.ApiKeys(client); // Existing client object
608
+
597
609
  const request = {
598
- role: "WORKSPACE_ADMIN"
610
+ role: "WORKSPACE_ADMIN"
599
611
  };
600
612
 
601
- const apiKeys = new SDK.ApiKeys(client); // Existing client object
602
-
603
- apiKeys.createApiKey(request)
604
- .then(console.log) // successful response
605
- .catch(console.error); // an error occurred
613
+ apiKeys
614
+ .createApiKey(request)
615
+ .then(console.log) // successful response
616
+ .catch(console.error); // an error occurred
606
617
  ```
607
618
  <a name="ApiKeys+regenerateApiKey"></a>
608
619
 
@@ -619,13 +630,14 @@ Note that this operation is irreversible.
619
630
 
620
631
  **Example**
621
632
  ```js
622
- const ref = "00000000-0000-0000-0000-000000000000"
623
-
624
633
  const apiKeys = new SDK.ApiKeys(client); // Existing client object
625
634
 
626
- apiKeys.regenerateApiKey(ref)
627
- .then(console.log) // successful response
628
- .catch(console.error); // an error occurred
635
+ const ref = "00000000-0000-0000-0000-000000000000";
636
+
637
+ apiKeys
638
+ .regenerateApiKey(ref)
639
+ .then(console.log) // successful response
640
+ .catch(console.error); // an error occurred
629
641
  ```
630
642
  <a name="ApiKeys+listApiKeys"></a>
631
643
 
@@ -643,16 +655,17 @@ Retrieves a list of ApiKeys from a Workspace.
643
655
 
644
656
  **Example**
645
657
  ```js
658
+ const apiKeys = new SDK.ApiKeys(client); // Existing client object
659
+
646
660
  const request = {
647
- pageSize: 10,
648
- pageToken: "00000000-0000-0000-0000-000000000000"
661
+ pageSize: 10,
662
+ pageToken: "00000000-0000-0000-0000-000000000000"
649
663
  };
650
664
 
651
- const apiKeys = new SDK.ApiKeys(client); // Existing client object
652
-
653
- apiKeys.listApiKeys(request)
654
- .then(console.log) // successful response
655
- .catch(console.error); // an error occurred
665
+ apiKeys
666
+ .listApiKeys(request)
667
+ .then(console.log) // successful response
668
+ .catch(console.error); // an error occurred
656
669
  ```
657
670
  <a name="ApiKeys+deleteApiKey"></a>
658
671
 
@@ -669,13 +682,14 @@ Note that this operation is irreversible.
669
682
 
670
683
  **Example**
671
684
  ```js
672
- const ref = "00000000-0000-0000-0000-000000000000"
673
-
674
685
  const apiKeys = new SDK.ApiKeys(client); // Existing client object
675
686
 
676
- apiKeys.deleteApiKey(ref)
677
- .then(console.log) // successful response
678
- .catch(console.error); // an error occurred
687
+ const ref = "00000000-0000-0000-0000-000000000000";
688
+
689
+ apiKeys
690
+ .deleteApiKey(ref)
691
+ .then(console.log) // successful response
692
+ .catch(console.error); // an error occurred
679
693
  ```
680
694
 
681
695
  <a name="Applications"></a>
@@ -715,11 +729,11 @@ Constructs a new Applications object.
715
729
  const SDK = require("@fonoster/sdk");
716
730
 
717
731
  async function main(request) {
718
- const apiKey = "your-api-key";
719
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
732
+ const API_KEY = "your-api-key";
733
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
720
734
 
721
- try {
722
- const client = SDK.Client({ accessKeyId });
735
+ try {
736
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
723
737
  await client.loginWithApiKey(apiKey);
724
738
 
725
739
  const apps = new SDK.Applications(client);
@@ -787,6 +801,8 @@ Creates a new Application in Fonoster. The only required fields are the name and
787
801
 
788
802
  **Example**
789
803
  ```js
804
+ const apps = new SDK.Applications(client); // Existing client object
805
+
790
806
  const request = {
791
807
  name: "My application",
792
808
  type: "PROGRAMMABLE_VOICE",
@@ -814,11 +830,10 @@ const request = {
814
830
  }
815
831
  };
816
832
 
817
- const apps = new SDK.Applications(client); // Existing client object
818
-
819
- apps.createApplication(request)
820
- .then(console.log) // successful response
821
- .catch(console.error); // an error occurred
833
+ apps
834
+ .createApplication(request)
835
+ .then(console.log) // successful response
836
+ .catch(console.error); // an error occurred
822
837
  ```
823
838
  <a name="Applications+getApplication"></a>
824
839
 
@@ -834,13 +849,14 @@ Retrieves an existing Application in the Workspace.
834
849
 
835
850
  **Example**
836
851
  ```js
837
- const ref = "00000000-0000-0000-0000-000000000000"
838
-
839
852
  const apps = new SDK.Applications(client); // Existing client object
840
853
 
841
- apps.getApplication(ref)
842
- .then(console.log) // successful response
843
- .catch(console.error); // an error occurred
854
+ const ref = "00000000-0000-0000-0000-000000000000";
855
+
856
+ apps
857
+ .getApplication(ref)
858
+ .then(console.log) // successful response
859
+ .catch(console.error); // an error occurred
844
860
  ```
845
861
  <a name="Applications+updateApplication"></a>
846
862
 
@@ -869,17 +885,18 @@ Updates an existing application in Fonoster.
869
885
 
870
886
  **Example**
871
887
  ```js
872
- const request = {
873
- ref: "00000000-0000-0000-0000-000000000000",
874
- name: "My application",
875
- appEndpoint: "myapp.mydomain.com"
876
- }
877
-
878
888
  const apps = new SDK.Applications(client); // Existing client object
879
889
 
880
- apps.updateApplication(request)
881
- .then(console.log) // successful response
882
- .catch(console.error); // an error occurred
890
+ const request = {
891
+ ref: "00000000-0000-0000-0000-000000000000",
892
+ name: "My application",
893
+ appEndpoint: "myapp.mydomain.com"
894
+ };
895
+
896
+ apps
897
+ .updateApplication(request)
898
+ .then(console.log) // successful response
899
+ .catch(console.error); // an error occurred
883
900
  ```
884
901
  <a name="Applications+listApplications"></a>
885
902
 
@@ -897,16 +914,17 @@ Retrieves a list of Applications from Fonoster.
897
914
 
898
915
  **Example**
899
916
  ```js
917
+ const apps = new SDK.Applications(client); // Existing client object
918
+
900
919
  const request = {
901
- pageSize: 10,
902
- pageToken: "00000000-0000-0000-0000-000000000000"
920
+ pageSize: 10,
921
+ pageToken: "00000000-0000-0000-0000-000000000000"
903
922
  };
904
923
 
905
- const apps = new SDK.Applications(client); // Existing client object
906
-
907
- apps.listApplications(request)
908
- .then(console.log) // successful response
909
- .catch(console.error); // an error occurred
924
+ apps
925
+ .listApplications(request)
926
+ .then(console.log) // successful response
927
+ .catch(console.error); // an error occurred
910
928
  ```
911
929
  <a name="Applications+deleteApplication"></a>
912
930
 
@@ -923,13 +941,14 @@ Note that this operation is irreversible.
923
941
 
924
942
  **Example**
925
943
  ```js
926
- const ref = "00000000-0000-0000-0000-000000000000"
927
-
928
944
  const apps = new SDK.Applications(client); // Existing client object
929
945
 
930
- apps.deleteApplication(ref)
931
- .then(console.log) // successful response
932
- .catch(console.error); // an error occurred
946
+ const ref = "00000000-0000-0000-0000-000000000000";
947
+
948
+ apps
949
+ .deleteApplication(ref)
950
+ .then(console.log) // successful response
951
+ .catch(console.error); // an error occurred
933
952
  ```
934
953
 
935
954
  <a name="Calls"></a>
@@ -967,13 +986,12 @@ Constructs a new Calls object.
967
986
  const SDK = require("@fonoster/sdk");
968
987
 
969
988
  async function main(request) {
970
- const username = "admin";
971
- const password = "yourpassword";
972
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
989
+ const API_KEY = "your-api-key";
990
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
973
991
 
974
- try {
975
- const client = SDK.Client({ accessKeyId });
976
- await client.login({ username, password });
992
+ try {
993
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
994
+ await client.loginWithApiKey(apiKey);
977
995
 
978
996
  const calls = new SDK.Calls(client);
979
997
  const response = await apiKeys.createCall(request);
@@ -1009,17 +1027,18 @@ Creates a new Call in the Workspace.
1009
1027
 
1010
1028
  **Example**
1011
1029
  ```js
1030
+ const calls = new SDK.Calls(client); // Existing client object
1031
+
1012
1032
  const request = {
1013
- from: "8287854037",
1014
- to: "+17853178070",
1015
- appRef: "00000000-0000-0000-0000-000000000000"
1033
+ from: "8287854037",
1034
+ to: "+17853178070",
1035
+ appRef: "00000000-0000-0000-0000-000000000000"
1016
1036
  };
1017
1037
 
1018
- const calls = new SDK.Calls(client); // Existing client object
1019
-
1020
- calls.createCall(request)
1021
- .then(console.log) // successful response
1022
- .catch(console.error); // an error occurred
1038
+ calls
1039
+ .createCall(request)
1040
+ .then(console.log) // successful response
1041
+ .catch(console.error); // an error occurred
1023
1042
  ```
1024
1043
  <a name="Calls+getCall"></a>
1025
1044
 
@@ -1035,13 +1054,14 @@ Retrieves an existing Call in the Workspace.
1035
1054
 
1036
1055
  **Example**
1037
1056
  ```js
1038
- const ref = "00000000-0000-0000-0000-000000000000"
1039
-
1040
1057
  const calls = new SDK.Calls(client); // Existing client object
1041
1058
 
1042
- calls.getCall(ref)
1043
- .then(console.log) // successful response
1044
- .catch(console.error); // an error occurred
1059
+ const ref = "00000000-0000-0000-0000-000000000000";
1060
+
1061
+ calls
1062
+ .getCall(ref)
1063
+ .then(console.log) // successful response
1064
+ .catch(console.error); // an error occurred
1045
1065
  ```
1046
1066
  <a name="Calls+listCalls"></a>
1047
1067
 
@@ -1059,16 +1079,17 @@ Retrieves a list of Calls from a Workspace.
1059
1079
 
1060
1080
  **Example**
1061
1081
  ```js
1082
+ const calls = new SDK.Calls(client); // Existing client object
1083
+
1062
1084
  const request = {
1063
- pageSize: 10,
1064
- pageToken: "00000000-0000-0000-0000-000000000000"
1085
+ pageSize: 10,
1086
+ pageToken: "00000000-0000-0000-0000-000000000000"
1065
1087
  };
1066
1088
 
1067
- const calls = new SDK.Calls(client); // Existing client object
1068
-
1069
- calls.listCalls(request)
1070
- .then(console.log) // successful response
1071
- .catch(console.error); // an error occurred
1089
+ calls
1090
+ .listCalls(request)
1091
+ .then(console.log) // successful response
1092
+ .catch(console.error); // an error occurred
1072
1093
  ```
1073
1094
 
1074
1095
  <a name="Credentials"></a>
@@ -1108,11 +1129,11 @@ Constructs a new Credentials object.
1108
1129
  const SDK = require("@fonoster/sdk");
1109
1130
 
1110
1131
  async function main(request) {
1111
- const apiKey = "your-api-key";
1112
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
1132
+ const API_KEY = "your-api-key";
1133
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
1113
1134
 
1114
- try {
1115
- const client = SDK.Client({ accessKeyId });
1135
+ try {
1136
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
1116
1137
  await client.loginWithApiKey(apiKey);
1117
1138
 
1118
1139
  const credentials = new SDK.Credentials(client);
@@ -1149,17 +1170,18 @@ Creates a new set of Credentials in the Workspace.
1149
1170
 
1150
1171
  **Example**
1151
1172
  ```js
1173
+ const credentials = new SDK.Credentials(client); // Existing client object
1174
+
1152
1175
  const request = {
1153
- name: "My Credentials",
1154
- username: "myusername",
1155
- password: "mysecret"
1176
+ name: "My Credentials",
1177
+ username: "myusername",
1178
+ password: "mysecret"
1156
1179
  };
1157
1180
 
1158
- const credentials = new SDK.Credentials(client); // Existing client object
1159
-
1160
- credentials.createCredentials(request)
1161
- .then(console.log) // successful response
1162
- .catch(console.error); // an error occurred
1181
+ credentials
1182
+ .createCredentials(request)
1183
+ .then(console.log) // successful response
1184
+ .catch(console.error); // an error occurred
1163
1185
  ```
1164
1186
  <a name="Credentials+getCredentials"></a>
1165
1187
 
@@ -1175,13 +1197,14 @@ Retrieves an existing set of Credentials in the Workspace.
1175
1197
 
1176
1198
  **Example**
1177
1199
  ```js
1178
- const ref = "00000000-0000-0000-0000-000000000000"
1179
-
1180
1200
  const credentials = new SDK.Credentials(client); // Existing client object
1181
1201
 
1182
- credentials.getCredentials(ref)
1183
- .then(console.log) // successful response
1184
- .catch(console.error); // an error occurred
1202
+ const ref = "00000000-0000-0000-0000-000000000000";
1203
+
1204
+ credentials
1205
+ .getCredentials(ref)
1206
+ .then(console.log) // successful response
1207
+ .catch(console.error); // an error occurred
1185
1208
  ```
1186
1209
  <a name="Credentials+updateCredentials"></a>
1187
1210
 
@@ -1200,17 +1223,18 @@ Updates an existing set of Credentials in the Workspace.
1200
1223
 
1201
1224
  **Example**
1202
1225
  ```js
1226
+ const credentials = new SDK.Credentials(client); // Existing client object
1227
+
1203
1228
  const request = {
1204
- ref: "00000000-0000-0000-0000-000000000000",
1205
- name: "My Credentials",
1206
- password: "mysecret"
1229
+ ref: "00000000-0000-0000-0000-000000000000",
1230
+ name: "My Credentials",
1231
+ password: "mysecret"
1207
1232
  };
1208
1233
 
1209
- const credentials = new SDK.Credentials(client); // Existing client object
1210
-
1211
- credentials.updateCredentials(request)
1212
- .then(console.log) // successful response
1213
- .catch(console.error); // an error occurred
1234
+ credentials
1235
+ .updateCredentials(request)
1236
+ .then(console.log) // successful response
1237
+ .catch(console.error); // an error occurred
1214
1238
  ```
1215
1239
  <a name="Credentials+listCredentials"></a>
1216
1240
 
@@ -1228,16 +1252,17 @@ Retrieves a list of Credentials from a Workspace.
1228
1252
 
1229
1253
  **Example**
1230
1254
  ```js
1255
+ const credentials = new SDK.Credentials(client); // Existing client object
1256
+
1231
1257
  const request = {
1232
- pageSize: 10,
1233
- pageToken: "00000000-0000-0000-0000-000000000000"
1258
+ pageSize: 10,
1259
+ pageToken: "00000000-0000-0000-0000-000000000000"
1234
1260
  };
1235
1261
 
1236
- const credentials = new SDK.Credentials(client); // Existing client object
1237
-
1238
- credentials.listCredentials(request)
1239
- .then(console.log) // successful response
1240
- .catch(console.error); // an error occurred
1262
+ credentials
1263
+ .listCredentials(request)
1264
+ .then(console.log) // successful response
1265
+ .catch(console.error); // an error occurred
1241
1266
  ```
1242
1267
  <a name="Credentials+deleteCredentials"></a>
1243
1268
 
@@ -1254,13 +1279,14 @@ Note that this operation is irreversible.
1254
1279
 
1255
1280
  **Example**
1256
1281
  ```js
1257
- const ref = "00000000-0000-0000-0000-000000000000"
1258
-
1259
1282
  const credentials = new SDK.Credentials(client); // Existing client object
1260
1283
 
1261
- credentials.deleteCredentials(ref)
1262
- .then(console.log) // successful response
1263
- .catch(console.error); // an error occurred
1284
+ const ref = "00000000-0000-0000-0000-000000000000";
1285
+
1286
+ credentials
1287
+ .deleteCredentials(ref)
1288
+ .then(console.log) // successful response
1289
+ .catch(console.error); // an error occurred
1264
1290
  ```
1265
1291
 
1266
1292
  <a name="Domains"></a>
@@ -1300,11 +1326,11 @@ Constructs a new Domains object.
1300
1326
  const SDK = require("@fonoster/sdk");
1301
1327
 
1302
1328
  async function main(request) {
1303
- const apiKey = "your-api-key";
1304
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
1329
+ const API_KEY = "your-api-key";
1330
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
1305
1331
 
1306
- try {
1307
- const client = SDK.Client({ accessKeyId });
1332
+ try {
1333
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
1308
1334
  await client.loginWithApiKey(apiKey);
1309
1335
 
1310
1336
  const domains = new SDK.Domains(client);
@@ -1343,16 +1369,17 @@ Creates a new Domain in the Workspace.
1343
1369
 
1344
1370
  **Example**
1345
1371
  ```js
1372
+ const domains = new SDK.Domains(client); // Existing client object
1373
+
1346
1374
  const request = {
1347
- name: "My Domain",
1348
- domainUri: "sip.project.fonoster.io"
1375
+ name: "My Domain",
1376
+ domainUri: "sip.project.fonoster.io"
1349
1377
  };
1350
1378
 
1351
- const domains = new SDK.Domains(client); // Existing client object
1352
-
1353
- domains.createDomain(request)
1354
- .then(console.log) // successful response
1355
- .catch(console.error); // an error occurred
1379
+ domains
1380
+ .createDomain(request)
1381
+ .then(console.log) // successful response
1382
+ .catch(console.error); // an error occurred
1356
1383
  ```
1357
1384
  <a name="Domains+getDomain"></a>
1358
1385
 
@@ -1368,13 +1395,14 @@ Retrieves an existing Domain in the Workspace.
1368
1395
 
1369
1396
  **Example**
1370
1397
  ```js
1371
- const ref = "00000000-0000-0000-0000-000000000000"
1372
-
1373
1398
  const domains = new SDK.Domains(client); // Existing client object
1374
1399
 
1375
- domains.getDomain(ref)
1376
- .then(console.log) // successful response
1377
- .catch(console.error); // an error occurred
1400
+ const ref = "00000000-0000-0000-0000-000000000000";
1401
+
1402
+ domains
1403
+ .getDomain(ref)
1404
+ .then(console.log) // successful response
1405
+ .catch(console.error); // an error occurred
1378
1406
  ```
1379
1407
  <a name="Domains+updateDomain"></a>
1380
1408
 
@@ -1397,16 +1425,17 @@ Updates an existing Domain in the Workspace.
1397
1425
 
1398
1426
  **Example**
1399
1427
  ```js
1428
+ const domains = new SDK.Domains(client); // Existing client object
1429
+
1400
1430
  const request = {
1401
- ref: "00000000-0000-0000-0000-000000000000",
1402
- accessControlListRef: "00000000-0000-0000-0000-000000000001"
1431
+ ref: "00000000-0000-0000-0000-000000000000",
1432
+ accessControlListRef: "00000000-0000-0000-0000-000000000001"
1403
1433
  };
1404
1434
 
1405
- const domains = new SDK.Domains(client); // Existing client object
1406
-
1407
- domains.updateDomain(request)
1408
- .then(console.log) // successful response
1409
- .catch(console.error); // an error occurred
1435
+ domains
1436
+ .updateDomain(request)
1437
+ .then(console.log) // successful response
1438
+ .catch(console.error); // an error occurred
1410
1439
  ```
1411
1440
  <a name="Domains+listDomains"></a>
1412
1441
 
@@ -1424,16 +1453,17 @@ Retrieves a list of Domains from a Workspace.
1424
1453
 
1425
1454
  **Example**
1426
1455
  ```js
1456
+ const domains = new SDK.Domains(client); // Existing client object
1457
+
1427
1458
  const request = {
1428
- pageSize: 10,
1429
- pageToken: "00000000-0000-0000-0000-000000000000"
1459
+ pageSize: 10,
1460
+ pageToken: "00000000-0000-0000-0000-000000000000"
1430
1461
  };
1431
1462
 
1432
- const domains = new SDK.Domains(client); // Existing client object
1433
-
1434
- domains.listDomains(request)
1435
- .then(console.log) // successful response
1436
- .catch(console.error); // an error occurred
1463
+ domains
1464
+ .listDomains(request)
1465
+ .then(console.log) // successful response
1466
+ .catch(console.error); // an error occurred
1437
1467
  ```
1438
1468
  <a name="Domains+deleteDomain"></a>
1439
1469
 
@@ -1450,13 +1480,14 @@ Note that this operation is irreversible.
1450
1480
 
1451
1481
  **Example**
1452
1482
  ```js
1453
- const ref = "00000000-0000-0000-0000-000000000000"
1454
-
1455
1483
  const domains = new SDK.Domains(client); // Existing client object
1456
1484
 
1457
- domains.deleteDomain(ref)
1458
- .then(console.log) // successful response
1459
- .catch(console.error); // an error occurred
1485
+ const ref = "00000000-0000-0000-0000-000000000000";
1486
+
1487
+ domains
1488
+ .deleteDomain(ref)
1489
+ .then(console.log) // successful response
1490
+ .catch(console.error); // an error occurred
1460
1491
  ```
1461
1492
 
1462
1493
  <a name="Numbers"></a>
@@ -1496,11 +1527,11 @@ Constructs a new Numbers object.
1496
1527
  const SDK = require("@fonoster/sdk");
1497
1528
 
1498
1529
  async function main(request) {
1499
- const apiKey = "your-api-key";
1500
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
1530
+ const API_KEY = "your-api-key";
1531
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
1501
1532
 
1502
- try {
1503
- const client = SDK.Client({ accessKeyId });
1533
+ try {
1534
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
1504
1535
  await client.loginWithApiKey(apiKey);
1505
1536
 
1506
1537
  const numbers = new SDK.Numbers(client);
@@ -1541,19 +1572,20 @@ Creates a new Number in the Workspace.
1541
1572
 
1542
1573
  **Example**
1543
1574
  ```js
1575
+ const numbers = new SDK.Numbers(client); // Existing client object
1576
+
1544
1577
  const request = {
1545
- name: "My Number",
1546
- telUrl: "tel:+17853178070",
1547
- city: "Asheville",
1548
- country: "United States",
1549
- countryIsoCode: "US"
1578
+ name: "My Number",
1579
+ telUrl: "tel:+17853178070",
1580
+ city: "Asheville",
1581
+ country: "United States",
1582
+ countryIsoCode: "US"
1550
1583
  };
1551
1584
 
1552
- const numbers = new SDK.Numbers(client); // Existing client object
1553
-
1554
- numbers.createNumber(request)
1555
- .then(console.log) // successful response
1556
- .catch(console.error); // an error occurred
1585
+ numbers
1586
+ .createNumber(request)
1587
+ .then(console.log) // successful response
1588
+ .catch(console.error); // an error occurred
1557
1589
  ```
1558
1590
  <a name="Numbers+getNumber"></a>
1559
1591
 
@@ -1569,13 +1601,14 @@ Retrieves an existing Number in the Workspace.
1569
1601
 
1570
1602
  **Example**
1571
1603
  ```js
1572
- const ref = "00000000-0000-0000-0000-000000000000"
1573
-
1574
1604
  const numbers = new SDK.Numbers(client); // Existing client object
1575
1605
 
1576
- numbers.getNumber(ref)
1577
- .then(console.log) // successful response
1578
- .catch(console.error); // an error occurred
1606
+ const ref = "00000000-0000-0000-0000-000000000000";
1607
+
1608
+ numbers
1609
+ .getNumber(ref)
1610
+ .then(console.log) // successful response
1611
+ .catch(console.error); // an error occurred
1579
1612
  ```
1580
1613
  <a name="Numbers+updateNumber"></a>
1581
1614
 
@@ -1593,16 +1626,17 @@ Updates an existing Number in the Workspace.
1593
1626
 
1594
1627
  **Example**
1595
1628
  ```js
1629
+ const numbers = new SDK.Numbers(client); // Existing client object
1630
+
1596
1631
  const request = {
1597
- ref: "00000000-0000-0000-0000-000000000000",
1598
- name: "My Number"
1632
+ ref: "00000000-0000-0000-0000-000000000000",
1633
+ name: "My Number"
1599
1634
  };
1600
1635
 
1601
- const numbers = new SDK.Numbers(client); // Existing client object
1602
-
1603
- numbers.updateNumber(request)
1604
- .then(console.log) // successful response
1605
- .catch(console.error); // an error occurred
1636
+ numbers
1637
+ .updateNumber(request)
1638
+ .then(console.log) // successful response
1639
+ .catch(console.error); // an error occurred
1606
1640
  ```
1607
1641
  <a name="Numbers+listNumbers"></a>
1608
1642
 
@@ -1620,16 +1654,17 @@ Retrieves a list of Numbers from a Workspace.
1620
1654
 
1621
1655
  **Example**
1622
1656
  ```js
1657
+ const numbers = new SDK.Numbers(client); // Existing client object
1658
+
1623
1659
  const request = {
1624
- pageSize: 10,
1625
- pageToken: "00000000-0000-0000-0000-000000000000"
1660
+ pageSize: 10,
1661
+ pageToken: "00000000-0000-0000-0000-000000000000"
1626
1662
  };
1627
1663
 
1628
- const numbers = new SDK.Numbers(client); // Existing client object
1629
-
1630
- numbers.listNumbers(request)
1631
- .then(console.log) // successful response
1632
- .catch(console.error); // an error occurred
1664
+ numbers
1665
+ .listNumbers(request)
1666
+ .then(console.log) // successful response
1667
+ .catch(console.error); // an error occurred
1633
1668
  ```
1634
1669
  <a name="Numbers+deleteNumber"></a>
1635
1670
 
@@ -1646,13 +1681,14 @@ Note that this operation is irreversible.
1646
1681
 
1647
1682
  **Example**
1648
1683
  ```js
1649
- const ref = "00000000-0000-0000-0000-000000000000"
1650
-
1651
1684
  const numbers = new SDK.Numbers(client); // Existing client object
1652
1685
 
1653
- numbers.deleteDomain(ref)
1654
- .then(console.log) // successful response
1655
- .catch(console.error); // an error occurred
1686
+ const ref = "00000000-0000-0000-0000-000000000000";
1687
+
1688
+ numbers
1689
+ .deleteNumber(ref)
1690
+ .then(console.log) // successful response
1691
+ .catch(console.error); // an error occurred
1656
1692
  ```
1657
1693
 
1658
1694
  <a name="Secrets"></a>
@@ -1692,11 +1728,11 @@ Constructs a new Secrets object.
1692
1728
  const SDK = require("@fonoster/sdk");
1693
1729
 
1694
1730
  async function main(request) {
1695
- const apiKey = "your-api-key";
1696
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
1731
+ const API_KEY = "your-api-key";
1732
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
1697
1733
 
1698
- try {
1699
- const client = SDK.Client({ accessKeyId });
1734
+ try {
1735
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
1700
1736
  await client.loginWithApiKey(apiKey);
1701
1737
 
1702
1738
  const secrets = new SDK.Secrets(client);
@@ -1731,16 +1767,17 @@ Creates a new Secret in the Workspace.
1731
1767
 
1732
1768
  **Example**
1733
1769
  ```js
1770
+ const secrets = new SDK.Secrets(client); // Existing client object
1771
+
1734
1772
  const request = {
1735
- name: "FRIENDLY_NAME",
1736
- secret: "mysecret"
1773
+ name: "FRIENDLY_NAME",
1774
+ secret: "mysecret"
1737
1775
  };
1738
1776
 
1739
- const secrets = new SDK.Secrets(client); // Existing client object
1740
-
1741
- secrets.createSecret(request)
1742
- .then(console.log) // successful response
1743
- .catch(console.error); // an error occurred
1777
+ secrets
1778
+ .createSecret(request)
1779
+ .then(console.log) // successful response
1780
+ .catch(console.error); // an error occurred
1744
1781
  ```
1745
1782
  <a name="Secrets+getSecret"></a>
1746
1783
 
@@ -1756,13 +1793,14 @@ Retrieves an existing Secret in the Workspace.
1756
1793
 
1757
1794
  **Example**
1758
1795
  ```js
1759
- const ref = "00000000-0000-0000-0000-000000000000"
1760
-
1761
1796
  const secrets = new SDK.Secrets(client); // Existing client object
1762
1797
 
1763
- secrets.getSecret(ref)
1764
- .then(console.log) // successful response
1765
- .catch(console.error); // an error occurred
1798
+ const ref = "00000000-0000-0000-0000-000000000000";
1799
+
1800
+ secrets
1801
+ .getSecret(ref)
1802
+ .then(console.log) // successful response
1803
+ .catch(console.error); // an error occurred
1766
1804
  ```
1767
1805
  <a name="Secrets+updateSecret"></a>
1768
1806
 
@@ -1781,16 +1819,17 @@ Updates an existing Secret in the Workspace.
1781
1819
 
1782
1820
  **Example**
1783
1821
  ```js
1822
+ const secrets = new SDK.Secrets(client); // Existing client object
1823
+
1784
1824
  const request = {
1785
- ref: "00000000-0000-0000-0000-000000000000",
1786
- secret: "mysecret"
1825
+ ref: "00000000-0000-0000-0000-000000000000",
1826
+ secret: "mysecret"
1787
1827
  };
1788
1828
 
1789
- const secrets = new SDK.Secrets(client); // Existing client object
1790
-
1791
- secrets.updateSecret(request)
1792
- .then(console.log) // successful response
1793
- .catch(console.error); // an error occurred
1829
+ secrets
1830
+ .updateSecret(request)
1831
+ .then(console.log) // successful response
1832
+ .catch(console.error); // an error occurred
1794
1833
  ```
1795
1834
  <a name="Secrets+listSecrets"></a>
1796
1835
 
@@ -1808,16 +1847,17 @@ Retrieves a list of Secrets from a Workspace.
1808
1847
 
1809
1848
  **Example**
1810
1849
  ```js
1850
+ const secrets = new SDK.Secrets(client); // Existing client object
1851
+
1811
1852
  const request = {
1812
- pageSize: 10,
1813
- pageToken: "00000000-0000-0000-0000-000000000000"
1853
+ pageSize: 10,
1854
+ pageToken: "00000000-0000-0000-0000-000000000000"
1814
1855
  };
1815
1856
 
1816
- const secrets = new SDK.Secrets(client); // Existing client object
1817
-
1818
- secrets.listSecrets(request)
1819
- .then(console.log) // successful response
1820
- .catch(console.error); // an error occurred
1857
+ secrets
1858
+ .listSecrets(request)
1859
+ .then(console.log) // successful response
1860
+ .catch(console.error); // an error occurred
1821
1861
  ```
1822
1862
  <a name="Secrets+deleteSecret"></a>
1823
1863
 
@@ -1834,13 +1874,14 @@ Note that this operation is irreversible.
1834
1874
 
1835
1875
  **Example**
1836
1876
  ```js
1837
- const ref = "00000000-0000-0000-0000-000000000000"
1838
-
1839
1877
  const secrets = new SDK.Secrets(client); // Existing client object
1840
1878
 
1841
- secrets.deleteSecret(ref)
1842
- .then(console.log) // successful response
1843
- .catch(console.error); // an error occurred
1879
+ const ref = "00000000-0000-0000-0000-000000000000";
1880
+
1881
+ secrets
1882
+ .deleteSecret(ref)
1883
+ .then(console.log) // successful response
1884
+ .catch(console.error); // an error occurred
1844
1885
  ```
1845
1886
 
1846
1887
  <a name="Trunks"></a>
@@ -1880,11 +1921,11 @@ Constructs a new Trunks object.
1880
1921
  const SDK = require("@fonoster/sdk");
1881
1922
 
1882
1923
  async function main(request) {
1883
- const apiKey = "your-api-key";
1884
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
1924
+ const API_KEY = "your-api-key";
1925
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
1885
1926
 
1886
- try {
1887
- const client = SDK.Client({ accessKeyId });
1927
+ try {
1928
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
1888
1929
  await client.loginWithApiKey(apiKey);
1889
1930
 
1890
1931
  const trunks = new SDK.Trunks(client);
@@ -1931,26 +1972,27 @@ Creates a new Trunk in the Workspace.
1931
1972
 
1932
1973
  **Example**
1933
1974
  ```js
1975
+ const trunks = new SDK.Trunks(client); // Existing client object
1976
+
1934
1977
  const request = {
1935
- name: "My Trunk",
1936
- inboundUri: "sip.company.fonoster.io"
1937
- sendRegister: true
1938
- uris: [{
1939
- host: "sip.company.fonoster.io",
1940
- port: 5060,
1941
- transport: "UDP",
1942
- user: "user",
1943
- weight: 0,
1944
- priority: 0,
1945
- enabled: true
1946
- }]
1978
+ name: "My Trunk",
1979
+ inboundUri: "sip.company.fonoster.io"
1980
+ sendRegister: true
1981
+ uris: [{
1982
+ host: "sip.company.fonoster.io",
1983
+ port: 5060,
1984
+ transport: "UDP",
1985
+ user: "user",
1986
+ weight: 0,
1987
+ priority: 0,
1988
+ enabled: true
1989
+ }]
1947
1990
  };
1948
1991
 
1949
- const trunks = new SDK.Trunks(client); // Existing client object
1950
-
1951
- trunks.createTrunk(request)
1952
- .then(console.log) // successful response
1953
- .catch(console.error); // an error occurred
1992
+ trunks
1993
+ .createTrunk(request)
1994
+ .then(console.log) // successful response
1995
+ .catch(console.error); // an error occurred
1954
1996
  ```
1955
1997
  <a name="Trunks+getTrunk"></a>
1956
1998
 
@@ -1966,13 +2008,14 @@ Retrieves an existing Trunk in the Workspace.
1966
2008
 
1967
2009
  **Example**
1968
2010
  ```js
1969
- const ref = "00000000-0000-0000-0000-000000000000"
1970
-
1971
2011
  const trunks = new SDK.Trunks(client); // Existing client object
1972
2012
 
1973
- trunks.getTrunk(ref)
1974
- .then(console.log) // successful response
1975
- .catch(console.error); // an error occurred
2013
+ const ref = "00000000-0000-0000-0000-000000000000";
2014
+
2015
+ trunks
2016
+ .getTrunk(ref)
2017
+ .then(console.log) // successful response
2018
+ .catch(console.error); // an error occurred
1976
2019
  ```
1977
2020
  <a name="Trunks+updateTrunk"></a>
1978
2021
 
@@ -2002,20 +2045,27 @@ Updates an existing Trunk in the Workspace.
2002
2045
 
2003
2046
  **Example**
2004
2047
  ```js
2048
+ const trunks = new SDK.Trunks(client); // Existing client object
2049
+
2005
2050
  const request = {
2006
- ref: "00000000-0000-0000-0000-000000000000",
2007
- name: "My Trunk",
2008
- sendRegister: true
2009
- uris: [{
2010
- host: "sip.company.fonoster.io",
2011
- port: 5060,
2012
- transport: "UDP",
2013
- user: "user",
2014
- weight: 0,
2015
- priority: 0,
2016
- enabled: true
2017
- }]
2051
+ ref: "00000000-0000-0000-0000-000000000000",
2052
+ name: "My Trunk",
2053
+ sendRegister: true
2054
+ uris: [{
2055
+ host: "sip.company.fonoster.io",
2056
+ port: 5060,
2057
+ transport: "UDP",
2058
+ user: "user",
2059
+ weight: 0,
2060
+ priority: 0,
2061
+ enabled: true
2062
+ }]
2018
2063
  };
2064
+
2065
+ trunks
2066
+ .updateTrunk(request)
2067
+ .then(console.log) // successful response
2068
+ .catch(console.error); // an error occurred
2019
2069
  ```
2020
2070
  <a name="Trunks+listTrunks"></a>
2021
2071
 
@@ -2033,16 +2083,17 @@ Retrieves a list of Trunks from a Workspace.
2033
2083
 
2034
2084
  **Example**
2035
2085
  ```js
2086
+ const trunks = new SDK.Trunks(client); // Existing client object
2087
+
2036
2088
  const request = {
2037
- pageSize: 10,
2038
- pageToken: "00000000-0000-0000-0000-000000000000"
2089
+ pageSize: 10,
2090
+ pageToken: "00000000-0000-0000-0000-000000000000"
2039
2091
  };
2040
2092
 
2041
- const trunks = new SDK.Trunks(client); // Existing client object
2042
-
2043
- trunks.listTrunks(request)
2044
- .then(console.log) // successful response
2045
- .catch(console.error); // an error occurred
2093
+ trunks
2094
+ .listTrunks(request)
2095
+ .then(console.log) // successful response
2096
+ .catch(console.error); // an error occurred
2046
2097
  ```
2047
2098
  <a name="Trunks+deleteTrunk"></a>
2048
2099
 
@@ -2059,13 +2110,14 @@ Note that this operation is irreversible.
2059
2110
 
2060
2111
  **Example**
2061
2112
  ```js
2062
- const ref = "00000000-0000-0000-0000-000000000000"
2063
-
2064
2113
  const trunks = new SDK.Trunks(client); // Existing client object
2065
2114
 
2066
- trunks.deleteTrunk(ref)
2067
- .then(console.log) // successful response
2068
- .catch(console.error); // an error occurred
2115
+ const ref = "00000000-0000-0000-0000-000000000000";
2116
+
2117
+ trunks
2118
+ .deleteTrunk(ref)
2119
+ .then(console.log) // successful response
2120
+ .catch(console.error); // an error occurred
2069
2121
  ```
2070
2122
 
2071
2123
  <a name="Users"></a>
@@ -2104,11 +2156,11 @@ Constructs a new Users object.
2104
2156
  const SDK = require("@fonoster/sdk");
2105
2157
 
2106
2158
  async function main(request) {
2107
- const apiKey = "your-api-key";
2108
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
2159
+ const API_KEY = "your-api-key";
2160
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
2109
2161
 
2110
- try {
2111
- const client = SDK.Client({ accessKeyId });
2162
+ try {
2163
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
2112
2164
  await client.loginWithApiKey(apiKey);
2113
2165
 
2114
2166
  const users = new SDK.Users(client);
@@ -2147,18 +2199,19 @@ Creates a new User in the Workspace.
2147
2199
 
2148
2200
  **Example**
2149
2201
  ```js
2202
+ const users = new SDK.Users(client); // Existing client object
2203
+
2150
2204
  const request = {
2151
- name: "John Doe",
2152
- email: "john.doe@example.com",
2153
- password: "password",
2154
- avatar: "https://example.com/avatar.jpg"
2205
+ name: "John Doe",
2206
+ email: "john.doe@example.com",
2207
+ password: "password",
2208
+ avatar: "https://example.com/avatar.jpg"
2155
2209
  };
2156
2210
 
2157
- const users = new SDK.Users(client); // Existing client object
2158
-
2159
- users.createUser(request)
2160
- .then(console.log) // successful response
2161
- .catch(console.error); // an error occurred
2211
+ users
2212
+ .createUser(request)
2213
+ .then(console.log) // successful response
2214
+ .catch(console.error); // an error occurred
2162
2215
  ```
2163
2216
  <a name="Users+getUser"></a>
2164
2217
 
@@ -2174,13 +2227,14 @@ Retrieves an existing User in the Workspace.
2174
2227
 
2175
2228
  **Example**
2176
2229
  ```js
2177
- const ref = "00000000-0000-0000-0000-000000000000"
2178
-
2179
2230
  const users = new SDK.Users(client); // Existing client object
2180
2231
 
2181
- users.getUser(ref)
2182
- .then(console.log) // successful response
2183
- .catch(console.error); // an error occurred
2232
+ const ref = "00000000-0000-0000-0000-000000000000";
2233
+
2234
+ users
2235
+ .getUser(ref)
2236
+ .then(console.log) // successful response
2237
+ .catch(console.error); // an error occurred
2184
2238
  ```
2185
2239
  <a name="Users+updateUser"></a>
2186
2240
 
@@ -2200,18 +2254,19 @@ Updates an existing User in the Workspace.
2200
2254
 
2201
2255
  **Example**
2202
2256
  ```js
2257
+ const users = new SDK.Users(client); // Existing client object
2258
+
2203
2259
  const request = {
2204
- ref: "00000000-0000-0000-0000-000000000000",
2205
- name: "John Doe",
2206
- password: "password",
2207
- avatar: "https://example.com/avatar.jpg"
2260
+ ref: "00000000-0000-0000-0000-000000000000",
2261
+ name: "John Doe",
2262
+ password: "password",
2263
+ avatar: "https://example.com/avatar.jpg"
2208
2264
  };
2209
2265
 
2210
- const users = new SDK.Users(client); // Existing client object
2211
-
2212
- users.updateUser(request)
2213
- .then(console.log) // successful response
2214
- .catch(console.error); // an error occurred
2266
+ users
2267
+ .updateUser(request)
2268
+ .then(console.log) // successful response
2269
+ .catch(console.error); // an error occurred
2215
2270
  ```
2216
2271
  <a name="Users+deleteUser"></a>
2217
2272
 
@@ -2228,13 +2283,14 @@ Note that this operation is irreversible.
2228
2283
 
2229
2284
  **Example**
2230
2285
  ```js
2231
- const ref = "00000000-0000-0000-0000-000000000000"
2232
-
2233
2286
  const users = new SDK.Users(client); // Existing client object
2234
2287
 
2235
- users.deleteUser(ref)
2236
- .then(console.log) // successful response
2237
- .catch(console.error); // an error occurred
2288
+ const ref = "00000000-0000-0000-0000-000000000000";
2289
+
2290
+ users
2291
+ .deleteUser(ref)
2292
+ .then(console.log) // successful response
2293
+ .catch(console.error); // an error occurred
2238
2294
  ```
2239
2295
 
2240
2296
  <a name="Workspaces"></a>
@@ -2277,11 +2333,11 @@ Constructs a new Workspaces object.
2277
2333
  const SDK = require("@fonoster/sdk");
2278
2334
 
2279
2335
  async function main(request) {
2280
- const apiKey = "your-api-key";
2281
- const accessKeyId = "00000000-0000-0000-0000-000000000000";
2336
+ const API_KEY = "your-api-key";
2337
+ const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
2282
2338
 
2283
- try {
2284
- const client = SDK.Client({ accessKeyId });
2339
+ try {
2340
+ const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
2285
2341
  await client.loginWithApiKey(apiKey);
2286
2342
 
2287
2343
  const workspaces = new SDK.Workspaces(client);
@@ -2314,15 +2370,16 @@ Creates a new Workspace in the system.
2314
2370
 
2315
2371
  **Example**
2316
2372
  ```js
2373
+ const workspaces = new SDK.Workspaces(client); // Existing client object
2374
+
2317
2375
  const request = {
2318
- name: "My Workspace"
2376
+ name: "My Workspace"
2319
2377
  };
2320
2378
 
2321
- const workspaces = new SDK.Workspaces(client); // Existing client object
2322
-
2323
- workspaces.createWorkspace(request)
2324
- .then(console.log) // successful response
2325
- .catch(console.error); // an error occurred
2379
+ workspaces
2380
+ .createWorkspace(request)
2381
+ .then(console.log) // successful response
2382
+ .catch(console.error); // an error occurred
2326
2383
  ```
2327
2384
  <a name="Workspaces+getWorkspace"></a>
2328
2385
 
@@ -2338,13 +2395,14 @@ Retrieves an existing Workspace in the system.
2338
2395
 
2339
2396
  **Example**
2340
2397
  ```js
2341
- const ref = "00000000-0000-0000-0000-000000000000"
2342
-
2343
2398
  const workspaces = new SDK.Workspaces(client); // Existing client object
2344
2399
 
2345
- workspaces.getWorkspace(ref)
2346
- .then(console.log) // successful response
2347
- .catch(console.error); // an error occurred
2400
+ const ref = "00000000-0000-0000-0000-000000000000";
2401
+
2402
+ workspaces
2403
+ .getWorkspace(ref)
2404
+ .then(console.log) // successful response
2405
+ .catch(console.error); // an error occurred
2348
2406
  ```
2349
2407
  <a name="Workspaces+updateWorkspace"></a>
2350
2408
 
@@ -2362,16 +2420,17 @@ Updates an existing Workspace in the system.
2362
2420
 
2363
2421
  **Example**
2364
2422
  ```js
2423
+ const workspaces = new SDK.Workspaces(client); // Existing client object
2424
+
2365
2425
  const request = {
2366
- ref: "00000000-0000-0000-0000-000000000000",
2367
- name: "My Workspace"
2426
+ ref: "00000000-0000-0000-0000-000000000000",
2427
+ name: "My Workspace"
2368
2428
  };
2369
2429
 
2370
- const workspaces = new SDK.Workspaces(client); // Existing client object
2371
-
2372
- workspaces.updateWorkspace(request)
2373
- .then(console.log) // successful response
2374
- .catch(console.error); // an error occurred
2430
+ workspaces
2431
+ .updateWorkspace(request)
2432
+ .then(console.log) // successful response
2433
+ .catch(console.error); // an error occurred
2375
2434
  ```
2376
2435
  <a name="Workspaces+deleteWorkspace"></a>
2377
2436
 
@@ -2388,13 +2447,14 @@ Note that this operation is irreversible.
2388
2447
 
2389
2448
  **Example**
2390
2449
  ```js
2391
- const ref = "00000000-0000-0000-0000-000000000000"
2392
-
2393
2450
  const workspaces = new SDK.Workspaces(client); // Existing client object
2394
2451
 
2395
- workspaces.deleteWorkspace(ref)
2396
- .then(console.log) // successful response
2397
- .catch(console.error); // an error occurred
2452
+ const ref = "00000000-0000-0000-0000-000000000000";
2453
+
2454
+ workspaces
2455
+ .deleteWorkspace(ref)
2456
+ .then(console.log) // successful response
2457
+ .catch(console.error); // an error occurred
2398
2458
  ```
2399
2459
  <a name="Workspaces+listWorkspaces"></a>
2400
2460
 
@@ -2412,16 +2472,17 @@ Retrieves a list of Workspaces from a Workspace.
2412
2472
 
2413
2473
  **Example**
2414
2474
  ```js
2475
+ const workspaces = new SDK.Workspaces(client); // Existing client object
2476
+
2415
2477
  const request = {
2416
- pageSize: 10,
2417
- pageToken: "00000000-0000-0000-0000-000000000000"
2478
+ pageSize: 10,
2479
+ pageToken: "00000000-0000-0000-0000-000000000000"
2418
2480
  };
2419
2481
 
2420
- const workspaces = new SDK.Workspaces(client); // Existing client object
2421
-
2422
- workspaces.listWorkspaces(request)
2423
- .then(console.log) // successful response
2424
- .catch(console.error); // an error occurred
2482
+ workspaces
2483
+ .listWorkspaces(request)
2484
+ .then(console.log) // successful response
2485
+ .catch(console.error); // an error occurred
2425
2486
  ```
2426
2487
  <a name="Workspaces+inviteUserToWorkspace"></a>
2427
2488
 
@@ -2440,17 +2501,19 @@ Invites a User to a Workspace.
2440
2501
 
2441
2502
  **Example**
2442
2503
  ```js
2504
+ const workspaces = new SDK.Workspaces(client); // Existing client object
2505
+
2443
2506
  const request = {
2444
- workspaceRef: "00000000-0000-0000-0000-000000000000",
2445
- email: "jane.doe@example.com",
2446
- role: "WORKSPACE_MEMBER",
2507
+ workspaceRef: "00000000-0000-0000-0000-000000000000",
2508
+ email: "jane.doe@example.com",
2509
+ role: "WORKSPACE_MEMBER",
2510
+ password: "password" // Temporary password for the User. Leave empty to generate a random password
2447
2511
  };
2448
2512
 
2449
- const workspaces = new SDK.Workspaces(client); // Existing client object
2450
-
2451
- workspaces.inviteUserToWorkspace(request)
2452
- .then(console.log) // successful response
2453
- .catch(console.error); // an error occurred
2513
+ workspaces
2514
+ .inviteUserToWorkspace(request)
2515
+ .then(console.log) // successful response
2516
+ .catch(console.error); // an error occurred
2454
2517
  ```
2455
2518
  <a name="Workspaces+resendWorkspaceMembershipInvitation"></a>
2456
2519
 
@@ -2466,13 +2529,14 @@ Resend a Workspace membership invitation.
2466
2529
 
2467
2530
  **Example**
2468
2531
  ```js
2469
- const userRef: "00000000-0000-0000-0000-000000000000";
2470
-
2471
2532
  const workspaces = new SDK.Workspaces(client); // Existing client object
2472
2533
 
2473
- workspaces.resendWorkspaceMembershipInvitation(request)
2474
- .then(console.log) // successful response
2475
- .catch(console.error); // an error occurred
2534
+ const userRef: "00000000-0000-0000-0000-000000000000";
2535
+
2536
+ workspaces
2537
+ .resendWorkspaceMembershipInvitation(request)
2538
+ .then(console.log) // successful response
2539
+ .catch(console.error); // an error occurred
2476
2540
  ```
2477
2541
  <a name="Workspaces+removeUserFromWorkspace"></a>
2478
2542
 
@@ -2488,12 +2552,13 @@ Removes a User from a Workspace.
2488
2552
 
2489
2553
  **Example**
2490
2554
  ```js
2491
- const userRef = "00000000-0000-0000-0000-000000000000";
2492
-
2493
2555
  const workspaces = new SDK.Workspaces(client); // Existing client object
2494
2556
 
2495
- workspaces.removeUserFromWorkspace(userRef)
2496
- .then(console.log) // successful response
2497
- .catch(console.error); // an error occurred
2557
+ const userRef = "00000000-0000-0000-0000-000000000000";
2558
+
2559
+ workspaces
2560
+ .removeUserFromWorkspace(userRef)
2561
+ .then(console.log) // successful response
2562
+ .catch(console.error); // an error occurred
2498
2563
  ```
2499
2564