@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.
- package/README.md +519 -454
- package/dist/node/Acls.d.ts +43 -44
- package/dist/node/Acls.js +62 -49
- package/dist/node/Agents.d.ts +44 -45
- package/dist/node/Agents.js +47 -46
- package/dist/node/ApiKeys.d.ts +29 -29
- package/dist/node/ApiKeys.js +29 -29
- package/dist/node/Applications.d.ts +39 -39
- package/dist/node/Applications.js +52 -40
- package/dist/node/Calls.d.ts +28 -29
- package/dist/node/Calls.js +32 -27
- package/dist/node/Credentials.d.ts +39 -39
- package/dist/node/Credentials.js +39 -39
- package/dist/node/Domains.d.ts +37 -37
- package/dist/node/Domains.js +37 -37
- package/dist/node/Numbers.d.ts +40 -40
- package/dist/node/Numbers.js +40 -40
- package/dist/node/Secrets.d.ts +37 -37
- package/dist/node/Secrets.js +37 -37
- package/dist/node/Trunks.d.ts +58 -52
- package/dist/node/Trunks.js +104 -70
- package/dist/node/Users.d.ts +34 -34
- package/dist/node/Users.js +34 -34
- package/dist/node/Workspaces.d.ts +55 -54
- package/dist/node/Workspaces.js +61 -54
- package/dist/node/client/jsonToObject.js +1 -1
- package/dist/node/client/makeRpcRequest.js +1 -1
- package/dist/node/client/objectToJson.d.ts +1 -1
- package/dist/node/client/objectToJson.js +12 -2
- package/dist/node/client/types/IdentityClient.d.ts +2 -2
- package/dist/node/client/utils.js +6 -3
- package/dist/node/generated/node/agents_grpc_pb.js +0 -2
- package/dist/node/generated/node/agents_pb.js +444 -24
- package/dist/node/generated/node/applications_pb.js +6 -6
- package/dist/node/generated/node/credentials_pb.js +11 -41
- package/dist/node/generated/node/domains_pb.js +30 -30
- package/dist/node/generated/node/identity_grpc_pb.js +14 -14
- package/dist/node/generated/node/identity_pb.js +37 -37
- package/dist/node/generated/node/numbers_grpc_pb.js +0 -1
- package/dist/node/generated/node/numbers_pb.js +191 -11
- package/dist/node/generated/node/trunks_grpc_pb.js +0 -2
- package/dist/node/generated/node/trunks_pb.js +526 -31
- package/dist/node/generated/web/IdentityServiceClientPb.ts +5 -5
- package/dist/node/generated/web/agents_pb.d.ts +62 -10
- package/dist/node/generated/web/agents_pb.js +444 -24
- package/dist/node/generated/web/applications_pb.js +6 -6
- package/dist/node/generated/web/credentials_pb.d.ts +0 -4
- package/dist/node/generated/web/credentials_pb.js +11 -41
- package/dist/node/generated/web/domains_pb.js +30 -30
- package/dist/node/generated/web/identity_pb.d.ts +13 -13
- package/dist/node/generated/web/identity_pb.js +37 -37
- package/dist/node/generated/web/numbers_pb.d.ts +26 -4
- package/dist/node/generated/web/numbers_pb.js +191 -11
- package/dist/node/generated/web/trunks_pb.d.ts +71 -11
- package/dist/node/generated/web/trunks_pb.js +526 -31
- package/dist/node/tsconfig.node.tsbuildinfo +1 -1
- package/dist/node/utils.d.ts +4 -3
- package/dist/node/utils.js +36 -0
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- 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
|
|
67
|
-
const
|
|
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
|
|
78
|
-
const
|
|
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
|
-
|
|
161
|
-
|
|
160
|
+
const API_KEY = "your-api-key";
|
|
161
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
const client = SDK.Client({ accessKeyId });
|
|
165
|
-
await client.loginWithApiKey(
|
|
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
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.
|
|
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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
-
|
|
284
|
-
|
|
288
|
+
pageSize: 10,
|
|
289
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
285
290
|
};
|
|
286
291
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
|
|
355
|
-
|
|
359
|
+
const API_KEY = "your-api-key";
|
|
360
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
356
361
|
|
|
357
|
-
|
|
358
|
-
const client = SDK.Client({ accessKeyId });
|
|
359
|
-
await client.loginWithApiKey(
|
|
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
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
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
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
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
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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
|
-
|
|
561
|
-
|
|
570
|
+
const API_KEY = "your-api-key";
|
|
571
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
562
572
|
|
|
563
|
-
|
|
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
|
-
|
|
610
|
+
role: "WORKSPACE_ADMIN"
|
|
599
611
|
};
|
|
600
612
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
.
|
|
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
|
-
|
|
627
|
-
|
|
628
|
-
|
|
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
|
-
|
|
648
|
-
|
|
661
|
+
pageSize: 10,
|
|
662
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
649
663
|
};
|
|
650
664
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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
|
-
|
|
677
|
-
|
|
678
|
-
|
|
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
|
-
|
|
719
|
-
|
|
732
|
+
const API_KEY = "your-api-key";
|
|
733
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
720
734
|
|
|
721
|
-
|
|
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
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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
|
-
|
|
842
|
-
|
|
843
|
-
|
|
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
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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
|
-
|
|
902
|
-
|
|
920
|
+
pageSize: 10,
|
|
921
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
903
922
|
};
|
|
904
923
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
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
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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
|
-
|
|
971
|
-
|
|
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
|
-
|
|
975
|
-
const client = SDK.Client({ accessKeyId });
|
|
976
|
-
await client.
|
|
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
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1033
|
+
from: "8287854037",
|
|
1034
|
+
to: "+17853178070",
|
|
1035
|
+
appRef: "00000000-0000-0000-0000-000000000000"
|
|
1016
1036
|
};
|
|
1017
1037
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
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
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
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
|
-
|
|
1064
|
-
|
|
1085
|
+
pageSize: 10,
|
|
1086
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1065
1087
|
};
|
|
1066
1088
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
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
|
-
|
|
1112
|
-
|
|
1132
|
+
const API_KEY = "your-api-key";
|
|
1133
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
1113
1134
|
|
|
1114
|
-
|
|
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
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1176
|
+
name: "My Credentials",
|
|
1177
|
+
username: "myusername",
|
|
1178
|
+
password: "mysecret"
|
|
1156
1179
|
};
|
|
1157
1180
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
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
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
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
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1229
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1230
|
+
name: "My Credentials",
|
|
1231
|
+
password: "mysecret"
|
|
1207
1232
|
};
|
|
1208
1233
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
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
|
-
|
|
1233
|
-
|
|
1258
|
+
pageSize: 10,
|
|
1259
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1234
1260
|
};
|
|
1235
1261
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
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
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
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
|
-
|
|
1304
|
-
|
|
1329
|
+
const API_KEY = "your-api-key";
|
|
1330
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
1305
1331
|
|
|
1306
|
-
|
|
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
|
-
|
|
1348
|
-
|
|
1375
|
+
name: "My Domain",
|
|
1376
|
+
domainUri: "sip.project.fonoster.io"
|
|
1349
1377
|
};
|
|
1350
1378
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
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
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
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
|
-
|
|
1402
|
-
|
|
1431
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1432
|
+
accessControlListRef: "00000000-0000-0000-0000-000000000001"
|
|
1403
1433
|
};
|
|
1404
1434
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
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
|
-
|
|
1429
|
-
|
|
1459
|
+
pageSize: 10,
|
|
1460
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1430
1461
|
};
|
|
1431
1462
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
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
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
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
|
-
|
|
1500
|
-
|
|
1530
|
+
const API_KEY = "your-api-key";
|
|
1531
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
1501
1532
|
|
|
1502
|
-
|
|
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
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1578
|
+
name: "My Number",
|
|
1579
|
+
telUrl: "tel:+17853178070",
|
|
1580
|
+
city: "Asheville",
|
|
1581
|
+
country: "United States",
|
|
1582
|
+
countryIsoCode: "US"
|
|
1550
1583
|
};
|
|
1551
1584
|
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
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
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
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
|
-
|
|
1598
|
-
|
|
1632
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1633
|
+
name: "My Number"
|
|
1599
1634
|
};
|
|
1600
1635
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
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
|
-
|
|
1625
|
-
|
|
1660
|
+
pageSize: 10,
|
|
1661
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1626
1662
|
};
|
|
1627
1663
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
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
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
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
|
-
|
|
1696
|
-
|
|
1731
|
+
const API_KEY = "your-api-key";
|
|
1732
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
1697
1733
|
|
|
1698
|
-
|
|
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
|
-
|
|
1736
|
-
|
|
1773
|
+
name: "FRIENDLY_NAME",
|
|
1774
|
+
secret: "mysecret"
|
|
1737
1775
|
};
|
|
1738
1776
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
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
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
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
|
-
|
|
1786
|
-
|
|
1825
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1826
|
+
secret: "mysecret"
|
|
1787
1827
|
};
|
|
1788
1828
|
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
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
|
-
|
|
1813
|
-
|
|
1853
|
+
pageSize: 10,
|
|
1854
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1814
1855
|
};
|
|
1815
1856
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
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
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
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
|
-
|
|
1884
|
-
|
|
1924
|
+
const API_KEY = "your-api-key";
|
|
1925
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
1885
1926
|
|
|
1886
|
-
|
|
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
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
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
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
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
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
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
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
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
|
-
|
|
2038
|
-
|
|
2089
|
+
pageSize: 10,
|
|
2090
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
2039
2091
|
};
|
|
2040
2092
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
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
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
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
|
-
|
|
2108
|
-
|
|
2159
|
+
const API_KEY = "your-api-key";
|
|
2160
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
2109
2161
|
|
|
2110
|
-
|
|
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
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
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
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
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
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
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
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
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
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
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
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
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
|
-
|
|
2281
|
-
|
|
2336
|
+
const API_KEY = "your-api-key";
|
|
2337
|
+
const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
2282
2338
|
|
|
2283
|
-
|
|
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
|
-
|
|
2376
|
+
name: "My Workspace"
|
|
2319
2377
|
};
|
|
2320
2378
|
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
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
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
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
|
-
|
|
2367
|
-
|
|
2426
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
2427
|
+
name: "My Workspace"
|
|
2368
2428
|
};
|
|
2369
2429
|
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
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
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
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
|
-
|
|
2417
|
-
|
|
2478
|
+
pageSize: 10,
|
|
2479
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
2418
2480
|
};
|
|
2419
2481
|
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
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
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
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
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
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
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
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
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
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
|
|