@fonoster/sdk 0.7.42 → 0.7.43
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 +75 -68
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -157,12 +157,13 @@ Constructs a new Acls object.
|
|
|
157
157
|
const SDK = require("@fonoster/sdk");
|
|
158
158
|
|
|
159
159
|
async function main(request) {
|
|
160
|
-
const
|
|
161
|
-
const
|
|
160
|
+
const apiKey = "your-api-key";
|
|
161
|
+
const apiSecret = "your-api-secret"
|
|
162
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
162
163
|
|
|
163
164
|
try {
|
|
164
|
-
const client = SDK.Client({ accessKeyId
|
|
165
|
-
await client.loginWithApiKey(
|
|
165
|
+
const client = SDK.Client({ accessKeyId });
|
|
166
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
166
167
|
|
|
167
168
|
const acls = new SDK.Acls(client);
|
|
168
169
|
const response = await acls.createAcl(request);
|
|
@@ -175,11 +176,10 @@ async function main(request) {
|
|
|
175
176
|
|
|
176
177
|
const request = {
|
|
177
178
|
name: "My ACL",
|
|
178
|
-
allow: ["47.132.130.31"]
|
|
179
|
-
deny: ["0.0.0.0/0"] // Deny all other IPs
|
|
179
|
+
allow: ["47.132.130.31"] // Allow only this IP
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
main(request)
|
|
182
|
+
main(request);
|
|
183
183
|
```
|
|
184
184
|
<a name="Acls+createAcl"></a>
|
|
185
185
|
|
|
@@ -194,7 +194,6 @@ Creates a new Acl in the Workspace.
|
|
|
194
194
|
| request | <code>CreateAclRequest</code> | The request object that contains the necessary information to create a new Acl |
|
|
195
195
|
| request.name | <code>string</code> | The name of the Acl |
|
|
196
196
|
| request.allow | <code>Array.<string></code> | The list of IPs to allow |
|
|
197
|
-
| request.deny | <code>Array.<string></code> | The list of IPs to deny |
|
|
198
197
|
|
|
199
198
|
**Example**
|
|
200
199
|
```js
|
|
@@ -202,8 +201,7 @@ const acls = new SDK.Acls(client); // Existing client object
|
|
|
202
201
|
|
|
203
202
|
const request = {
|
|
204
203
|
name: "My ACL",
|
|
205
|
-
allow: ["47.132.130.31"]
|
|
206
|
-
deny: ["0.0.0.0/0"] // Deny all other IPs
|
|
204
|
+
allow: ["47.132.130.31"] // Allow only this IP
|
|
207
205
|
};
|
|
208
206
|
|
|
209
207
|
acls
|
|
@@ -248,7 +246,6 @@ Updates an existing Acl in the Workspace.
|
|
|
248
246
|
| request.ref | <code>string</code> | The reference of the Acl to update |
|
|
249
247
|
| request.name | <code>string</code> | The name of the Acl |
|
|
250
248
|
| request.allow | <code>Array.<string></code> | The list of IPs to allow |
|
|
251
|
-
| request.deny | <code>Array.<string></code> | The list of IPs to deny |
|
|
252
249
|
|
|
253
250
|
**Example**
|
|
254
251
|
```js
|
|
@@ -258,7 +255,6 @@ const request = {
|
|
|
258
255
|
ref: "00000000-0000-0000-0000-000000000000",
|
|
259
256
|
name: "My ACL",
|
|
260
257
|
allow: ["47.132.130.31"] // Allow only this IP
|
|
261
|
-
deny: ["0.0.0.0/0"] // Deny all other IPs
|
|
262
258
|
};
|
|
263
259
|
|
|
264
260
|
acls
|
|
@@ -356,12 +352,13 @@ Constructs a new Agents object.
|
|
|
356
352
|
const SDK = require("@fonoster/sdk");
|
|
357
353
|
|
|
358
354
|
async function main(request) {
|
|
359
|
-
const
|
|
360
|
-
const
|
|
355
|
+
const apiKey = "your-api-key";
|
|
356
|
+
const apiSecret = "your-api-secret"
|
|
357
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
361
358
|
|
|
362
359
|
try {
|
|
363
|
-
const client = SDK.Client({ accessKeyId
|
|
364
|
-
await client.loginWithApiKey(
|
|
360
|
+
const client = SDK.Client({ accessKeyId });
|
|
361
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
365
362
|
|
|
366
363
|
const agents = new SDK.Agents(client);
|
|
367
364
|
const response = await agents.createAgent(request);
|
|
@@ -381,7 +378,7 @@ const request = {
|
|
|
381
378
|
domainRef: "00000000-0000-0000-0000-000000000000"
|
|
382
379
|
};
|
|
383
380
|
|
|
384
|
-
main(request)
|
|
381
|
+
main(request);
|
|
385
382
|
```
|
|
386
383
|
<a name="Agents+createAgent"></a>
|
|
387
384
|
|
|
@@ -567,12 +564,13 @@ Constructs a new ApiKeys object.
|
|
|
567
564
|
const SDK = require("@fonoster/sdk");
|
|
568
565
|
|
|
569
566
|
async function main(request) {
|
|
570
|
-
const
|
|
571
|
-
const
|
|
567
|
+
const apiKey = "your-api-key";
|
|
568
|
+
const apiSecret = "your-api-secret"
|
|
569
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
572
570
|
|
|
573
571
|
try {
|
|
574
|
-
const client = SDK.Client({ accessKeyId
|
|
575
|
-
await client.loginWithApiKey(apiKey);
|
|
572
|
+
const client = SDK.Client({ accessKeyId });
|
|
573
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
576
574
|
|
|
577
575
|
const apiKeys = new SDK.ApiKeys(client);
|
|
578
576
|
const response = await apiKeys.createApiKey(request);
|
|
@@ -587,7 +585,7 @@ const request = {
|
|
|
587
585
|
role: "WORKSPACE_ADMIN"
|
|
588
586
|
};
|
|
589
587
|
|
|
590
|
-
main(request)
|
|
588
|
+
main(request);
|
|
591
589
|
```
|
|
592
590
|
<a name="ApiKeys+createApiKey"></a>
|
|
593
591
|
|
|
@@ -729,12 +727,13 @@ Constructs a new Applications object.
|
|
|
729
727
|
const SDK = require("@fonoster/sdk");
|
|
730
728
|
|
|
731
729
|
async function main(request) {
|
|
732
|
-
const
|
|
733
|
-
const
|
|
730
|
+
const apiKey = "your-api-key";
|
|
731
|
+
const apiSecret = "your-api-secret"
|
|
732
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
734
733
|
|
|
735
734
|
try {
|
|
736
|
-
const client = SDK.Client({ accessKeyId
|
|
737
|
-
await client.loginWithApiKey(apiKey);
|
|
735
|
+
const client = SDK.Client({ accessKeyId });
|
|
736
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
738
737
|
|
|
739
738
|
const apps = new SDK.Applications(client);
|
|
740
739
|
const response = await apps.createApplication(request);
|
|
@@ -772,7 +771,7 @@ const request = {
|
|
|
772
771
|
}
|
|
773
772
|
};
|
|
774
773
|
|
|
775
|
-
main(request)
|
|
774
|
+
main(request);
|
|
776
775
|
```
|
|
777
776
|
<a name="Applications+createApplication"></a>
|
|
778
777
|
|
|
@@ -986,15 +985,16 @@ Constructs a new Calls object.
|
|
|
986
985
|
const SDK = require("@fonoster/sdk");
|
|
987
986
|
|
|
988
987
|
async function main(request) {
|
|
989
|
-
const
|
|
990
|
-
const
|
|
988
|
+
const apiKey = "your-api-key";
|
|
989
|
+
const apiSecret = "your-api-secret"
|
|
990
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
991
991
|
|
|
992
992
|
try {
|
|
993
|
-
const client = SDK.Client({ accessKeyId
|
|
994
|
-
await client.loginWithApiKey(apiKey);
|
|
993
|
+
const client = SDK.Client({ accessKeyId });
|
|
994
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
995
995
|
|
|
996
996
|
const calls = new SDK.Calls(client);
|
|
997
|
-
const response = await
|
|
997
|
+
const response = await calls.createCall(request);
|
|
998
998
|
|
|
999
999
|
console.log(response); // successful response
|
|
1000
1000
|
} catch (e) {
|
|
@@ -1008,7 +1008,7 @@ const request = {
|
|
|
1008
1008
|
appRef: "00000000-0000-0000-0000-000000000000"
|
|
1009
1009
|
};
|
|
1010
1010
|
|
|
1011
|
-
main(request)
|
|
1011
|
+
main(request);
|
|
1012
1012
|
```
|
|
1013
1013
|
<a name="Calls+createCall"></a>
|
|
1014
1014
|
|
|
@@ -1136,12 +1136,13 @@ Constructs a new Credentials object.
|
|
|
1136
1136
|
const SDK = require("@fonoster/sdk");
|
|
1137
1137
|
|
|
1138
1138
|
async function main(request) {
|
|
1139
|
-
const
|
|
1140
|
-
const
|
|
1139
|
+
const apiKey = "your-api-key";
|
|
1140
|
+
const apiSecret = "your-api-secret"
|
|
1141
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
1141
1142
|
|
|
1142
1143
|
try {
|
|
1143
|
-
const client = SDK.Client({ accessKeyId
|
|
1144
|
-
await client.loginWithApiKey(apiKey);
|
|
1144
|
+
const client = SDK.Client({ accessKeyId });
|
|
1145
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
1145
1146
|
|
|
1146
1147
|
const credentials = new SDK.Credentials(client);
|
|
1147
1148
|
const response = await apiKeys.createCredentials(request);
|
|
@@ -1158,7 +1159,7 @@ const request = {
|
|
|
1158
1159
|
password: "mysecret"
|
|
1159
1160
|
};
|
|
1160
1161
|
|
|
1161
|
-
main(request)
|
|
1162
|
+
main(request);
|
|
1162
1163
|
```
|
|
1163
1164
|
<a name="Credentials+createCredentials"></a>
|
|
1164
1165
|
|
|
@@ -1333,12 +1334,13 @@ Constructs a new Domains object.
|
|
|
1333
1334
|
const SDK = require("@fonoster/sdk");
|
|
1334
1335
|
|
|
1335
1336
|
async function main(request) {
|
|
1336
|
-
const
|
|
1337
|
-
const
|
|
1337
|
+
const apiKey = "your-api-key";
|
|
1338
|
+
const apiSecret = "your-api-secret"
|
|
1339
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
1338
1340
|
|
|
1339
1341
|
try {
|
|
1340
|
-
const client = SDK.Client({ accessKeyId
|
|
1341
|
-
await client.loginWithApiKey(apiKey);
|
|
1342
|
+
const client = SDK.Client({ accessKeyId });
|
|
1343
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
1342
1344
|
|
|
1343
1345
|
const domains = new SDK.Domains(client);
|
|
1344
1346
|
const response = await domains.createDomain(request);
|
|
@@ -1354,7 +1356,7 @@ const request = {
|
|
|
1354
1356
|
domainUri: "sip.project.fonoster.io"
|
|
1355
1357
|
};
|
|
1356
1358
|
|
|
1357
|
-
main(request)
|
|
1359
|
+
main(request);
|
|
1358
1360
|
```
|
|
1359
1361
|
<a name="Domains+createDomain"></a>
|
|
1360
1362
|
|
|
@@ -1534,12 +1536,13 @@ Constructs a new Numbers object.
|
|
|
1534
1536
|
const SDK = require("@fonoster/sdk");
|
|
1535
1537
|
|
|
1536
1538
|
async function main(request) {
|
|
1537
|
-
const
|
|
1538
|
-
const
|
|
1539
|
+
const apiKey = "your-api-key";
|
|
1540
|
+
const apiSecret = "your-api-secret"
|
|
1541
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
1539
1542
|
|
|
1540
1543
|
try {
|
|
1541
|
-
const client = SDK.Client({ accessKeyId
|
|
1542
|
-
await client.loginWithApiKey(apiKey);
|
|
1544
|
+
const client = SDK.Client({ accessKeyId });
|
|
1545
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
1543
1546
|
|
|
1544
1547
|
const numbers = new SDK.Numbers(client);
|
|
1545
1548
|
const response = await numbers.createNumber(request);
|
|
@@ -1558,7 +1561,7 @@ const request = {
|
|
|
1558
1561
|
countryIsoCode: "US"
|
|
1559
1562
|
};
|
|
1560
1563
|
|
|
1561
|
-
main(request)
|
|
1564
|
+
main(request);
|
|
1562
1565
|
```
|
|
1563
1566
|
<a name="Numbers+createNumber"></a>
|
|
1564
1567
|
|
|
@@ -1735,12 +1738,13 @@ Constructs a new Secrets object.
|
|
|
1735
1738
|
const SDK = require("@fonoster/sdk");
|
|
1736
1739
|
|
|
1737
1740
|
async function main(request) {
|
|
1738
|
-
const
|
|
1739
|
-
const
|
|
1741
|
+
const apiKey = "your-api-key";
|
|
1742
|
+
const apiSecret = "your-api-secret"
|
|
1743
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
1740
1744
|
|
|
1741
1745
|
try {
|
|
1742
|
-
const client = SDK.Client({ accessKeyId
|
|
1743
|
-
await client.loginWithApiKey(apiKey);
|
|
1746
|
+
const client = SDK.Client({ accessKeyId });
|
|
1747
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
1744
1748
|
|
|
1745
1749
|
const secrets = new SDK.Secrets(client);
|
|
1746
1750
|
const response = await secrets.creteSecret(request);
|
|
@@ -1756,7 +1760,7 @@ const request = {
|
|
|
1756
1760
|
secret: "mysecret"
|
|
1757
1761
|
};
|
|
1758
1762
|
|
|
1759
|
-
main(request)
|
|
1763
|
+
main(request);
|
|
1760
1764
|
```
|
|
1761
1765
|
<a name="Secrets+createSecret"></a>
|
|
1762
1766
|
|
|
@@ -1928,12 +1932,13 @@ Constructs a new Trunks object.
|
|
|
1928
1932
|
const SDK = require("@fonoster/sdk");
|
|
1929
1933
|
|
|
1930
1934
|
async function main(request) {
|
|
1931
|
-
const
|
|
1932
|
-
const
|
|
1935
|
+
const apiKey = "your-api-key";
|
|
1936
|
+
const apiSecret = "your-api-secret"
|
|
1937
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
1933
1938
|
|
|
1934
1939
|
try {
|
|
1935
|
-
const client = SDK.Client({ accessKeyId
|
|
1936
|
-
await client.loginWithApiKey(apiKey);
|
|
1940
|
+
const client = SDK.Client({ accessKeyId });
|
|
1941
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
1937
1942
|
|
|
1938
1943
|
const trunks = new SDK.Trunks(client);
|
|
1939
1944
|
const response = await trunks.createTrunk(request);
|
|
@@ -1949,7 +1954,7 @@ const request = {
|
|
|
1949
1954
|
inboundUri: "sip.company.fonoster.io"
|
|
1950
1955
|
};
|
|
1951
1956
|
|
|
1952
|
-
main(request)
|
|
1957
|
+
main(request);
|
|
1953
1958
|
```
|
|
1954
1959
|
<a name="Trunks+createTrunk"></a>
|
|
1955
1960
|
|
|
@@ -2163,12 +2168,13 @@ Constructs a new Users object.
|
|
|
2163
2168
|
const SDK = require("@fonoster/sdk");
|
|
2164
2169
|
|
|
2165
2170
|
async function main(request) {
|
|
2166
|
-
const
|
|
2167
|
-
const
|
|
2171
|
+
const apiKey = "your-api-key";
|
|
2172
|
+
const apiSecret = "your-api-secret"
|
|
2173
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
2168
2174
|
|
|
2169
2175
|
try {
|
|
2170
|
-
const client = SDK.Client({ accessKeyId
|
|
2171
|
-
await client.loginWithApiKey(apiKey);
|
|
2176
|
+
const client = SDK.Client({ accessKeyId });
|
|
2177
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
2172
2178
|
|
|
2173
2179
|
const users = new SDK.Users(client);
|
|
2174
2180
|
const response = await users.createUser(request);
|
|
@@ -2186,7 +2192,7 @@ const request = {
|
|
|
2186
2192
|
avatar: "https://example.com/avatar.jpg"
|
|
2187
2193
|
};
|
|
2188
2194
|
|
|
2189
|
-
main(request)
|
|
2195
|
+
main(request);
|
|
2190
2196
|
```
|
|
2191
2197
|
<a name="Users+createUser"></a>
|
|
2192
2198
|
|
|
@@ -2340,12 +2346,13 @@ Constructs a new Workspaces object.
|
|
|
2340
2346
|
const SDK = require("@fonoster/sdk");
|
|
2341
2347
|
|
|
2342
2348
|
async function main(request) {
|
|
2343
|
-
const
|
|
2344
|
-
const
|
|
2349
|
+
const apiKey = "your-api-key";
|
|
2350
|
+
const apiSecret = "your-api-secret"
|
|
2351
|
+
const accessKeyId = "WO00000000000000000000000000000000";
|
|
2345
2352
|
|
|
2346
2353
|
try {
|
|
2347
|
-
const client = SDK.Client({ accessKeyId
|
|
2348
|
-
await client.loginWithApiKey(apiKey);
|
|
2354
|
+
const client = SDK.Client({ accessKeyId });
|
|
2355
|
+
await client.loginWithApiKey(apiKey, apiSecret);
|
|
2349
2356
|
|
|
2350
2357
|
const workspaces = new SDK.Workspaces(client);
|
|
2351
2358
|
const response = await workspaces.createWorkspace(request);
|
|
@@ -2360,7 +2367,7 @@ const request = {
|
|
|
2360
2367
|
name: "My Workspace"
|
|
2361
2368
|
};
|
|
2362
2369
|
|
|
2363
|
-
main(request)
|
|
2370
|
+
main(request);
|
|
2364
2371
|
```
|
|
2365
2372
|
<a name="Workspaces+createWorkspace"></a>
|
|
2366
2373
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.43",
|
|
4
4
|
"description": "Web and Node.js SDK for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"fonoster"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@fonoster/common": "^0.7.
|
|
30
|
-
"@fonoster/types": "^0.7.
|
|
29
|
+
"@fonoster/common": "^0.7.43",
|
|
30
|
+
"@fonoster/types": "^0.7.43",
|
|
31
31
|
"@grpc/grpc-js": "~1.10.6",
|
|
32
32
|
"@grpc/proto-loader": "^0.7.12",
|
|
33
33
|
"google-protobuf": "^3.21.2",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"rollup": "^4.18.0",
|
|
63
63
|
"serve": "^14.2.3"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "b78418a8b177646715e56524c84200895646fb5e"
|
|
66
66
|
}
|