@fonoster/sdk 0.6.1 → 0.6.2
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 +2301 -169
- package/dist/node/Acls.d.ts +150 -0
- package/dist/node/Acls.js +227 -0
- package/dist/node/Agents.d.ts +163 -0
- package/dist/node/Agents.js +211 -0
- package/dist/node/ApiKeys.d.ts +120 -0
- package/dist/node/ApiKeys.js +178 -0
- package/dist/node/Applications.d.ts +31 -27
- package/dist/node/Applications.js +30 -26
- package/dist/node/Calls.d.ts +109 -0
- package/dist/node/Calls.js +165 -0
- package/dist/node/Credentials.d.ts +148 -0
- package/dist/node/Credentials.js +194 -0
- package/dist/node/Domains.d.ts +152 -0
- package/dist/node/Domains.js +198 -0
- package/dist/node/Numbers.d.ts +152 -0
- package/dist/node/Numbers.js +198 -0
- package/dist/node/Secrets.d.ts +144 -0
- package/dist/node/Secrets.js +190 -0
- package/dist/node/Trunks.d.ts +181 -0
- package/dist/node/Trunks.js +275 -0
- package/dist/node/Users.d.ts +132 -0
- package/dist/node/Users.js +169 -0
- package/dist/node/Workspaces.d.ts +195 -0
- package/dist/node/Workspaces.js +265 -0
- package/dist/node/client/AbstractClient.d.ts +16 -2
- package/dist/node/client/AbstractClient.js +0 -1
- package/dist/node/client/Client.d.ts +8 -0
- package/dist/node/client/Client.js +48 -0
- package/dist/node/client/types/AclsClient.d.ts +10 -0
- package/dist/node/client/types/AgentsClient.d.ts +10 -0
- package/dist/node/client/types/AgentsClient.js +2 -0
- package/dist/node/client/types/ApplicationsClient.d.ts +10 -0
- package/dist/node/client/types/ApplicationsClient.js +2 -0
- package/dist/node/client/types/CallsClient.d.ts +8 -0
- package/dist/node/client/types/CallsClient.js +2 -0
- package/dist/node/client/types/CredentialsClient.d.ts +10 -0
- package/dist/node/client/types/CredentialsClient.js +2 -0
- package/dist/node/client/types/DomainsClient.d.ts +10 -0
- package/dist/node/client/types/DomainsClient.js +2 -0
- package/dist/node/client/types/FonosterClient.d.ts +27 -0
- package/dist/node/client/types/FonosterClient.js +2 -0
- package/dist/node/client/types/IdentityClient.d.ts +24 -0
- package/dist/node/client/types/IdentityClient.js +2 -0
- package/dist/node/client/types/NumbersClient.d.ts +10 -0
- package/dist/node/client/types/NumbersClient.js +2 -0
- package/dist/node/client/types/SecretsClient.d.ts +10 -0
- package/dist/node/client/types/SecretsClient.js +2 -0
- package/dist/node/client/types/TrunksClient.d.ts +10 -0
- package/dist/node/client/types/TrunksClient.js +2 -0
- package/dist/node/client/types/common.d.ts +4 -0
- package/dist/node/client/types/common.js +2 -0
- package/dist/node/client/types/index.d.ts +6 -0
- package/dist/node/client/types/index.js +40 -0
- package/dist/node/generated/node/identity_pb.js +9 -9
- package/dist/node/generated/node/trunks_grpc_pb.js +8 -8
- package/dist/node/generated/node/trunks_pb.js +25 -25
- package/dist/node/generated/web/TrunksServiceClientPb.ts +5 -5
- package/dist/node/generated/web/identity_pb.d.ts +5 -5
- package/dist/node/generated/web/identity_pb.js +9 -9
- package/dist/node/generated/web/trunks_pb.d.ts +9 -9
- package/dist/node/generated/web/trunks_pb.js +25 -25
- package/dist/node/node.d.ts +11 -0
- package/dist/node/node.js +11 -0
- package/dist/node/tsconfig.node.tsbuildinfo +1 -1
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- package/package.json +3 -3
- package/dist/node/client/types.d.ts +0 -26
- /package/dist/node/client/{types.js → types/AclsClient.js} +0 -0
package/README.md
CHANGED
|
@@ -61,6 +61,8 @@ const accessKeyId = "WO00000000000000000000000000000000";
|
|
|
61
61
|
const client = new SDK.Client({ accessKeyId });
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
By default, the Client object will point to Fonoster's cloud services. If you are running your own instance of Fonoster, you can specify the `endpoint` parameter to point to it.
|
|
65
|
+
|
|
64
66
|
In the browser:
|
|
65
67
|
|
|
66
68
|
```typescript
|
|
@@ -69,45 +71,246 @@ const accessKeyId = "WO00000000000000000000000000000000";
|
|
|
69
71
|
const client = new SDK.WebClient({ accessKeyId });
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
By default, the WebClient object points to Fonoster's cloud services. If you are running your own instance of Fonoster, you can specify the `url` parameter to point to it.
|
|
75
|
+
|
|
76
|
+
### Login in and making requests
|
|
73
77
|
|
|
74
78
|
```typescript
|
|
75
79
|
const username = "admin@fonoster.local";
|
|
76
80
|
const password = "changeme";
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
.
|
|
80
|
-
.
|
|
82
|
+
async function main() {
|
|
83
|
+
await client.login(username, password);
|
|
84
|
+
const applications = new SDK.Applications(client);
|
|
85
|
+
await applications.createApplication({
|
|
86
|
+
name: "MyApp",
|
|
87
|
+
type: "PROGRAMMABLE_VOICE",
|
|
88
|
+
appEndpoint: "localhost:3000" // Your app's endpoint
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main().catch(console.error);
|
|
81
93
|
```
|
|
82
94
|
|
|
83
|
-
|
|
95
|
+
In addition to the `login` method, the SDK provides a `loginWithApiKey` and `loginWithRefreshToken` methods. The `loginWithRefreshToken` is helpful in browser environments where you want to keep the user logged in between sessions.
|
|
84
96
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
The SDK will automatically refresh the token when it expires.
|
|
98
|
+
|
|
99
|
+
## APIs
|
|
100
|
+
|
|
101
|
+
* [`Applications`](#Applications)
|
|
102
|
+
* [`Acls`](#Acls)
|
|
103
|
+
* [`Agents`](#Agents)
|
|
104
|
+
* [`ApiKeys`](#ApiKeys)
|
|
105
|
+
* [`Calls`](#Calls)
|
|
106
|
+
* [`Credentials`](#Credentials)
|
|
107
|
+
* [`Domains`](#Domains)
|
|
108
|
+
* [`Numbers`](#Numbers)
|
|
109
|
+
* [`Secrets`](#Secrets)
|
|
110
|
+
* [`Trunks`](#Trunks)
|
|
111
|
+
* [`Users`](#Users)
|
|
112
|
+
* [`Workspaces`](#Workspaces)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
<a name="Acls"></a>
|
|
116
|
+
|
|
117
|
+
## Acls
|
|
118
|
+
Fonoster Acls, part of the Fonoster SIP Proxy subsystem,
|
|
119
|
+
allows you to create, update, retrieve, and delete Access Control Lists (ACLs) rules for your deployment.
|
|
120
|
+
Note that an active Fonoster deployment is required.
|
|
121
|
+
|
|
122
|
+
**Kind**: global class
|
|
123
|
+
**See**
|
|
124
|
+
|
|
125
|
+
- AbstractClient
|
|
126
|
+
- FonosterClient
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
* [Acls](#Acls)
|
|
130
|
+
* [new Acls(client)](#new_Acls_new)
|
|
131
|
+
* [.createAcl(request)](#Acls+createAcl) ⇒ <code>Promise.<BaseApiObject></code>
|
|
132
|
+
* [.getAcl(ref)](#Acls+getAcl) ⇒ <code>Promise.<Acl></code>
|
|
133
|
+
* [.updateAcl(request)](#Acls+updateAcl) ⇒ <code>Promise.<BaseApiObject></code>
|
|
134
|
+
* [.listAcls(request)](#Acls+listAcls) ⇒ <code>Promise.<ListAclsResponse></code>
|
|
135
|
+
* [.deleteAcl(ref)](#Acls+deleteAcl) ⇒ <code>Promise.<BaseApiObject></code>
|
|
136
|
+
|
|
137
|
+
<a name="new_Acls_new"></a>
|
|
138
|
+
|
|
139
|
+
### new Acls(client)
|
|
140
|
+
Constructs a new Acls object.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
| Param | Type | Description |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
146
|
+
|
|
147
|
+
**Example**
|
|
148
|
+
```js
|
|
149
|
+
const SDK = require("@fonoster/sdk");
|
|
150
|
+
|
|
151
|
+
async function main(request) {
|
|
152
|
+
const apiKey = "your-api-key";
|
|
153
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
const client = SDK.Client({ accessKeyId });
|
|
157
|
+
await client.loginWithApiKey(apiKey);
|
|
158
|
+
|
|
159
|
+
const acls = new SDK.Acls(client);
|
|
160
|
+
const response = await acls.createAcl(request);
|
|
161
|
+
|
|
162
|
+
console.log(response); // successful response
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.error(e); // an error occurred
|
|
165
|
+
}
|
|
166
|
+
}
|
|
88
167
|
|
|
89
168
|
const request = {
|
|
90
|
-
name: "
|
|
91
|
-
|
|
92
|
-
|
|
169
|
+
name: "My ACL",
|
|
170
|
+
allow: ["47.132.130.31"], // Allow only this IP
|
|
171
|
+
deny: ["0.0.0.0/0"] // Deny all other IPs
|
|
93
172
|
};
|
|
94
173
|
|
|
95
|
-
|
|
96
|
-
.then(console.log)
|
|
97
|
-
.catch(console.error);
|
|
174
|
+
main(request).catch(console.error);
|
|
98
175
|
```
|
|
176
|
+
<a name="Acls+createAcl"></a>
|
|
99
177
|
|
|
100
|
-
|
|
178
|
+
### acls.createAcl(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
179
|
+
Creates a new Acl in the Workspace.
|
|
101
180
|
|
|
102
|
-
|
|
181
|
+
**Kind**: instance method of [<code>Acls</code>](#Acls)
|
|
182
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Acl
|
|
103
183
|
|
|
184
|
+
| Param | Type | Description |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
| request | <code>CreateAclRequest</code> | The request object that contains the necessary information to create a new Acl |
|
|
187
|
+
| request.name | <code>string</code> | The name of the Acl |
|
|
188
|
+
| request.allow | <code>Array.<string></code> | The list of IPs to allow |
|
|
189
|
+
| request.deny | <code>Array.<string></code> | The list of IPs to deny |
|
|
104
190
|
|
|
191
|
+
**Example**
|
|
192
|
+
```js
|
|
193
|
+
const request = {
|
|
194
|
+
name: "My ACL",
|
|
195
|
+
allow: ["47.132.130.31"], // Allow only this IP
|
|
196
|
+
deny: ["0.0.0.0/0"] // Deny all other IPs
|
|
197
|
+
};
|
|
105
198
|
|
|
106
|
-
|
|
199
|
+
const acls = new SDK.Acls(client); // Existing client object
|
|
107
200
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
201
|
+
acls.createAcl(request)
|
|
202
|
+
.then(console.log) // successful response
|
|
203
|
+
.catch(console.error); // an error occurred
|
|
204
|
+
```
|
|
205
|
+
<a name="Acls+getAcl"></a>
|
|
206
|
+
|
|
207
|
+
### acls.getAcl(ref) ⇒ <code>Promise.<Acl></code>
|
|
208
|
+
Retrieves an existing Acl in the Workspace.
|
|
209
|
+
|
|
210
|
+
**Kind**: instance method of [<code>Acls</code>](#Acls)
|
|
211
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Acl information
|
|
212
|
+
|
|
213
|
+
| Param | Type | Description |
|
|
214
|
+
| --- | --- | --- |
|
|
215
|
+
| ref | <code>string</code> | The reference of the Acl to retrieve |
|
|
216
|
+
|
|
217
|
+
**Example**
|
|
218
|
+
```js
|
|
219
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
220
|
+
|
|
221
|
+
const acls = new SDK.Acls(client); // Existing client object
|
|
222
|
+
|
|
223
|
+
acls.getAcl(ref)
|
|
224
|
+
.then(console.log) // successful response
|
|
225
|
+
.catch(console.error); // an error occurred
|
|
226
|
+
```
|
|
227
|
+
<a name="Acls+updateAcl"></a>
|
|
228
|
+
|
|
229
|
+
### acls.updateAcl(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
230
|
+
Updates an existing Acl in the Workspace.
|
|
231
|
+
|
|
232
|
+
**Kind**: instance method of [<code>Acls</code>](#Acls)
|
|
233
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Acl
|
|
234
|
+
|
|
235
|
+
| Param | Type | Description |
|
|
236
|
+
| --- | --- | --- |
|
|
237
|
+
| request | <code>UpdateAclRequest</code> | The request object that contains the necessary information to update an existing Acl |
|
|
238
|
+
| request.ref | <code>string</code> | The reference of the Acl to update |
|
|
239
|
+
| request.name | <code>string</code> | The name of the Acl |
|
|
240
|
+
| request.allow | <code>Array.<string></code> | The list of IPs to allow |
|
|
241
|
+
| request.deny | <code>Array.<string></code> | The list of IPs to deny |
|
|
242
|
+
|
|
243
|
+
**Example**
|
|
244
|
+
```js
|
|
245
|
+
const request = {
|
|
246
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
247
|
+
name: "My ACL",
|
|
248
|
+
allow: ["47.132.130.31"] // Allow only this IP
|
|
249
|
+
deny: ["0.0.0.0/0"] // Deny all other IPs
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const acls = new SDK.Acls(client); // Existing client object
|
|
253
|
+
|
|
254
|
+
acl.updateAcl(request)
|
|
255
|
+
.then(console.log) // successful response
|
|
256
|
+
.catch(console.error); // an error occurred
|
|
257
|
+
```
|
|
258
|
+
<a name="Acls+listAcls"></a>
|
|
259
|
+
|
|
260
|
+
### acls.listAcls(request) ⇒ <code>Promise.<ListAclsResponse></code>
|
|
261
|
+
Retrieves a list of Acls from a Workspace.
|
|
262
|
+
|
|
263
|
+
**Kind**: instance method of [<code>Acls</code>](#Acls)
|
|
264
|
+
**Returns**: <code>Promise.<ListAclsResponse></code> - - The response object that contains the list of Acls
|
|
265
|
+
|
|
266
|
+
| Param | Type | Description |
|
|
267
|
+
| --- | --- | --- |
|
|
268
|
+
| request | <code>ListAclsRequest</code> | The request object that contains the necessary information to retrieve a list of Acls |
|
|
269
|
+
| request.pageSize | <code>number</code> | The number of Acls to retrieve |
|
|
270
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Acls |
|
|
271
|
+
|
|
272
|
+
**Example**
|
|
273
|
+
```js
|
|
274
|
+
const request = {
|
|
275
|
+
pageSize: 10,
|
|
276
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const acls = new SDK.Acls(client); // Existing client object
|
|
280
|
+
|
|
281
|
+
acls.listAcls(request)
|
|
282
|
+
.then(console.log) // successful response
|
|
283
|
+
.catch(console.error); // an error occurred
|
|
284
|
+
```
|
|
285
|
+
<a name="Acls+deleteAcl"></a>
|
|
286
|
+
|
|
287
|
+
### acls.deleteAcl(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
288
|
+
Deletes an existing Acl from Fonoster.
|
|
289
|
+
Note that this operation is irreversible.
|
|
290
|
+
|
|
291
|
+
**Kind**: instance method of [<code>Acls</code>](#Acls)
|
|
292
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Acl
|
|
293
|
+
|
|
294
|
+
| Param | Type | Description |
|
|
295
|
+
| --- | --- | --- |
|
|
296
|
+
| ref | <code>string</code> | The reference of the Acl to delete |
|
|
297
|
+
|
|
298
|
+
**Example**
|
|
299
|
+
```js
|
|
300
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
301
|
+
|
|
302
|
+
const acls = new SDK.Acls(client); // Existing client object
|
|
303
|
+
|
|
304
|
+
acls.deleteAcl(ref)
|
|
305
|
+
.then(console.log) // successful response
|
|
306
|
+
.catch(console.error); // an error occurred
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
<a name="Agents"></a>
|
|
310
|
+
|
|
311
|
+
## Agents
|
|
312
|
+
Fonoster Agents, part of the Fonoster SIP Proxy subsystem,
|
|
313
|
+
allows you to create, update, retrieve, and delete SIP Agents for your deployment.
|
|
111
314
|
Note that an active Fonoster deployment is required.
|
|
112
315
|
|
|
113
316
|
**Kind**: global class
|
|
@@ -117,18 +320,18 @@ Note that an active Fonoster deployment is required.
|
|
|
117
320
|
- FonosterClient
|
|
118
321
|
|
|
119
322
|
|
|
120
|
-
* [
|
|
121
|
-
* [new
|
|
122
|
-
* [.
|
|
123
|
-
* [.
|
|
124
|
-
* [.
|
|
125
|
-
* [.
|
|
126
|
-
* [.
|
|
323
|
+
* [Agents](#Agents)
|
|
324
|
+
* [new Agents(client)](#new_Agents_new)
|
|
325
|
+
* [.createAgent(request)](#Agents+createAgent) ⇒ <code>Promise.<BaseApiObject></code>
|
|
326
|
+
* [.getAgent(ref)](#Agents+getAgent) ⇒ <code>Promise.<Acl></code>
|
|
327
|
+
* [.updateAgent(request)](#Agents+updateAgent) ⇒ <code>Promise.<BaseApiObject></code>
|
|
328
|
+
* [.listAgents(request)](#Agents+listAgents) ⇒ <code>Promise.<ListAgentsResponse></code>
|
|
329
|
+
* [.deleteAgent(ref)](#Agents+deleteAgent) ⇒ <code>Promise.<BaseApiObject></code>
|
|
127
330
|
|
|
128
|
-
<a name="
|
|
331
|
+
<a name="new_Agents_new"></a>
|
|
129
332
|
|
|
130
|
-
### new
|
|
131
|
-
Constructs a new
|
|
333
|
+
### new Agents(client)
|
|
334
|
+
Constructs a new Agents object.
|
|
132
335
|
|
|
133
336
|
|
|
134
337
|
| Param | Type | Description |
|
|
@@ -139,183 +342,139 @@ Constructs a new Applications object.
|
|
|
139
342
|
```js
|
|
140
343
|
const SDK = require("@fonoster/sdk");
|
|
141
344
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
appEndpoint: "myapp.mydomain.com",
|
|
146
|
-
textToSpeech: {
|
|
147
|
-
productRef: "tts.google",
|
|
148
|
-
config: {
|
|
149
|
-
voice: "en-US-Casual-K"
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
speechToText: {
|
|
153
|
-
productRef: "stt.google",
|
|
154
|
-
config: {
|
|
155
|
-
languageCode: "en-US"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
intelligence: {
|
|
159
|
-
productRef: "nlu.dialogflowcx",
|
|
160
|
-
credentials: {
|
|
161
|
-
apiKey: "your-api-key"
|
|
162
|
-
},
|
|
163
|
-
config: {
|
|
164
|
-
agentId: "your-agent-id"
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
345
|
+
async function main(request) {
|
|
346
|
+
const apiKey = "your-api-key";
|
|
347
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
168
348
|
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
349
|
+
try {
|
|
350
|
+
const client = SDK.Client({ accessKeyId });
|
|
351
|
+
await client.loginWithApiKey(apiKey);
|
|
172
352
|
|
|
173
|
-
const
|
|
353
|
+
const agents = new SDK.Agents(client);
|
|
354
|
+
const response = await agents.createAgent(request);
|
|
355
|
+
|
|
356
|
+
console.log(response); // successful response
|
|
357
|
+
} catch (e) {
|
|
358
|
+
console.error(e); // an error occurred
|
|
359
|
+
}
|
|
360
|
+
}
|
|
174
361
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
362
|
+
const request = {
|
|
363
|
+
name: "John Doe",
|
|
364
|
+
username: "1001",
|
|
365
|
+
privacy: "PRIVATE",
|
|
366
|
+
enabled: true,
|
|
367
|
+
maxContacts: 3
|
|
368
|
+
domainRef: "00000000-0000-0000-0000-000000000000"
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
main(request).catch(console.error);
|
|
181
372
|
```
|
|
182
|
-
<a name="
|
|
373
|
+
<a name="Agents+createAgent"></a>
|
|
183
374
|
|
|
184
|
-
###
|
|
185
|
-
Creates a new
|
|
375
|
+
### agents.createAgent(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
376
|
+
Creates a new Agent in the Workspace.
|
|
186
377
|
|
|
187
|
-
**Kind**: instance method of [<code>
|
|
188
|
-
**Returns**: <code>Promise.<
|
|
378
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
379
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Agent
|
|
189
380
|
|
|
190
381
|
| Param | Type | Description |
|
|
191
382
|
| --- | --- | --- |
|
|
192
|
-
| request | <code>
|
|
193
|
-
| request.name | <code>string</code> | The name of the
|
|
194
|
-
| request.
|
|
195
|
-
| request.
|
|
196
|
-
| request.
|
|
197
|
-
| request.
|
|
198
|
-
| request.
|
|
199
|
-
| request.speechToText | <code>SpeechToText</code> | The speech-to-text configuration |
|
|
200
|
-
| request.speechToText.productRef | <code>string</code> | The product reference of the speech-to-text engine (e.g., stt.google) |
|
|
201
|
-
| request.speechToText.config | <code>object</code> | The configuration object for the speech-to-text engine (e.g., { languageCode: "en-US" }) |
|
|
202
|
-
| request.intelligence | <code>Intelligence</code> | The intelligence configuration |
|
|
203
|
-
| request.intelligence.productRef | <code>string</code> | The product reference of the intelligence engine (e.g., nlu.dialogflowcx) |
|
|
204
|
-
| request.intelligence.credentials | <code>object</code> | The credentials object for the intelligence engine (e.g., { apiKey: "your-api-key" }) |
|
|
205
|
-
| request.intelligence.config | <code>object</code> | The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" }) |
|
|
383
|
+
| request | <code>CreateAgentRequest</code> | The request object that contains the necessary information to create a new Agent |
|
|
384
|
+
| request.name | <code>string</code> | The name of the Agent |
|
|
385
|
+
| request.username | <code>string</code> | The username of the Agent |
|
|
386
|
+
| request.privacy | <code>Privacy</code> | The privacy of the Agent |
|
|
387
|
+
| request.enabled | <code>boolean</code> | The status of the Agent |
|
|
388
|
+
| request.maxContacts | <code>number</code> | The maximum number of contacts the Agent can have |
|
|
389
|
+
| request.domainRef | <code>string</code> | The reference of the Domain to associate the Agent |
|
|
206
390
|
|
|
207
391
|
**Example**
|
|
208
392
|
```js
|
|
209
393
|
const request = {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
voice: "en-US-Casual-K"
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
speechToText: {
|
|
220
|
-
productRef: "stt.google",
|
|
221
|
-
config: {
|
|
222
|
-
languageCode: "en-US"
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
intelligence: {
|
|
226
|
-
productRef: "nlu.dialogflowcx",
|
|
227
|
-
credentials: {
|
|
228
|
-
apiKey: "your-api-key"
|
|
229
|
-
},
|
|
230
|
-
config: {
|
|
231
|
-
agentId: "your-agent-id"
|
|
232
|
-
}
|
|
233
|
-
}
|
|
394
|
+
name: "John Doe",
|
|
395
|
+
username: "1001",
|
|
396
|
+
privacy: "PRIVATE",
|
|
397
|
+
enabled: true,
|
|
398
|
+
maxContacts: 3
|
|
399
|
+
domainRef: "00000000-0000-0000-0000-000000000000"
|
|
234
400
|
};
|
|
235
401
|
|
|
236
|
-
const
|
|
402
|
+
const agents = new SDK.Agents(client); // Existing client object
|
|
237
403
|
|
|
238
|
-
|
|
404
|
+
agents.createAgent(request)
|
|
239
405
|
.then(console.log) // successful response
|
|
240
406
|
.catch(console.error); // an error occurred
|
|
241
407
|
```
|
|
242
|
-
<a name="
|
|
408
|
+
<a name="Agents+getAgent"></a>
|
|
243
409
|
|
|
244
|
-
###
|
|
245
|
-
Retrieves an existing
|
|
410
|
+
### agents.getAgent(ref) ⇒ <code>Promise.<Acl></code>
|
|
411
|
+
Retrieves an existing Agent in the Workspace.
|
|
246
412
|
|
|
247
|
-
**Kind**: instance method of [<code>
|
|
248
|
-
**Returns**: <code>Promise.<
|
|
413
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
414
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Agent information
|
|
249
415
|
|
|
250
416
|
| Param | Type | Description |
|
|
251
417
|
| --- | --- | --- |
|
|
252
|
-
|
|
|
253
|
-
| request.ref | <code>string</code> | The reference of the application to retrieve |
|
|
418
|
+
| ref | <code>string</code> | The reference of the Agent to retrieve |
|
|
254
419
|
|
|
255
420
|
**Example**
|
|
256
421
|
```js
|
|
257
|
-
const
|
|
258
|
-
ref: "00000000-0000-0000-0000-000000000000"
|
|
259
|
-
};
|
|
422
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
260
423
|
|
|
261
|
-
const
|
|
424
|
+
const agents = new SDK.Agents(client); // Existing client object
|
|
262
425
|
|
|
263
|
-
|
|
426
|
+
agents.getAgent(ref)
|
|
264
427
|
.then(console.log) // successful response
|
|
265
428
|
.catch(console.error); // an error occurred
|
|
266
429
|
```
|
|
267
|
-
<a name="
|
|
430
|
+
<a name="Agents+updateAgent"></a>
|
|
268
431
|
|
|
269
|
-
###
|
|
270
|
-
Updates an existing
|
|
432
|
+
### agents.updateAgent(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
433
|
+
Updates an existing Agent in the Workspace.
|
|
271
434
|
|
|
272
|
-
**Kind**: instance method of [<code>
|
|
273
|
-
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated
|
|
435
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
436
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Agent
|
|
274
437
|
|
|
275
438
|
| Param | Type | Description |
|
|
276
439
|
| --- | --- | --- |
|
|
277
|
-
| request | <code>
|
|
278
|
-
| request.ref | <code>string</code> | The reference of the
|
|
279
|
-
| request.name | <code>string</code> | The name of the
|
|
280
|
-
| request.
|
|
281
|
-
| request.
|
|
282
|
-
| request.
|
|
283
|
-
| request.
|
|
284
|
-
| request.speechToText | <code>SpeechToText</code> | The speech-to-text configuration |
|
|
285
|
-
| request.speechToText.productRef | <code>string</code> | The product reference of the speech-to-text engine (e.g., stt.google) |
|
|
286
|
-
| request.speechToText.config | <code>object</code> | The configuration object for the speech-to-text engine (e.g., { languageCode: "en-US" }) |
|
|
287
|
-
| request.intelligence | <code>Intelligence</code> | The intelligence configuration |
|
|
288
|
-
| request.intelligence.productRef | <code>string</code> | The product reference of the intelligence engine (e.g., nlu.dialogflowcx) |
|
|
289
|
-
| request.intelligence.credentials | <code>object</code> | The credentials object for the intelligence engine (e.g., { apiKey: "your-api-key" }) |
|
|
290
|
-
| request.intelligence.config | <code>object</code> | The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" }) |
|
|
440
|
+
| request | <code>UpdateAgentRequest</code> | The request object that contains the necessary information to update an existing Agent |
|
|
441
|
+
| request.ref | <code>string</code> | The reference of the Agent to update |
|
|
442
|
+
| request.name | <code>string</code> | The name of the Agent |
|
|
443
|
+
| request.privacy | <code>Privacy</code> | The privacy of the Agent |
|
|
444
|
+
| request.enabled | <code>boolean</code> | The status of the Agent |
|
|
445
|
+
| request.maxContacts | <code>number</code> | The maximum number of contacts the Agent can have |
|
|
446
|
+
| request.domainRef | <code>string</code> | The reference of the Domain to associate the Agent |
|
|
291
447
|
|
|
292
448
|
**Example**
|
|
293
449
|
```js
|
|
294
450
|
const request = {
|
|
295
451
|
ref: "00000000-0000-0000-0000-000000000000",
|
|
296
|
-
name: "
|
|
297
|
-
|
|
298
|
-
|
|
452
|
+
name: "John Doe",
|
|
453
|
+
privacy: "PRIVATE",
|
|
454
|
+
enabled: true,
|
|
455
|
+
maxContacts: 3
|
|
456
|
+
domainRef: "00000000-0000-0000-0000-000000000000"
|
|
457
|
+
};
|
|
299
458
|
|
|
300
|
-
const
|
|
459
|
+
const agents = new SDK.Agents(client); // Existing client object
|
|
301
460
|
|
|
302
|
-
|
|
461
|
+
agents.updateAgent(request)
|
|
303
462
|
.then(console.log) // successful response
|
|
304
463
|
.catch(console.error); // an error occurred
|
|
305
464
|
```
|
|
306
|
-
<a name="
|
|
465
|
+
<a name="Agents+listAgents"></a>
|
|
307
466
|
|
|
308
|
-
###
|
|
309
|
-
Retrieves a list of
|
|
467
|
+
### agents.listAgents(request) ⇒ <code>Promise.<ListAgentsResponse></code>
|
|
468
|
+
Retrieves a list of Agents from a Workspace.
|
|
310
469
|
|
|
311
|
-
**Kind**: instance method of [<code>
|
|
312
|
-
**Returns**: <code>Promise.<
|
|
470
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
471
|
+
**Returns**: <code>Promise.<ListAgentsResponse></code> - - The response object that contains the list of Agents
|
|
313
472
|
|
|
314
473
|
| Param | Type | Description |
|
|
315
474
|
| --- | --- | --- |
|
|
316
|
-
| request | <code>
|
|
317
|
-
| request.pageSize | <code>number</code> | The number of
|
|
318
|
-
| request.pageToken | <code>string</code> | The token to retrieve the next page of
|
|
475
|
+
| request | <code>ListAgentsRequest</code> | The request object that contains the necessary information to retrieve a list of Agents |
|
|
476
|
+
| request.pageSize | <code>number</code> | The number of Agents to retrieve |
|
|
477
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Agents |
|
|
319
478
|
|
|
320
479
|
**Example**
|
|
321
480
|
```js
|
|
@@ -324,35 +483,2008 @@ const request = {
|
|
|
324
483
|
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
325
484
|
};
|
|
326
485
|
|
|
327
|
-
const
|
|
486
|
+
const agents = new SDK.Agents(client); // Existing client object
|
|
328
487
|
|
|
329
|
-
|
|
488
|
+
agents.listAgents(request)
|
|
330
489
|
.then(console.log) // successful response
|
|
331
490
|
.catch(console.error); // an error occurred
|
|
332
491
|
```
|
|
333
|
-
<a name="
|
|
492
|
+
<a name="Agents+deleteAgent"></a>
|
|
334
493
|
|
|
335
|
-
###
|
|
336
|
-
Deletes an existing
|
|
494
|
+
### agents.deleteAgent(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
495
|
+
Deletes an existing Agent from Fonoster.
|
|
337
496
|
Note that this operation is irreversible.
|
|
338
497
|
|
|
339
|
-
**Kind**: instance method of [<code>
|
|
340
|
-
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted
|
|
498
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
499
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Agent
|
|
341
500
|
|
|
342
501
|
| Param | Type | Description |
|
|
343
502
|
| --- | --- | --- |
|
|
344
|
-
|
|
|
345
|
-
| request.ref | <code>string</code> | The reference of the application to delete |
|
|
503
|
+
| ref | <code>string</code> | The reference of the Agent to delete |
|
|
346
504
|
|
|
347
505
|
**Example**
|
|
348
506
|
```js
|
|
349
|
-
const
|
|
350
|
-
ref: "00000000-0000-0000-0000-000000000000"
|
|
351
|
-
};
|
|
507
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
352
508
|
|
|
353
|
-
const
|
|
509
|
+
const agents = new SDK.Agents(client); // Existing client object
|
|
510
|
+
|
|
511
|
+
agents.deleteAgent(ref)
|
|
512
|
+
.then(console.log) // successful response
|
|
513
|
+
.catch(console.error); // an error occurred
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
<a name="ApiKeys"></a>
|
|
517
|
+
|
|
518
|
+
## ApiKeys
|
|
519
|
+
Fonoster ApiKeys, part of the Fonoster Identity subsystem,
|
|
520
|
+
allows you to create, update, retrieve, and delete ApiKeys for your deployment.
|
|
521
|
+
Note that an active Fonoster deployment is required.
|
|
522
|
+
|
|
523
|
+
**Kind**: global class
|
|
524
|
+
**See**
|
|
525
|
+
|
|
526
|
+
- AbstractClient
|
|
527
|
+
- FonosterClient
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
* [ApiKeys](#ApiKeys)
|
|
531
|
+
* [new ApiKeys(client)](#new_ApiKeys_new)
|
|
532
|
+
* [.createApiKey(request)](#ApiKeys+createApiKey) ⇒ <code>Promise.<CreateApiKeyResponse></code>
|
|
533
|
+
* [.regenerateApiKey(ref)](#ApiKeys+regenerateApiKey) ⇒ <code>Promise.<CreateApiKeyResponse></code>
|
|
534
|
+
* [.listApiKeys(request)](#ApiKeys+listApiKeys) ⇒ <code>Promise.<ListApiKeysResponse></code>
|
|
535
|
+
* [.deleteApiKey(ref)](#ApiKeys+deleteApiKey) ⇒ <code>Promise.<BaseApiObject></code>
|
|
536
|
+
|
|
537
|
+
<a name="new_ApiKeys_new"></a>
|
|
538
|
+
|
|
539
|
+
### new ApiKeys(client)
|
|
540
|
+
Constructs a new ApiKeys object.
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
| Param | Type | Description |
|
|
544
|
+
| --- | --- | --- |
|
|
545
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
546
|
+
|
|
547
|
+
**Example**
|
|
548
|
+
```js
|
|
549
|
+
const SDK = require("@fonoster/sdk");
|
|
550
|
+
|
|
551
|
+
async function main(request) {
|
|
552
|
+
const apiKey = "your-api-key";
|
|
553
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
554
|
+
|
|
555
|
+
try {
|
|
556
|
+
const client = SDK.Client({ accessKeyId });
|
|
557
|
+
await client.loginWithApiKey(apiKey);
|
|
558
|
+
|
|
559
|
+
const apiKeys = new SDK.ApiKeys(client);
|
|
560
|
+
const response = await apiKeys.createApiKey(request);
|
|
561
|
+
|
|
562
|
+
console.log(response); // successful response
|
|
563
|
+
} catch (e) {
|
|
564
|
+
console.error(e); // an error occurred
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
const request = {
|
|
569
|
+
role: "WORKSPACE_ADMIN"
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
main(request).catch(console.error);
|
|
573
|
+
```
|
|
574
|
+
<a name="ApiKeys+createApiKey"></a>
|
|
575
|
+
|
|
576
|
+
### apiKeys.createApiKey(request) ⇒ <code>Promise.<CreateApiKeyResponse></code>
|
|
577
|
+
Creates a new ApiKey for a Workspace.
|
|
578
|
+
|
|
579
|
+
**Kind**: instance method of [<code>ApiKeys</code>](#ApiKeys)
|
|
580
|
+
**Returns**: <code>Promise.<CreateApiKeyResponse></code> - - The response object that contains the reference to the created ApiKey
|
|
581
|
+
|
|
582
|
+
| Param | Type | Description |
|
|
583
|
+
| --- | --- | --- |
|
|
584
|
+
| request | <code>CreateApiKeyRequest</code> | The request object that contains the necessary information to create a new ApiKey |
|
|
585
|
+
| request.role | <code>ApiRoleEnum</code> | The role of the ApiKey |
|
|
586
|
+
|
|
587
|
+
**Example**
|
|
588
|
+
```js
|
|
589
|
+
const request = {
|
|
590
|
+
role: "WORKSPACE_ADMIN"
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
594
|
+
|
|
595
|
+
apiKeys.createApiKey(request)
|
|
596
|
+
.then(console.log) // successful response
|
|
597
|
+
.catch(console.error); // an error occurred
|
|
598
|
+
```
|
|
599
|
+
<a name="ApiKeys+regenerateApiKey"></a>
|
|
600
|
+
|
|
601
|
+
### apiKeys.regenerateApiKey(ref) ⇒ <code>Promise.<CreateApiKeyResponse></code>
|
|
602
|
+
Regenerates an existing ApiKey for a Workspace.
|
|
603
|
+
Note that this operation is irreversible.
|
|
604
|
+
|
|
605
|
+
**Kind**: instance method of [<code>ApiKeys</code>](#ApiKeys)
|
|
606
|
+
**Returns**: <code>Promise.<CreateApiKeyResponse></code> - - The response object that contains the reference to the regenerated ApiKey
|
|
607
|
+
|
|
608
|
+
| Param | Type | Description |
|
|
609
|
+
| --- | --- | --- |
|
|
610
|
+
| ref | <code>string</code> | The reference of the ApiKey to regenerate |
|
|
611
|
+
|
|
612
|
+
**Example**
|
|
613
|
+
```js
|
|
614
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
615
|
+
|
|
616
|
+
const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
617
|
+
|
|
618
|
+
apiKeys.regenerateApiKey(ref)
|
|
619
|
+
.then(console.log) // successful response
|
|
620
|
+
.catch(console.error); // an error occurred
|
|
621
|
+
```
|
|
622
|
+
<a name="ApiKeys+listApiKeys"></a>
|
|
623
|
+
|
|
624
|
+
### apiKeys.listApiKeys(request) ⇒ <code>Promise.<ListApiKeysResponse></code>
|
|
625
|
+
Retrieves a list of ApiKeys from a Workspace.
|
|
626
|
+
|
|
627
|
+
**Kind**: instance method of [<code>ApiKeys</code>](#ApiKeys)
|
|
628
|
+
**Returns**: <code>Promise.<ListApiKeysResponse></code> - - The response object that contains the list of ApiKeys
|
|
629
|
+
|
|
630
|
+
| Param | Type | Description |
|
|
631
|
+
| --- | --- | --- |
|
|
632
|
+
| request | <code>ListApiKeysRequest</code> | The request object that contains the necessary information to retrieve a list of ApiKeys |
|
|
633
|
+
| request.pageSize | <code>number</code> | The number of ApiKeys to retrieve |
|
|
634
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of ApiKeys |
|
|
635
|
+
|
|
636
|
+
**Example**
|
|
637
|
+
```js
|
|
638
|
+
const request = {
|
|
639
|
+
pageSize: 10,
|
|
640
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
644
|
+
|
|
645
|
+
apiKeys.listApiKeys(request)
|
|
646
|
+
.then(console.log) // successful response
|
|
647
|
+
.catch(console.error); // an error occurred
|
|
648
|
+
```
|
|
649
|
+
<a name="ApiKeys+deleteApiKey"></a>
|
|
650
|
+
|
|
651
|
+
### apiKeys.deleteApiKey(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
652
|
+
Deletes an existing ApiKey from Fonoster.
|
|
653
|
+
Note that this operation is irreversible.
|
|
654
|
+
|
|
655
|
+
**Kind**: instance method of [<code>ApiKeys</code>](#ApiKeys)
|
|
656
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted ApiKey
|
|
657
|
+
|
|
658
|
+
| Param | Type | Description |
|
|
659
|
+
| --- | --- | --- |
|
|
660
|
+
| ref | <code>string</code> | The reference of the ApiKey to delete |
|
|
661
|
+
|
|
662
|
+
**Example**
|
|
663
|
+
```js
|
|
664
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
665
|
+
|
|
666
|
+
const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
667
|
+
|
|
668
|
+
apiKeys.deleteApiKey(ref)
|
|
669
|
+
.then(console.log) // successful response
|
|
670
|
+
.catch(console.error); // an error occurred
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
<a name="Applications"></a>
|
|
674
|
+
|
|
675
|
+
## Applications
|
|
676
|
+
Fonoster Applications, part of the Fonoster Voice Subsystem,
|
|
677
|
+
allow you to create, update, retrieve, and delete Voice Applications.
|
|
678
|
+
Note that an active Fonoster deployment is required.
|
|
679
|
+
|
|
680
|
+
**Kind**: global class
|
|
681
|
+
**See**
|
|
682
|
+
|
|
683
|
+
- AbstractClient
|
|
684
|
+
- FonosterClient
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
* [Applications](#Applications)
|
|
688
|
+
* [new Applications(client)](#new_Applications_new)
|
|
689
|
+
* [.createApplication(request)](#Applications+createApplication) ⇒ <code>Promise.<CreateAppResponse></code>
|
|
690
|
+
* [.getApplication(ref)](#Applications+getApplication) ⇒ <code>Promise.<Application></code>
|
|
691
|
+
* [.updateApplication(request)](#Applications+updateApplication) ⇒ <code>Promise.<BaseApiObject></code>
|
|
692
|
+
* [.listApplications(request)](#Applications+listApplications) ⇒ <code>Promise.<ListApplicationsResponse></code>
|
|
693
|
+
* [.deleteApplication(ref)](#Applications+deleteApplication) ⇒ <code>Promise.<BaseApiObject></code>
|
|
694
|
+
|
|
695
|
+
<a name="new_Applications_new"></a>
|
|
696
|
+
|
|
697
|
+
### new Applications(client)
|
|
698
|
+
Constructs a new Applications object.
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
| Param | Type | Description |
|
|
702
|
+
| --- | --- | --- |
|
|
703
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
704
|
+
|
|
705
|
+
**Example**
|
|
706
|
+
```js
|
|
707
|
+
const SDK = require("@fonoster/sdk");
|
|
708
|
+
|
|
709
|
+
async function main(request) {
|
|
710
|
+
const apiKey = "your-api-key";
|
|
711
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
712
|
+
|
|
713
|
+
try {
|
|
714
|
+
const client = SDK.Client({ accessKeyId });
|
|
715
|
+
await client.loginWithApiKey(apiKey);
|
|
716
|
+
|
|
717
|
+
const apps = new SDK.Applications(client);
|
|
718
|
+
const response = await apps.createApplication(request);
|
|
719
|
+
|
|
720
|
+
console.log(response); // successful response
|
|
721
|
+
} catch (e) {
|
|
722
|
+
console.error(e); // an error occurred
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const request = {
|
|
727
|
+
name: "My application",
|
|
728
|
+
type: "PROGRAMMABLE_VOICE",
|
|
729
|
+
appEndpoint: "myapp.mydomain.com",
|
|
730
|
+
textToSpeech: {
|
|
731
|
+
productRef: "tts.google",
|
|
732
|
+
config: {
|
|
733
|
+
voice: "en-US-Casual-K"
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
speechToText: {
|
|
737
|
+
productRef: "stt.google",
|
|
738
|
+
config: {
|
|
739
|
+
languageCode: "en-US"
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
intelligence: {
|
|
743
|
+
productRef: "nlu.dialogflowcx",
|
|
744
|
+
credentials: {
|
|
745
|
+
apiKey: "your-api-key"
|
|
746
|
+
},
|
|
747
|
+
config: {
|
|
748
|
+
agentId: "your-agent-id"
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
main(request).catch(console.error);
|
|
754
|
+
```
|
|
755
|
+
<a name="Applications+createApplication"></a>
|
|
756
|
+
|
|
757
|
+
### applications.createApplication(request) ⇒ <code>Promise.<CreateAppResponse></code>
|
|
758
|
+
Creates a new Application in Fonoster. The only required fields are the name and type of the application.
|
|
759
|
+
|
|
760
|
+
**Kind**: instance method of [<code>Applications</code>](#Applications)
|
|
761
|
+
**Returns**: <code>Promise.<CreateAppResponse></code> - - The response object that contains the reference to the newly created application
|
|
762
|
+
|
|
763
|
+
| Param | Type | Description |
|
|
764
|
+
| --- | --- | --- |
|
|
765
|
+
| request | <code>CreateApplicationRequest</code> | The request object that contains the necessary information to create a new application |
|
|
766
|
+
| request.name | <code>string</code> | The name of the application |
|
|
767
|
+
| request.type | <code>ApplicationType</code> | The type of application (e.g., PROGRAMMABLE_VOICE) |
|
|
768
|
+
| request.appEndpoint | <code>string</code> | The endpoint where the application is hosted |
|
|
769
|
+
| request.textToSpeech | <code>TextToSpeech</code> | The text-to-speech configuration |
|
|
770
|
+
| request.textToSpeech.productRef | <code>string</code> | The product reference of the text-to-speech engine (e.g., tts.google) |
|
|
771
|
+
| request.textToSpeech.config | <code>object</code> | The configuration object for the text-to-speech engine (e.g., { voice: "en-US-Casual-K" }) |
|
|
772
|
+
| request.speechToText | <code>SpeechToText</code> | The speech-to-text configuration |
|
|
773
|
+
| request.speechToText.productRef | <code>string</code> | The product reference of the speech-to-text engine (e.g., stt.google) |
|
|
774
|
+
| request.speechToText.config | <code>object</code> | The configuration object for the speech-to-text engine (e.g., { languageCode: "en-US" }) |
|
|
775
|
+
| request.intelligence | <code>Intelligence</code> | The intelligence configuration |
|
|
776
|
+
| request.intelligence.productRef | <code>string</code> | The product reference of the intelligence engine (e.g., nlu.dialogflowcx) |
|
|
777
|
+
| request.intelligence.credentials | <code>object</code> | The credentials object for the intelligence engine (e.g., { apiKey: "your-api-key" }) |
|
|
778
|
+
| request.intelligence.config | <code>object</code> | The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" }) |
|
|
779
|
+
|
|
780
|
+
**Example**
|
|
781
|
+
```js
|
|
782
|
+
const request = {
|
|
783
|
+
name: "My application",
|
|
784
|
+
type: "PROGRAMMABLE_VOICE",
|
|
785
|
+
appEndpoint: "myapp.mydomain.com",
|
|
786
|
+
textToSpeech: {
|
|
787
|
+
productRef: "tts.google",
|
|
788
|
+
config: {
|
|
789
|
+
voice: "en-US-Casual-K"
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
speechToText: {
|
|
793
|
+
productRef: "stt.google",
|
|
794
|
+
config: {
|
|
795
|
+
languageCode: "en-US"
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
intelligence: {
|
|
799
|
+
productRef: "nlu.dialogflowcx",
|
|
800
|
+
credentials: {
|
|
801
|
+
apiKey: "your-api-key"
|
|
802
|
+
},
|
|
803
|
+
config: {
|
|
804
|
+
agentId: "your-agent-id"
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
const apps = new SDK.Applications(client); // Existing client object
|
|
810
|
+
|
|
811
|
+
apps.createApplication(request)
|
|
812
|
+
.then(console.log) // successful response
|
|
813
|
+
.catch(console.error); // an error occurred
|
|
814
|
+
```
|
|
815
|
+
<a name="Applications+getApplication"></a>
|
|
816
|
+
|
|
817
|
+
### applications.getApplication(ref) ⇒ <code>Promise.<Application></code>
|
|
818
|
+
Retrieves an existing Application in the Workspace.
|
|
819
|
+
|
|
820
|
+
**Kind**: instance method of [<code>Applications</code>](#Applications)
|
|
821
|
+
**Returns**: <code>Promise.<Application></code> - - The response object that contains the Application information
|
|
822
|
+
|
|
823
|
+
| Param | Type | Description |
|
|
824
|
+
| --- | --- | --- |
|
|
825
|
+
| ref | <code>string</code> | The reference of the Application to retrieve |
|
|
826
|
+
|
|
827
|
+
**Example**
|
|
828
|
+
```js
|
|
829
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
830
|
+
|
|
831
|
+
const apps = new SDK.Applications(client); // Existing client object
|
|
832
|
+
|
|
833
|
+
apps.getApplication(ref)
|
|
834
|
+
.then(console.log) // successful response
|
|
835
|
+
.catch(console.error); // an error occurred
|
|
836
|
+
```
|
|
837
|
+
<a name="Applications+updateApplication"></a>
|
|
838
|
+
|
|
839
|
+
### applications.updateApplication(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
840
|
+
Updates an existing application in Fonoster.
|
|
841
|
+
|
|
842
|
+
**Kind**: instance method of [<code>Applications</code>](#Applications)
|
|
843
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated application
|
|
844
|
+
|
|
845
|
+
| Param | Type | Description |
|
|
846
|
+
| --- | --- | --- |
|
|
847
|
+
| request | <code>UpdateApplicationRequest</code> | The request object that contains the necessary information to update an application |
|
|
848
|
+
| request.ref | <code>string</code> | The reference of the application to update |
|
|
849
|
+
| request.name | <code>string</code> | The name of the application |
|
|
850
|
+
| request.appEndpoint | <code>string</code> | The endpoint where the application is hosted |
|
|
851
|
+
| request.textToSpeech | <code>TextToSpeech</code> | The text-to-speech configuration |
|
|
852
|
+
| request.textToSpeech.productRef | <code>string</code> | The product reference of the text-to-speech engine (e.g., tts.google) |
|
|
853
|
+
| request.textToSpeech.config | <code>object</code> | The configuration object for the text-to-speech engine (e.g., { voice: "en-US-Casual-K" }) |
|
|
854
|
+
| request.speechToText | <code>SpeechToText</code> | The speech-to-text configuration |
|
|
855
|
+
| request.speechToText.productRef | <code>string</code> | The product reference of the speech-to-text engine (e.g., stt.google) |
|
|
856
|
+
| request.speechToText.config | <code>object</code> | The configuration object for the speech-to-text engine (e.g., { languageCode: "en-US" }) |
|
|
857
|
+
| request.intelligence | <code>Intelligence</code> | The intelligence configuration |
|
|
858
|
+
| request.intelligence.productRef | <code>string</code> | The product reference of the intelligence engine (e.g., nlu.dialogflowcx) |
|
|
859
|
+
| request.intelligence.credentials | <code>object</code> | The credentials object for the intelligence engine (e.g., { apiKey: "your-api-key" }) |
|
|
860
|
+
| request.intelligence.config | <code>object</code> | The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" }) |
|
|
861
|
+
|
|
862
|
+
**Example**
|
|
863
|
+
```js
|
|
864
|
+
const request = {
|
|
865
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
866
|
+
name: "My application",
|
|
867
|
+
appEndpoint: "myapp.mydomain.com"
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
const apps = new SDK.Applications(client); // Existing client object
|
|
871
|
+
|
|
872
|
+
apps.updateApplication(request)
|
|
873
|
+
.then(console.log) // successful response
|
|
874
|
+
.catch(console.error); // an error occurred
|
|
875
|
+
```
|
|
876
|
+
<a name="Applications+listApplications"></a>
|
|
877
|
+
|
|
878
|
+
### applications.listApplications(request) ⇒ <code>Promise.<ListApplicationsResponse></code>
|
|
879
|
+
Retrieves a list of Applications from Fonoster.
|
|
880
|
+
|
|
881
|
+
**Kind**: instance method of [<code>Applications</code>](#Applications)
|
|
882
|
+
**Returns**: <code>Promise.<ListApplicationsResponse></code> - - The response object that contains the list of Applications
|
|
883
|
+
|
|
884
|
+
| Param | Type | Description |
|
|
885
|
+
| --- | --- | --- |
|
|
886
|
+
| request | <code>ListApplicationsRequest</code> | The request object that contains the necessary information to retrieve a list of Applications |
|
|
887
|
+
| request.pageSize | <code>number</code> | The number of Applications to retrieve |
|
|
888
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Applications |
|
|
889
|
+
|
|
890
|
+
**Example**
|
|
891
|
+
```js
|
|
892
|
+
const request = {
|
|
893
|
+
pageSize: 10,
|
|
894
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
const apps = new SDK.Applications(client); // Existing client object
|
|
898
|
+
|
|
899
|
+
apps.listApplications(request)
|
|
900
|
+
.then(console.log) // successful response
|
|
901
|
+
.catch(console.error); // an error occurred
|
|
902
|
+
```
|
|
903
|
+
<a name="Applications+deleteApplication"></a>
|
|
904
|
+
|
|
905
|
+
### applications.deleteApplication(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
906
|
+
Deletes an existing Application from Fonoster.
|
|
907
|
+
Note that this operation is irreversible.
|
|
908
|
+
|
|
909
|
+
**Kind**: instance method of [<code>Applications</code>](#Applications)
|
|
910
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted application
|
|
911
|
+
|
|
912
|
+
| Param | Type | Description |
|
|
913
|
+
| --- | --- | --- |
|
|
914
|
+
| ref | <code>string</code> | The reference of the Application to delete |
|
|
915
|
+
|
|
916
|
+
**Example**
|
|
917
|
+
```js
|
|
918
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
919
|
+
|
|
920
|
+
const apps = new SDK.Applications(client); // Existing client object
|
|
921
|
+
|
|
922
|
+
apps.deleteApplication(ref)
|
|
923
|
+
.then(console.log) // successful response
|
|
924
|
+
.catch(console.error); // an error occurred
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
<a name="Calls"></a>
|
|
928
|
+
|
|
929
|
+
## Calls
|
|
930
|
+
Fonoster Calls, part of the Fonoster Media subsystem,
|
|
931
|
+
allows you to create, list, and track calls in your deployment.
|
|
932
|
+
Note that an active Fonoster deployment is required.
|
|
933
|
+
|
|
934
|
+
**Kind**: global class
|
|
935
|
+
**See**
|
|
936
|
+
|
|
937
|
+
- AbstractClient
|
|
938
|
+
- FonosterClient
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
* [Calls](#Calls)
|
|
942
|
+
* [new Calls(client)](#new_Calls_new)
|
|
943
|
+
* [.createCall(request)](#Calls+createCall) ⇒ <code>Promise.<CreateCallResponse></code>
|
|
944
|
+
* [.getCall(ref)](#Calls+getCall) ⇒ <code>Promise.<Acl></code>
|
|
945
|
+
* [.listCalls(request)](#Calls+listCalls) ⇒ <code>Promise.<ListCallsResponse></code>
|
|
946
|
+
|
|
947
|
+
<a name="new_Calls_new"></a>
|
|
948
|
+
|
|
949
|
+
### new Calls(client)
|
|
950
|
+
Constructs a new Calls object.
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
| Param | Type | Description |
|
|
954
|
+
| --- | --- | --- |
|
|
955
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
956
|
+
|
|
957
|
+
**Example**
|
|
958
|
+
```js
|
|
959
|
+
const SDK = require("@fonoster/sdk");
|
|
960
|
+
|
|
961
|
+
async function main(request) {
|
|
962
|
+
const username = "admin";
|
|
963
|
+
const password = "yourpassword";
|
|
964
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
965
|
+
|
|
966
|
+
try {
|
|
967
|
+
const client = SDK.Client({ accessKeyId });
|
|
968
|
+
await client.login({ username, password });
|
|
969
|
+
|
|
970
|
+
const calls = new SDK.Calls(client);
|
|
971
|
+
const response = await apiKeys.createCall(request);
|
|
972
|
+
|
|
973
|
+
console.log(response); // successful response
|
|
974
|
+
} catch (e) {
|
|
975
|
+
console.error(e); // an error occurred
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
const request = {
|
|
980
|
+
from: "8287854037",
|
|
981
|
+
to: "+17853178070",
|
|
982
|
+
appRef: "00000000-0000-0000-0000-000000000000"
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
main(request).catch(console.error);
|
|
986
|
+
```
|
|
987
|
+
<a name="Calls+createCall"></a>
|
|
988
|
+
|
|
989
|
+
### calls.createCall(request) ⇒ <code>Promise.<CreateCallResponse></code>
|
|
990
|
+
Creates a new Call in the Workspace.
|
|
991
|
+
|
|
992
|
+
**Kind**: instance method of [<code>Calls</code>](#Calls)
|
|
993
|
+
**Returns**: <code>Promise.<CreateCallResponse></code> - - The response object that contains the reference to the created Call
|
|
994
|
+
|
|
995
|
+
| Param | Type | Description |
|
|
996
|
+
| --- | --- | --- |
|
|
997
|
+
| request | <code>CreateCallRequest</code> | The request object that contains the necessary information to create a new Call |
|
|
998
|
+
| request.from | <code>string</code> | The number that originated the call |
|
|
999
|
+
| request.to | <code>string</code> | The number that received the call |
|
|
1000
|
+
| request.appRef | <code>string</code> | The reference of the App that will handle the call |
|
|
1001
|
+
|
|
1002
|
+
**Example**
|
|
1003
|
+
```js
|
|
1004
|
+
const request = {
|
|
1005
|
+
from: "8287854037",
|
|
1006
|
+
to: "+17853178070",
|
|
1007
|
+
appRef: "00000000-0000-0000-0000-000000000000"
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
const calls = new SDK.Calls(client); // Existing client object
|
|
1011
|
+
|
|
1012
|
+
calls.createCall(request)
|
|
1013
|
+
.then(console.log) // successful response
|
|
1014
|
+
.catch(console.error); // an error occurred
|
|
1015
|
+
```
|
|
1016
|
+
<a name="Calls+getCall"></a>
|
|
1017
|
+
|
|
1018
|
+
### calls.getCall(ref) ⇒ <code>Promise.<Acl></code>
|
|
1019
|
+
Retrieves an existing Call in the Workspace.
|
|
1020
|
+
|
|
1021
|
+
**Kind**: instance method of [<code>Calls</code>](#Calls)
|
|
1022
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Call detail
|
|
1023
|
+
|
|
1024
|
+
| Param | Type | Description |
|
|
1025
|
+
| --- | --- | --- |
|
|
1026
|
+
| ref | <code>string</code> | The reference of the Call to retrieve |
|
|
1027
|
+
|
|
1028
|
+
**Example**
|
|
1029
|
+
```js
|
|
1030
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1031
|
+
|
|
1032
|
+
const calls = new SDK.Calls(client); // Existing client object
|
|
1033
|
+
|
|
1034
|
+
calls.getCall(ref)
|
|
1035
|
+
.then(console.log) // successful response
|
|
1036
|
+
.catch(console.error); // an error occurred
|
|
1037
|
+
```
|
|
1038
|
+
<a name="Calls+listCalls"></a>
|
|
1039
|
+
|
|
1040
|
+
### calls.listCalls(request) ⇒ <code>Promise.<ListCallsResponse></code>
|
|
1041
|
+
Retrieves a list of Calls from a Workspace.
|
|
1042
|
+
|
|
1043
|
+
**Kind**: instance method of [<code>Calls</code>](#Calls)
|
|
1044
|
+
**Returns**: <code>Promise.<ListCallsResponse></code> - - The response object that contains the list of Calls
|
|
1045
|
+
|
|
1046
|
+
| Param | Type | Description |
|
|
1047
|
+
| --- | --- | --- |
|
|
1048
|
+
| request | <code>ListCallsRequest</code> | The request object that contains the necessary information to retrieve a list of Calls |
|
|
1049
|
+
| request.pageSize | <code>number</code> | The number of Calls to retrieve |
|
|
1050
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Calls |
|
|
1051
|
+
|
|
1052
|
+
**Example**
|
|
1053
|
+
```js
|
|
1054
|
+
const request = {
|
|
1055
|
+
pageSize: 10,
|
|
1056
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
const calls = new SDK.Calls(client); // Existing client object
|
|
1060
|
+
|
|
1061
|
+
calls.listCalls(request)
|
|
1062
|
+
.then(console.log) // successful response
|
|
1063
|
+
.catch(console.error); // an error occurred
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
<a name="Credentials"></a>
|
|
1067
|
+
|
|
1068
|
+
## Credentials
|
|
1069
|
+
Fonoster Credentials, part of the Fonoster SIP Proxy subsystem,
|
|
1070
|
+
allows you to create, update, retrieve, and delete SIP Credentials for your deployment.
|
|
1071
|
+
Note that an active Fonoster deployment is required.
|
|
1072
|
+
|
|
1073
|
+
**Kind**: global class
|
|
1074
|
+
**See**
|
|
1075
|
+
|
|
1076
|
+
- AbstractClient
|
|
1077
|
+
- FonosterClient
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
* [Credentials](#Credentials)
|
|
1081
|
+
* [new Credentials(client)](#new_Credentials_new)
|
|
1082
|
+
* [.createCredentials(request)](#Credentials+createCredentials) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1083
|
+
* [.getCredentials(ref)](#Credentials+getCredentials) ⇒ <code>Promise.<Acl></code>
|
|
1084
|
+
* [.updateCredentials(request)](#Credentials+updateCredentials) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1085
|
+
* [.listCredentials(request)](#Credentials+listCredentials) ⇒ <code>Promise.<ListCredentialsResponse></code>
|
|
1086
|
+
* [.deleteCredentials(ref)](#Credentials+deleteCredentials) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1087
|
+
|
|
1088
|
+
<a name="new_Credentials_new"></a>
|
|
1089
|
+
|
|
1090
|
+
### new Credentials(client)
|
|
1091
|
+
Constructs a new Credentials object.
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
| Param | Type | Description |
|
|
1095
|
+
| --- | --- | --- |
|
|
1096
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
1097
|
+
|
|
1098
|
+
**Example**
|
|
1099
|
+
```js
|
|
1100
|
+
const SDK = require("@fonoster/sdk");
|
|
1101
|
+
|
|
1102
|
+
async function main(request) {
|
|
1103
|
+
const apiKey = "your-api-key";
|
|
1104
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
1105
|
+
|
|
1106
|
+
try {
|
|
1107
|
+
const client = SDK.Client({ accessKeyId });
|
|
1108
|
+
await client.loginWithApiKey(apiKey);
|
|
1109
|
+
|
|
1110
|
+
const credentials = new SDK.Credentials(client);
|
|
1111
|
+
const response = await apiKeys.createCredentials(request);
|
|
1112
|
+
|
|
1113
|
+
console.log(response); // successful response
|
|
1114
|
+
} catch (e) {
|
|
1115
|
+
console.error(e); // an error occurred
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
const request = {
|
|
1120
|
+
name: "My Credentials",
|
|
1121
|
+
username: "myusername",
|
|
1122
|
+
password: "mysecret"
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
main(request).catch(console.error);
|
|
1126
|
+
```
|
|
1127
|
+
<a name="Credentials+createCredentials"></a>
|
|
1128
|
+
|
|
1129
|
+
### credentials.createCredentials(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1130
|
+
Creates a new set of Credentials in the Workspace.
|
|
1131
|
+
|
|
1132
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
1133
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Credentials
|
|
1134
|
+
|
|
1135
|
+
| Param | Type | Description |
|
|
1136
|
+
| --- | --- | --- |
|
|
1137
|
+
| request | <code>CreateCredentialsRequest</code> | The request object that contains the necessary information to create a new set of Credentials |
|
|
1138
|
+
| request.name | <code>string</code> | The name of the Credentials |
|
|
1139
|
+
| request.username | <code>string</code> | The username of the Credentials |
|
|
1140
|
+
| request.password | <code>string</code> | The password of the Credentials |
|
|
1141
|
+
|
|
1142
|
+
**Example**
|
|
1143
|
+
```js
|
|
1144
|
+
const request = {
|
|
1145
|
+
name: "My Credentials",
|
|
1146
|
+
username: "myusername",
|
|
1147
|
+
password: "mysecret"
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1150
|
+
const credentials = new SDK.Credentials(client); // Existing client object
|
|
1151
|
+
|
|
1152
|
+
credentials.createCredentials(request)
|
|
1153
|
+
.then(console.log) // successful response
|
|
1154
|
+
.catch(console.error); // an error occurred
|
|
1155
|
+
```
|
|
1156
|
+
<a name="Credentials+getCredentials"></a>
|
|
1157
|
+
|
|
1158
|
+
### credentials.getCredentials(ref) ⇒ <code>Promise.<Acl></code>
|
|
1159
|
+
Retrieves an existing set of Credentials in the Workspace.
|
|
1160
|
+
|
|
1161
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
1162
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Credentials
|
|
1163
|
+
|
|
1164
|
+
| Param | Type | Description |
|
|
1165
|
+
| --- | --- | --- |
|
|
1166
|
+
| ref | <code>string</code> | The reference of the Credentials to retrieve |
|
|
1167
|
+
|
|
1168
|
+
**Example**
|
|
1169
|
+
```js
|
|
1170
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1171
|
+
|
|
1172
|
+
const credentials = new SDK.Credentials(client); // Existing client object
|
|
1173
|
+
|
|
1174
|
+
credentials.getCredentials(ref)
|
|
1175
|
+
.then(console.log) // successful response
|
|
1176
|
+
.catch(console.error); // an error occurred
|
|
1177
|
+
```
|
|
1178
|
+
<a name="Credentials+updateCredentials"></a>
|
|
1179
|
+
|
|
1180
|
+
### credentials.updateCredentials(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1181
|
+
Updates an existing set of Credentials in the Workspace.
|
|
1182
|
+
|
|
1183
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
1184
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Credentials
|
|
1185
|
+
|
|
1186
|
+
| Param | Type | Description |
|
|
1187
|
+
| --- | --- | --- |
|
|
1188
|
+
| request | <code>UpdateCredentialsRequest</code> | The request object that contains the necessary information to update an existing set of Credentials |
|
|
1189
|
+
| request.ref | <code>string</code> | The reference of the Credentials to update |
|
|
1190
|
+
| request.name | <code>string</code> | The name of the Credentials |
|
|
1191
|
+
| request.password | <code>string</code> | The password of the Credentials |
|
|
1192
|
+
|
|
1193
|
+
**Example**
|
|
1194
|
+
```js
|
|
1195
|
+
const request = {
|
|
1196
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1197
|
+
name: "My Credentials",
|
|
1198
|
+
password: "mysecret"
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
const credentials = new SDK.Credentials(client); // Existing client object
|
|
1202
|
+
|
|
1203
|
+
credentials.updateCredentials(request)
|
|
1204
|
+
.then(console.log) // successful response
|
|
1205
|
+
.catch(console.error); // an error occurred
|
|
1206
|
+
```
|
|
1207
|
+
<a name="Credentials+listCredentials"></a>
|
|
1208
|
+
|
|
1209
|
+
### credentials.listCredentials(request) ⇒ <code>Promise.<ListCredentialsResponse></code>
|
|
1210
|
+
Retrieves a list of Credentials from a Workspace.
|
|
1211
|
+
|
|
1212
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
1213
|
+
**Returns**: <code>Promise.<ListCredentialsResponse></code> - - The response object that contains the list of Credentials
|
|
1214
|
+
|
|
1215
|
+
| Param | Type | Description |
|
|
1216
|
+
| --- | --- | --- |
|
|
1217
|
+
| request | <code>ListCredentialsRequest</code> | The request object that contains the necessary information to retrieve a list of Credentials |
|
|
1218
|
+
| request.pageSize | <code>number</code> | The number of Credentials to retrieve |
|
|
1219
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Credentials |
|
|
1220
|
+
|
|
1221
|
+
**Example**
|
|
1222
|
+
```js
|
|
1223
|
+
const request = {
|
|
1224
|
+
pageSize: 10,
|
|
1225
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
const credentials = new SDK.Credentials(client); // Existing client object
|
|
1229
|
+
|
|
1230
|
+
credentials.listCredentials(request)
|
|
1231
|
+
.then(console.log) // successful response
|
|
1232
|
+
.catch(console.error); // an error occurred
|
|
1233
|
+
```
|
|
1234
|
+
<a name="Credentials+deleteCredentials"></a>
|
|
1235
|
+
|
|
1236
|
+
### credentials.deleteCredentials(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1237
|
+
Deletes an existing set of Credentials from Fonoster.
|
|
1238
|
+
Note that this operation is irreversible.
|
|
1239
|
+
|
|
1240
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
1241
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Credentials
|
|
1242
|
+
|
|
1243
|
+
| Param | Type | Description |
|
|
1244
|
+
| --- | --- | --- |
|
|
1245
|
+
| ref | <code>string</code> | The reference of the Credentials to delete |
|
|
1246
|
+
|
|
1247
|
+
**Example**
|
|
1248
|
+
```js
|
|
1249
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1250
|
+
|
|
1251
|
+
const credentials = new SDK.Credentials(client); // Existing client object
|
|
1252
|
+
|
|
1253
|
+
credentials.deleteCredentials(ref)
|
|
1254
|
+
.then(console.log) // successful response
|
|
1255
|
+
.catch(console.error); // an error occurred
|
|
1256
|
+
```
|
|
1257
|
+
|
|
1258
|
+
<a name="Domains"></a>
|
|
1259
|
+
|
|
1260
|
+
## Domains
|
|
1261
|
+
Fonoster Domains, part of the Fonoster SIP Proxy subsystem,
|
|
1262
|
+
allows you to create, update, retrieve, and delete SIP Domain for your deployment.
|
|
1263
|
+
Note that an active Fonoster deployment is required.
|
|
1264
|
+
|
|
1265
|
+
**Kind**: global class
|
|
1266
|
+
**See**
|
|
1267
|
+
|
|
1268
|
+
- AbstractClient
|
|
1269
|
+
- FonosterClient
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
* [Domains](#Domains)
|
|
1273
|
+
* [new Domains(client)](#new_Domains_new)
|
|
1274
|
+
* [.createDomain(request)](#Domains+createDomain) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1275
|
+
* [.getDomain(ref)](#Domains+getDomain) ⇒ <code>Promise.<Acl></code>
|
|
1276
|
+
* [.updateDomain(request)](#Domains+updateDomain) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1277
|
+
* [.listDomains(request)](#Domains+listDomains) ⇒ <code>Promise.<ListDomainsResponse></code>
|
|
1278
|
+
* [.deleteDomain(ref)](#Domains+deleteDomain) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1279
|
+
|
|
1280
|
+
<a name="new_Domains_new"></a>
|
|
1281
|
+
|
|
1282
|
+
### new Domains(client)
|
|
1283
|
+
Constructs a new Domains object.
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
| Param | Type | Description |
|
|
1287
|
+
| --- | --- | --- |
|
|
1288
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
1289
|
+
|
|
1290
|
+
**Example**
|
|
1291
|
+
```js
|
|
1292
|
+
const SDK = require("@fonoster/sdk");
|
|
1293
|
+
|
|
1294
|
+
async function main(request) {
|
|
1295
|
+
const apiKey = "your-api-key";
|
|
1296
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
1297
|
+
|
|
1298
|
+
try {
|
|
1299
|
+
const client = SDK.Client({ accessKeyId });
|
|
1300
|
+
await client.loginWithApiKey(apiKey);
|
|
1301
|
+
|
|
1302
|
+
const domains = new SDK.Domains(client);
|
|
1303
|
+
const response = await domains.createDomain(request);
|
|
1304
|
+
|
|
1305
|
+
console.log(response); // successful response
|
|
1306
|
+
} catch (e) {
|
|
1307
|
+
console.error(e); // an error occurred
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
const request = {
|
|
1312
|
+
name: "My Domain",
|
|
1313
|
+
domainUri: "sip.project.fonoster.io"
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
main(request).catch(console.error);
|
|
1317
|
+
```
|
|
1318
|
+
<a name="Domains+createDomain"></a>
|
|
1319
|
+
|
|
1320
|
+
### domains.createDomain(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1321
|
+
Creates a new Domain in the Workspace.
|
|
1322
|
+
|
|
1323
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
1324
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Domain
|
|
1325
|
+
|
|
1326
|
+
| Param | Type | Description |
|
|
1327
|
+
| --- | --- | --- |
|
|
1328
|
+
| request | <code>CreateDomainRequest</code> | The request object that contains the necessary information to create a new Domain |
|
|
1329
|
+
| request.name | <code>string</code> | The name of the Domain |
|
|
1330
|
+
| request.domainUri | <code>string</code> | The URI of the Domain |
|
|
1331
|
+
| request.accessControlListRef | <code>AccessControlListRef</code> | The reference to the Access Control List (ACL) to associate with the Domain |
|
|
1332
|
+
| request.egressPolicy | <code>Array.<EgressPolicy></code> | The egress policy of the Domain |
|
|
1333
|
+
| request.egressPolicy[].rule | <code>string</code> | A regular expression that defines which calls to send to the PSTN |
|
|
1334
|
+
| request.egressPolicy[].numberRef | <code>string</code> | The Number that will be used to send the call to the PSTN |
|
|
1335
|
+
|
|
1336
|
+
**Example**
|
|
1337
|
+
```js
|
|
1338
|
+
const request = {
|
|
1339
|
+
name: "My Domain",
|
|
1340
|
+
domainUri: "sip.project.fonoster.io"
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
const domains = new SDK.Domains(client); // Existing client object
|
|
1344
|
+
|
|
1345
|
+
domains.createDomain(request)
|
|
1346
|
+
.then(console.log) // successful response
|
|
1347
|
+
.catch(console.error); // an error occurred
|
|
1348
|
+
```
|
|
1349
|
+
<a name="Domains+getDomain"></a>
|
|
1350
|
+
|
|
1351
|
+
### domains.getDomain(ref) ⇒ <code>Promise.<Acl></code>
|
|
1352
|
+
Retrieves an existing Domain in the Workspace.
|
|
1353
|
+
|
|
1354
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
1355
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Domain
|
|
1356
|
+
|
|
1357
|
+
| Param | Type | Description |
|
|
1358
|
+
| --- | --- | --- |
|
|
1359
|
+
| ref | <code>string</code> | The reference of the Domain to retrieve |
|
|
1360
|
+
|
|
1361
|
+
**Example**
|
|
1362
|
+
```js
|
|
1363
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1364
|
+
|
|
1365
|
+
const domains = new SDK.Domains(client); // Existing client object
|
|
1366
|
+
|
|
1367
|
+
domains.getDomain(ref)
|
|
1368
|
+
.then(console.log) // successful response
|
|
1369
|
+
.catch(console.error); // an error occurred
|
|
1370
|
+
```
|
|
1371
|
+
<a name="Domains+updateDomain"></a>
|
|
1372
|
+
|
|
1373
|
+
### domains.updateDomain(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1374
|
+
Updates an existing Domain in the Workspace.
|
|
1375
|
+
|
|
1376
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
1377
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Domain
|
|
1378
|
+
|
|
1379
|
+
| Param | Type | Description |
|
|
1380
|
+
| --- | --- | --- |
|
|
1381
|
+
| request | <code>UpdateDomainRequest</code> | The request object that contains the necessary information to update an existing Domain |
|
|
1382
|
+
| request.ref | <code>string</code> | The reference of the Domain to update |
|
|
1383
|
+
| request.name | <code>string</code> | The name of the Domain |
|
|
1384
|
+
| request.domainUri | <code>string</code> | The URI of the Domain |
|
|
1385
|
+
| request.accessControlListRef | <code>AccessControlListRef</code> | The reference to the Access Control List (ACL) to associate with the Domain |
|
|
1386
|
+
| request.egressPolicy | <code>Array.<EgressPolicy></code> | The egress policy of the Domain |
|
|
1387
|
+
| request.egressPolicy[].rule | <code>string</code> | A regular expression that defines which calls to send to the PSTN |
|
|
1388
|
+
| request.egressPolicy[].numberRef | <code>string</code> | The Number that will be used to send the call to the PSTN |
|
|
1389
|
+
|
|
1390
|
+
**Example**
|
|
1391
|
+
```js
|
|
1392
|
+
const request = {
|
|
1393
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1394
|
+
accessControlListRef: "00000000-0000-0000-0000-000000000001"
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
const domains = new SDK.Domains(client); // Existing client object
|
|
1398
|
+
|
|
1399
|
+
domains.updateDomain(request)
|
|
1400
|
+
.then(console.log) // successful response
|
|
1401
|
+
.catch(console.error); // an error occurred
|
|
1402
|
+
```
|
|
1403
|
+
<a name="Domains+listDomains"></a>
|
|
1404
|
+
|
|
1405
|
+
### domains.listDomains(request) ⇒ <code>Promise.<ListDomainsResponse></code>
|
|
1406
|
+
Retrieves a list of Domains from a Workspace.
|
|
1407
|
+
|
|
1408
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
1409
|
+
**Returns**: <code>Promise.<ListDomainsResponse></code> - - The response object that contains the list of Domains
|
|
1410
|
+
|
|
1411
|
+
| Param | Type | Description |
|
|
1412
|
+
| --- | --- | --- |
|
|
1413
|
+
| request | <code>ListDomainsRequest</code> | The request object that contains the necessary information to retrieve a list of Domains |
|
|
1414
|
+
| request.pageSize | <code>number</code> | The number of Domains to retrieve |
|
|
1415
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Domains |
|
|
1416
|
+
|
|
1417
|
+
**Example**
|
|
1418
|
+
```js
|
|
1419
|
+
const request = {
|
|
1420
|
+
pageSize: 10,
|
|
1421
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
const domains = new SDK.Domains(client); // Existing client object
|
|
1425
|
+
|
|
1426
|
+
domains.listDomains(request)
|
|
1427
|
+
.then(console.log) // successful response
|
|
1428
|
+
.catch(console.error); // an error occurred
|
|
1429
|
+
```
|
|
1430
|
+
<a name="Domains+deleteDomain"></a>
|
|
1431
|
+
|
|
1432
|
+
### domains.deleteDomain(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1433
|
+
Deletes an existing Domain from Fonoster.
|
|
1434
|
+
Note that this operation is irreversible.
|
|
1435
|
+
|
|
1436
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
1437
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Domain
|
|
1438
|
+
|
|
1439
|
+
| Param | Type | Description |
|
|
1440
|
+
| --- | --- | --- |
|
|
1441
|
+
| ref | <code>string</code> | The reference of the Domain to delete |
|
|
1442
|
+
|
|
1443
|
+
**Example**
|
|
1444
|
+
```js
|
|
1445
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1446
|
+
|
|
1447
|
+
const domains = new SDK.Domains(client); // Existing client object
|
|
1448
|
+
|
|
1449
|
+
domains.deleteDomain(ref)
|
|
1450
|
+
.then(console.log) // successful response
|
|
1451
|
+
.catch(console.error); // an error occurred
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1454
|
+
<a name="Numbers"></a>
|
|
1455
|
+
|
|
1456
|
+
## Numbers
|
|
1457
|
+
Fonoster Numbers, part of the Fonoster SIP Proxy subsystem,
|
|
1458
|
+
allows you to create, update, retrieve, and delete SIP Number for your deployment.
|
|
1459
|
+
Note that an active Fonoster deployment is required.
|
|
1460
|
+
|
|
1461
|
+
**Kind**: global class
|
|
1462
|
+
**See**
|
|
1463
|
+
|
|
1464
|
+
- AbstractClient
|
|
1465
|
+
- FonosterClient
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
* [Numbers](#Numbers)
|
|
1469
|
+
* [new Numbers(client)](#new_Numbers_new)
|
|
1470
|
+
* [.createNumber(request)](#Numbers+createNumber) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1471
|
+
* [.getNumber(ref)](#Numbers+getNumber) ⇒ <code>Promise.<Acl></code>
|
|
1472
|
+
* [.updateNumber(request)](#Numbers+updateNumber) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1473
|
+
* [.listNumbers(request)](#Numbers+listNumbers) ⇒ <code>Promise.<ListNumbersResponse></code>
|
|
1474
|
+
* [.deleteNumber(ref)](#Numbers+deleteNumber) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1475
|
+
|
|
1476
|
+
<a name="new_Numbers_new"></a>
|
|
1477
|
+
|
|
1478
|
+
### new Numbers(client)
|
|
1479
|
+
Constructs a new Numbers object.
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
| Param | Type | Description |
|
|
1483
|
+
| --- | --- | --- |
|
|
1484
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
1485
|
+
|
|
1486
|
+
**Example**
|
|
1487
|
+
```js
|
|
1488
|
+
const SDK = require("@fonoster/sdk");
|
|
1489
|
+
|
|
1490
|
+
async function main(request) {
|
|
1491
|
+
const apiKey = "your-api-key";
|
|
1492
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
1493
|
+
|
|
1494
|
+
try {
|
|
1495
|
+
const client = SDK.Client({ accessKeyId });
|
|
1496
|
+
await client.loginWithApiKey(apiKey);
|
|
1497
|
+
|
|
1498
|
+
const numbers = new SDK.Numbers(client);
|
|
1499
|
+
const response = await numbers.createNumber(request);
|
|
1500
|
+
|
|
1501
|
+
console.log(response); // successful response
|
|
1502
|
+
} catch (e) {
|
|
1503
|
+
console.error(e); // an error occurred
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
const request = {
|
|
1508
|
+
name: "My Number",
|
|
1509
|
+
telUrl: "tel:+17853178070",
|
|
1510
|
+
city: "Asheville",
|
|
1511
|
+
country: "United States",
|
|
1512
|
+
countryIsoCode: "US"
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
main(request).catch(console.error);
|
|
1516
|
+
```
|
|
1517
|
+
<a name="Numbers+createNumber"></a>
|
|
1518
|
+
|
|
1519
|
+
### numbers.createNumber(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1520
|
+
Creates a new Number in the Workspace.
|
|
1521
|
+
|
|
1522
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
1523
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Number
|
|
1524
|
+
|
|
1525
|
+
| Param | Type | Description |
|
|
1526
|
+
| --- | --- | --- |
|
|
1527
|
+
| request | <code>CreateNumberRequest</code> | The request object that contains the necessary information to create a new Number |
|
|
1528
|
+
| request.name | <code>string</code> | The name of the Number |
|
|
1529
|
+
| request.telUrl | <code>string</code> | The telUrl of the Number |
|
|
1530
|
+
| request.city | <code>string</code> | The city of the Number |
|
|
1531
|
+
| request.country | <code>string</code> | The country of the Number |
|
|
1532
|
+
| request.countryIsoCode | <code>string</code> | The countryIsoCode of the Number |
|
|
1533
|
+
|
|
1534
|
+
**Example**
|
|
1535
|
+
```js
|
|
1536
|
+
const request = {
|
|
1537
|
+
name: "My Number",
|
|
1538
|
+
telUrl: "tel:+17853178070",
|
|
1539
|
+
city: "Asheville",
|
|
1540
|
+
country: "United States",
|
|
1541
|
+
countryIsoCode: "US"
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
const numbers = new SDK.Numbers(client); // Existing client object
|
|
1545
|
+
|
|
1546
|
+
numbers.createNumber(request)
|
|
1547
|
+
.then(console.log) // successful response
|
|
1548
|
+
.catch(console.error); // an error occurred
|
|
1549
|
+
```
|
|
1550
|
+
<a name="Numbers+getNumber"></a>
|
|
1551
|
+
|
|
1552
|
+
### numbers.getNumber(ref) ⇒ <code>Promise.<Acl></code>
|
|
1553
|
+
Retrieves an existing Number in the Workspace.
|
|
1554
|
+
|
|
1555
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
1556
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Number
|
|
1557
|
+
|
|
1558
|
+
| Param | Type | Description |
|
|
1559
|
+
| --- | --- | --- |
|
|
1560
|
+
| ref | <code>string</code> | The reference of the Number to retrieve |
|
|
1561
|
+
|
|
1562
|
+
**Example**
|
|
1563
|
+
```js
|
|
1564
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1565
|
+
|
|
1566
|
+
const numbers = new SDK.Numbers(client); // Existing client object
|
|
1567
|
+
|
|
1568
|
+
numbers.getNumber(ref)
|
|
1569
|
+
.then(console.log) // successful response
|
|
1570
|
+
.catch(console.error); // an error occurred
|
|
1571
|
+
```
|
|
1572
|
+
<a name="Numbers+updateNumber"></a>
|
|
1573
|
+
|
|
1574
|
+
### numbers.updateNumber(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1575
|
+
Updates an existing Number in the Workspace.
|
|
1576
|
+
|
|
1577
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
1578
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Number
|
|
1579
|
+
|
|
1580
|
+
| Param | Type | Description |
|
|
1581
|
+
| --- | --- | --- |
|
|
1582
|
+
| request | <code>UpdateNumberRequest</code> | The request object that contains the necessary information to update an existing Number |
|
|
1583
|
+
| request.ref | <code>string</code> | The reference of the Number to update |
|
|
1584
|
+
| request.name | <code>string</code> | The name of the Number |
|
|
1585
|
+
|
|
1586
|
+
**Example**
|
|
1587
|
+
```js
|
|
1588
|
+
const request = {
|
|
1589
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1590
|
+
name: "My Number"
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1593
|
+
const numbers = new SDK.Numbers(client); // Existing client object
|
|
1594
|
+
|
|
1595
|
+
numbers.updateNumber(request)
|
|
1596
|
+
.then(console.log) // successful response
|
|
1597
|
+
.catch(console.error); // an error occurred
|
|
1598
|
+
```
|
|
1599
|
+
<a name="Numbers+listNumbers"></a>
|
|
1600
|
+
|
|
1601
|
+
### numbers.listNumbers(request) ⇒ <code>Promise.<ListNumbersResponse></code>
|
|
1602
|
+
Retrieves a list of Numbers from a Workspace.
|
|
1603
|
+
|
|
1604
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
1605
|
+
**Returns**: <code>Promise.<ListNumbersResponse></code> - - The response object that contains the list of Numbers
|
|
1606
|
+
|
|
1607
|
+
| Param | Type | Description |
|
|
1608
|
+
| --- | --- | --- |
|
|
1609
|
+
| request | <code>ListNumbersRequest</code> | The request object that contains the necessary information to retrieve a list of Numbers |
|
|
1610
|
+
| request.pageSize | <code>number</code> | The number of Numbers to retrieve |
|
|
1611
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Numbers |
|
|
1612
|
+
|
|
1613
|
+
**Example**
|
|
1614
|
+
```js
|
|
1615
|
+
const request = {
|
|
1616
|
+
pageSize: 10,
|
|
1617
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
const numbers = new SDK.Numbers(client); // Existing client object
|
|
1621
|
+
|
|
1622
|
+
numbers.listNumbers(request)
|
|
1623
|
+
.then(console.log) // successful response
|
|
1624
|
+
.catch(console.error); // an error occurred
|
|
1625
|
+
```
|
|
1626
|
+
<a name="Numbers+deleteNumber"></a>
|
|
1627
|
+
|
|
1628
|
+
### numbers.deleteNumber(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1629
|
+
Deletes an existing Number from Fonoster.
|
|
1630
|
+
Note that this operation is irreversible.
|
|
1631
|
+
|
|
1632
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
1633
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Number
|
|
1634
|
+
|
|
1635
|
+
| Param | Type | Description |
|
|
1636
|
+
| --- | --- | --- |
|
|
1637
|
+
| ref | <code>string</code> | The reference of the Number to delete |
|
|
1638
|
+
|
|
1639
|
+
**Example**
|
|
1640
|
+
```js
|
|
1641
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1642
|
+
|
|
1643
|
+
const numbers = new SDK.Numbers(client); // Existing client object
|
|
1644
|
+
|
|
1645
|
+
numbers.deleteDomain(ref)
|
|
1646
|
+
.then(console.log) // successful response
|
|
1647
|
+
.catch(console.error); // an error occurred
|
|
1648
|
+
```
|
|
1649
|
+
|
|
1650
|
+
<a name="Secrets"></a>
|
|
1651
|
+
|
|
1652
|
+
## Secrets
|
|
1653
|
+
Fonoster Secrets, part of the Fonoster Core,
|
|
1654
|
+
allows you to create, update, retrieve, and delete Secrets for your deployment.
|
|
1655
|
+
Note that an active Fonoster deployment is required.
|
|
1656
|
+
|
|
1657
|
+
**Kind**: global class
|
|
1658
|
+
**See**
|
|
1659
|
+
|
|
1660
|
+
- AbstractClient
|
|
1661
|
+
- FonosterClient
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
* [Secrets](#Secrets)
|
|
1665
|
+
* [new Secrets(client)](#new_Secrets_new)
|
|
1666
|
+
* [.createSecret(request)](#Secrets+createSecret) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1667
|
+
* [.getSecret(ref)](#Secrets+getSecret) ⇒ <code>Promise.<Acl></code>
|
|
1668
|
+
* [.updateSecret(request)](#Secrets+updateSecret) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1669
|
+
* [.listSecrets(request)](#Secrets+listSecrets) ⇒ <code>Promise.<ListSecretsResponse></code>
|
|
1670
|
+
* [.deleteSecret(ref)](#Secrets+deleteSecret) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1671
|
+
|
|
1672
|
+
<a name="new_Secrets_new"></a>
|
|
1673
|
+
|
|
1674
|
+
### new Secrets(client)
|
|
1675
|
+
Constructs a new Secrets object.
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
| Param | Type | Description |
|
|
1679
|
+
| --- | --- | --- |
|
|
1680
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
1681
|
+
|
|
1682
|
+
**Example**
|
|
1683
|
+
```js
|
|
1684
|
+
const SDK = require("@fonoster/sdk");
|
|
1685
|
+
|
|
1686
|
+
async function main(request) {
|
|
1687
|
+
const apiKey = "your-api-key";
|
|
1688
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
1689
|
+
|
|
1690
|
+
try {
|
|
1691
|
+
const client = SDK.Client({ accessKeyId });
|
|
1692
|
+
await client.loginWithApiKey(apiKey);
|
|
1693
|
+
|
|
1694
|
+
const secrets = new SDK.Secrets(client);
|
|
1695
|
+
const response = await secrets.creteSecret(request);
|
|
1696
|
+
|
|
1697
|
+
console.log(response); // successful response
|
|
1698
|
+
} catch (e) {
|
|
1699
|
+
console.error(e); // an error occurred
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
const request = {
|
|
1704
|
+
name: "FRIENDLY_NAME",
|
|
1705
|
+
secret: "mysecret"
|
|
1706
|
+
};
|
|
1707
|
+
|
|
1708
|
+
main(request).catch(console.error);
|
|
1709
|
+
```
|
|
1710
|
+
<a name="Secrets+createSecret"></a>
|
|
1711
|
+
|
|
1712
|
+
### secrets.createSecret(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1713
|
+
Creates a new Secret in the Workspace.
|
|
1714
|
+
|
|
1715
|
+
**Kind**: instance method of [<code>Secrets</code>](#Secrets)
|
|
1716
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Secret
|
|
1717
|
+
|
|
1718
|
+
| Param | Type | Description |
|
|
1719
|
+
| --- | --- | --- |
|
|
1720
|
+
| request | <code>CreateSecretRequest</code> | The request object that contains the necessary information to create a new Secret |
|
|
1721
|
+
| request.name | <code>string</code> | The name of the Secret |
|
|
1722
|
+
| request.secret | <code>string</code> | The secret of the Secret |
|
|
1723
|
+
|
|
1724
|
+
**Example**
|
|
1725
|
+
```js
|
|
1726
|
+
const request = {
|
|
1727
|
+
name: "FRIENDLY_NAME",
|
|
1728
|
+
secret: "mysecret"
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
const secrets = new SDK.Secrets(client); // Existing client object
|
|
1732
|
+
|
|
1733
|
+
secrets.createSecret(request)
|
|
1734
|
+
.then(console.log) // successful response
|
|
1735
|
+
.catch(console.error); // an error occurred
|
|
1736
|
+
```
|
|
1737
|
+
<a name="Secrets+getSecret"></a>
|
|
1738
|
+
|
|
1739
|
+
### secrets.getSecret(ref) ⇒ <code>Promise.<Acl></code>
|
|
1740
|
+
Retrieves an existing Secret in the Workspace.
|
|
1741
|
+
|
|
1742
|
+
**Kind**: instance method of [<code>Secrets</code>](#Secrets)
|
|
1743
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Secret
|
|
1744
|
+
|
|
1745
|
+
| Param | Type | Description |
|
|
1746
|
+
| --- | --- | --- |
|
|
1747
|
+
| ref | <code>string</code> | The reference of the Secret to retrieve |
|
|
1748
|
+
|
|
1749
|
+
**Example**
|
|
1750
|
+
```js
|
|
1751
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1752
|
+
|
|
1753
|
+
const secrets = new SDK.Secrets(client); // Existing client object
|
|
1754
|
+
|
|
1755
|
+
secrets.getSecret(ref)
|
|
1756
|
+
.then(console.log) // successful response
|
|
1757
|
+
.catch(console.error); // an error occurred
|
|
1758
|
+
```
|
|
1759
|
+
<a name="Secrets+updateSecret"></a>
|
|
1760
|
+
|
|
1761
|
+
### secrets.updateSecret(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1762
|
+
Updates an existing Secret in the Workspace.
|
|
1763
|
+
|
|
1764
|
+
**Kind**: instance method of [<code>Secrets</code>](#Secrets)
|
|
1765
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Secret
|
|
1766
|
+
|
|
1767
|
+
| Param | Type | Description |
|
|
1768
|
+
| --- | --- | --- |
|
|
1769
|
+
| request | <code>UpdateSecretRequest</code> | The request object that contains the necessary information to update an existing Secret |
|
|
1770
|
+
| request.ref | <code>string</code> | The reference of the Secret to update |
|
|
1771
|
+
| request.name | <code>string</code> | The name of the Secret |
|
|
1772
|
+
| request.secret | <code>string</code> | The secret of the Secret |
|
|
1773
|
+
|
|
1774
|
+
**Example**
|
|
1775
|
+
```js
|
|
1776
|
+
const request = {
|
|
1777
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1778
|
+
secret: "mysecret"
|
|
1779
|
+
};
|
|
1780
|
+
|
|
1781
|
+
const secrets = new SDK.Secrets(client); // Existing client object
|
|
1782
|
+
|
|
1783
|
+
secrets.updateSecret(request)
|
|
1784
|
+
.then(console.log) // successful response
|
|
1785
|
+
.catch(console.error); // an error occurred
|
|
1786
|
+
```
|
|
1787
|
+
<a name="Secrets+listSecrets"></a>
|
|
1788
|
+
|
|
1789
|
+
### secrets.listSecrets(request) ⇒ <code>Promise.<ListSecretsResponse></code>
|
|
1790
|
+
Retrieves a list of Secrets from a Workspace.
|
|
1791
|
+
|
|
1792
|
+
**Kind**: instance method of [<code>Secrets</code>](#Secrets)
|
|
1793
|
+
**Returns**: <code>Promise.<ListSecretsResponse></code> - - The response object that contains the list of Secrets
|
|
1794
|
+
|
|
1795
|
+
| Param | Type | Description |
|
|
1796
|
+
| --- | --- | --- |
|
|
1797
|
+
| request | <code>ListSecretsRequest</code> | The request object that contains the necessary information to retrieve a list of Secrets |
|
|
1798
|
+
| request.pageSize | <code>number</code> | The secret of Secrets to retrieve |
|
|
1799
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Secrets |
|
|
1800
|
+
|
|
1801
|
+
**Example**
|
|
1802
|
+
```js
|
|
1803
|
+
const request = {
|
|
1804
|
+
pageSize: 10,
|
|
1805
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
const secrets = new SDK.Secrets(client); // Existing client object
|
|
1809
|
+
|
|
1810
|
+
secrets.listSecrets(request)
|
|
1811
|
+
.then(console.log) // successful response
|
|
1812
|
+
.catch(console.error); // an error occurred
|
|
1813
|
+
```
|
|
1814
|
+
<a name="Secrets+deleteSecret"></a>
|
|
1815
|
+
|
|
1816
|
+
### secrets.deleteSecret(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1817
|
+
Deletes an existing Secret from Fonoster.
|
|
1818
|
+
Note that this operation is irreversible.
|
|
1819
|
+
|
|
1820
|
+
**Kind**: instance method of [<code>Secrets</code>](#Secrets)
|
|
1821
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Secret
|
|
1822
|
+
|
|
1823
|
+
| Param | Type | Description |
|
|
1824
|
+
| --- | --- | --- |
|
|
1825
|
+
| ref | <code>string</code> | The reference of the Secret to delete |
|
|
1826
|
+
|
|
1827
|
+
**Example**
|
|
1828
|
+
```js
|
|
1829
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1830
|
+
|
|
1831
|
+
const secrets = new SDK.Secrets(client); // Existing client object
|
|
1832
|
+
|
|
1833
|
+
secrets.deleteSecret(ref)
|
|
1834
|
+
.then(console.log) // successful response
|
|
1835
|
+
.catch(console.error); // an error occurred
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1838
|
+
<a name="Trunks"></a>
|
|
1839
|
+
|
|
1840
|
+
## Trunks
|
|
1841
|
+
Fonoster Trunks, part of the Fonoster SIP Proxy subsystem,
|
|
1842
|
+
allows you to create, update, retrieve, and delete SIP Trunks for your deployment.
|
|
1843
|
+
Note that an active Fonoster deployment is required.
|
|
1844
|
+
|
|
1845
|
+
**Kind**: global class
|
|
1846
|
+
**See**
|
|
1847
|
+
|
|
1848
|
+
- AbstractClient
|
|
1849
|
+
- FonosterClient
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
* [Trunks](#Trunks)
|
|
1853
|
+
* [new Trunks(client)](#new_Trunks_new)
|
|
1854
|
+
* [.createTrunk(request)](#Trunks+createTrunk) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1855
|
+
* [.getTrunk(ref)](#Trunks+getTrunk) ⇒ <code>Promise.<Acl></code>
|
|
1856
|
+
* [.updateTrunk(request)](#Trunks+updateTrunk) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1857
|
+
* [.listTrunks(request)](#Trunks+listTrunks) ⇒ <code>Promise.<ListTrunksResponse></code>
|
|
1858
|
+
* [.deleteTrunk(ref)](#Trunks+deleteTrunk) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1859
|
+
|
|
1860
|
+
<a name="new_Trunks_new"></a>
|
|
1861
|
+
|
|
1862
|
+
### new Trunks(client)
|
|
1863
|
+
Constructs a new Trunks object.
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
| Param | Type | Description |
|
|
1867
|
+
| --- | --- | --- |
|
|
1868
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
1869
|
+
|
|
1870
|
+
**Example**
|
|
1871
|
+
```js
|
|
1872
|
+
const SDK = require("@fonoster/sdk");
|
|
1873
|
+
|
|
1874
|
+
async function main(request) {
|
|
1875
|
+
const apiKey = "your-api-key";
|
|
1876
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
1877
|
+
|
|
1878
|
+
try {
|
|
1879
|
+
const client = SDK.Client({ accessKeyId });
|
|
1880
|
+
await client.loginWithApiKey(apiKey);
|
|
1881
|
+
|
|
1882
|
+
const trunks = new SDK.Trunks(client);
|
|
1883
|
+
const response = await trunks.createTrunk(request);
|
|
1884
|
+
|
|
1885
|
+
console.log(response); // successful response
|
|
1886
|
+
} catch (e) {
|
|
1887
|
+
console.error(e); // an error occurred
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
const request = {
|
|
1892
|
+
name: "My Trunk",
|
|
1893
|
+
inboundUri: "sip.company.fonoster.io"
|
|
1894
|
+
};
|
|
1895
|
+
|
|
1896
|
+
main(request).catch(console.error);
|
|
1897
|
+
```
|
|
1898
|
+
<a name="Trunks+createTrunk"></a>
|
|
1899
|
+
|
|
1900
|
+
### trunks.createTrunk(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1901
|
+
Creates a new Trunk in the Workspace.
|
|
1902
|
+
|
|
1903
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1904
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Trunk
|
|
1905
|
+
|
|
1906
|
+
| Param | Type | Description |
|
|
1907
|
+
| --- | --- | --- |
|
|
1908
|
+
| request | <code>CreateTrunkRequest</code> | The request object that contains the necessary information to create a new Trunk |
|
|
1909
|
+
| request.name | <code>string</code> | The name of the Trunk |
|
|
1910
|
+
| request.inboundUri | <code>string</code> | The inboundUri of the Trunk |
|
|
1911
|
+
| request.sendRegister | <code>boolean</code> | The sendRegister of the Trunk |
|
|
1912
|
+
| request.accessControlListRef | <code>string</code> | The accessControlListRef of the Trunk |
|
|
1913
|
+
| request.inboundCredentialsRef | <code>string</code> | The inboundCredentialsRef of the Trunk |
|
|
1914
|
+
| request.outboundCredentialsRef | <code>string</code> | The outboundCredentialsRef of the Trunk |
|
|
1915
|
+
| request.uris | <code>Array.<TrunkUri></code> | The uris of the Trunk |
|
|
1916
|
+
| request.uris[].host | <code>string</code> | The host of the Trunk |
|
|
1917
|
+
| request.uris[].port | <code>number</code> | The port of the Trunk |
|
|
1918
|
+
| request.uris[].transport | <code>Transport</code> | The transport of the Trunk |
|
|
1919
|
+
| request.uris[].user | <code>string</code> | Optional user of the Trunk |
|
|
1920
|
+
| request.uris[].weight | <code>number</code> | Optional weight of the Trunk |
|
|
1921
|
+
| request.uris[].priority | <code>number</code> | Optional priority of the Trunk |
|
|
1922
|
+
| request.uris[].enabled | <code>boolean</code> | Optional enabled of the Trunk |
|
|
1923
|
+
|
|
1924
|
+
**Example**
|
|
1925
|
+
```js
|
|
1926
|
+
const request = {
|
|
1927
|
+
name: "My Trunk",
|
|
1928
|
+
inboundUri: "sip.company.fonoster.io"
|
|
1929
|
+
sendRegister: true
|
|
1930
|
+
uris: [{
|
|
1931
|
+
host: "sip.company.fonoster.io",
|
|
1932
|
+
port: 5060,
|
|
1933
|
+
transport: "UDP",
|
|
1934
|
+
user: "user",
|
|
1935
|
+
weight: 0,
|
|
1936
|
+
priority: 0,
|
|
1937
|
+
enabled: true
|
|
1938
|
+
}]
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1941
|
+
const trunks = new SDK.Trunks(client); // Existing client object
|
|
1942
|
+
|
|
1943
|
+
trunks.createTrunk(request)
|
|
1944
|
+
.then(console.log) // successful response
|
|
1945
|
+
.catch(console.error); // an error occurred
|
|
1946
|
+
```
|
|
1947
|
+
<a name="Trunks+getTrunk"></a>
|
|
1948
|
+
|
|
1949
|
+
### trunks.getTrunk(ref) ⇒ <code>Promise.<Acl></code>
|
|
1950
|
+
Retrieves an existing Trunk in the Workspace.
|
|
1951
|
+
|
|
1952
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1953
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Trunk
|
|
1954
|
+
|
|
1955
|
+
| Param | Type | Description |
|
|
1956
|
+
| --- | --- | --- |
|
|
1957
|
+
| ref | <code>string</code> | The reference of the Trunk to retrieve |
|
|
1958
|
+
|
|
1959
|
+
**Example**
|
|
1960
|
+
```js
|
|
1961
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
1962
|
+
|
|
1963
|
+
const trunks = new SDK.Trunks(client); // Existing client object
|
|
1964
|
+
|
|
1965
|
+
trunks.getTrunk(ref)
|
|
1966
|
+
.then(console.log) // successful response
|
|
1967
|
+
.catch(console.error); // an error occurred
|
|
1968
|
+
```
|
|
1969
|
+
<a name="Trunks+updateTrunk"></a>
|
|
1970
|
+
|
|
1971
|
+
### trunks.updateTrunk(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
1972
|
+
Updates an existing Trunk in the Workspace.
|
|
1973
|
+
|
|
1974
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1975
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Trunk
|
|
1976
|
+
|
|
1977
|
+
| Param | Type | Description |
|
|
1978
|
+
| --- | --- | --- |
|
|
1979
|
+
| request | <code>UpdateTrunkRequest</code> | The request object that contains the necessary information to update an existing Trunk |
|
|
1980
|
+
| request.ref | <code>string</code> | The reference of the Trunk to update |
|
|
1981
|
+
| request.name | <code>string</code> | The name of the Trunk |
|
|
1982
|
+
| request.sendRegister | <code>boolean</code> | The sendRegister of the Trunk |
|
|
1983
|
+
| request.accessControlListRef | <code>string</code> | The accessControlListRef of the Trunk |
|
|
1984
|
+
| request.inboundCredentialsRef | <code>string</code> | The inboundCredentialsRef of the Trunk |
|
|
1985
|
+
| request.outboundCredentialsRef | <code>string</code> | The outboundCredentialsRef of the Trunk |
|
|
1986
|
+
| request.uris | <code>Array.<TrunkUri></code> | The uris of the Trunk |
|
|
1987
|
+
| request.uris[].host | <code>string</code> | The host of the Trunk |
|
|
1988
|
+
| request.uris[].port | <code>number</code> | The port of the Trunk |
|
|
1989
|
+
| request.uris[].transport | <code>Transport</code> | The transport of the Trunk |
|
|
1990
|
+
| request.uris[].user | <code>string</code> | Optional user of the Trunk |
|
|
1991
|
+
| request.uris[].weight | <code>number</code> | Optional weight of the Trunk |
|
|
1992
|
+
| request.uris[].priority | <code>number</code> | Optional priority of the Trunk |
|
|
1993
|
+
| request.uris[].enabled | <code>boolean</code> | Optional enabled of the Trunk |
|
|
1994
|
+
|
|
1995
|
+
**Example**
|
|
1996
|
+
```js
|
|
1997
|
+
const request = {
|
|
1998
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
1999
|
+
name: "My Trunk",
|
|
2000
|
+
sendRegister: true
|
|
2001
|
+
uris: [{
|
|
2002
|
+
host: "sip.company.fonoster.io",
|
|
2003
|
+
port: 5060,
|
|
2004
|
+
transport: "UDP",
|
|
2005
|
+
user: "user",
|
|
2006
|
+
weight: 0,
|
|
2007
|
+
priority: 0,
|
|
2008
|
+
enabled: true
|
|
2009
|
+
}]
|
|
2010
|
+
};
|
|
2011
|
+
```
|
|
2012
|
+
<a name="Trunks+listTrunks"></a>
|
|
2013
|
+
|
|
2014
|
+
### trunks.listTrunks(request) ⇒ <code>Promise.<ListTrunksResponse></code>
|
|
2015
|
+
Retrieves a list of Trunks from a Workspace.
|
|
2016
|
+
|
|
2017
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
2018
|
+
**Returns**: <code>Promise.<ListTrunksResponse></code> - - The response object that contains the list of Trunks
|
|
2019
|
+
|
|
2020
|
+
| Param | Type | Description |
|
|
2021
|
+
| --- | --- | --- |
|
|
2022
|
+
| request | <code>ListTrunksRequest</code> | The request object that contains the necessary information to retrieve a list of Trunks |
|
|
2023
|
+
| request.pageSize | <code>number</code> | The trunk of Trunks to retrieve |
|
|
2024
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Trunks |
|
|
2025
|
+
|
|
2026
|
+
**Example**
|
|
2027
|
+
```js
|
|
2028
|
+
const request = {
|
|
2029
|
+
pageSize: 10,
|
|
2030
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
2031
|
+
};
|
|
2032
|
+
|
|
2033
|
+
const trunks = new SDK.Trunks(client); // Existing client object
|
|
2034
|
+
|
|
2035
|
+
trunks.listTrunks(request)
|
|
2036
|
+
.then(console.log) // successful response
|
|
2037
|
+
.catch(console.error); // an error occurred
|
|
2038
|
+
```
|
|
2039
|
+
<a name="Trunks+deleteTrunk"></a>
|
|
2040
|
+
|
|
2041
|
+
### trunks.deleteTrunk(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2042
|
+
Deletes an existing Trunk from Fonoster.
|
|
2043
|
+
Note that this operation is irreversible.
|
|
2044
|
+
|
|
2045
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
2046
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Trunk
|
|
2047
|
+
|
|
2048
|
+
| Param | Type | Description |
|
|
2049
|
+
| --- | --- | --- |
|
|
2050
|
+
| ref | <code>string</code> | The reference of the Trunk to delete |
|
|
2051
|
+
|
|
2052
|
+
**Example**
|
|
2053
|
+
```js
|
|
2054
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
2055
|
+
|
|
2056
|
+
const trunks = new SDK.Trunks(client); // Existing client object
|
|
2057
|
+
|
|
2058
|
+
trunks.deleteTrunk(ref)
|
|
2059
|
+
.then(console.log) // successful response
|
|
2060
|
+
.catch(console.error); // an error occurred
|
|
2061
|
+
```
|
|
2062
|
+
|
|
2063
|
+
<a name="Users"></a>
|
|
2064
|
+
|
|
2065
|
+
## Users
|
|
2066
|
+
Fonoster Users, part of the Fonoster Identity subsystem,
|
|
2067
|
+
allows you to create, update, retrieve, and delete a Users in the system.
|
|
2068
|
+
Note that an active Fonoster deployment is required.
|
|
2069
|
+
|
|
2070
|
+
**Kind**: global class
|
|
2071
|
+
**See**
|
|
2072
|
+
|
|
2073
|
+
- AbstractClient
|
|
2074
|
+
- FonosterClient
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
* [Users](#Users)
|
|
2078
|
+
* [new Users(client)](#new_Users_new)
|
|
2079
|
+
* [.createUser(request)](#Users+createUser) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2080
|
+
* [.getUser(ref)](#Users+getUser) ⇒ <code>Promise.<Acl></code>
|
|
2081
|
+
* [.updateUser(request)](#Users+updateUser) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2082
|
+
* [.deleteUser(ref)](#Users+deleteUser) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2083
|
+
|
|
2084
|
+
<a name="new_Users_new"></a>
|
|
2085
|
+
|
|
2086
|
+
### new Users(client)
|
|
2087
|
+
Constructs a new Users object.
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
| Param | Type | Description |
|
|
2091
|
+
| --- | --- | --- |
|
|
2092
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
2093
|
+
|
|
2094
|
+
**Example**
|
|
2095
|
+
```js
|
|
2096
|
+
const SDK = require("@fonoster/sdk");
|
|
2097
|
+
|
|
2098
|
+
async function main(request) {
|
|
2099
|
+
const apiKey = "your-api-key";
|
|
2100
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
2101
|
+
|
|
2102
|
+
try {
|
|
2103
|
+
const client = SDK.Client({ accessKeyId });
|
|
2104
|
+
await client.loginWithApiKey(apiKey);
|
|
2105
|
+
|
|
2106
|
+
const users = new SDK.Users(client);
|
|
2107
|
+
const response = await users.createUser(request);
|
|
2108
|
+
|
|
2109
|
+
console.log(response); // successful response
|
|
2110
|
+
} catch (e) {
|
|
2111
|
+
console.error(e); // an error occurred
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
const request = {
|
|
2116
|
+
name: "John Doe",
|
|
2117
|
+
email: "john.doe@example.com",
|
|
2118
|
+
password: "password",
|
|
2119
|
+
avatar: "https://example.com/avatar.jpg"
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
main(request).catch(console.error);
|
|
2123
|
+
```
|
|
2124
|
+
<a name="Users+createUser"></a>
|
|
2125
|
+
|
|
2126
|
+
### users.createUser(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2127
|
+
Creates a new User in the Workspace.
|
|
2128
|
+
|
|
2129
|
+
**Kind**: instance method of [<code>Users</code>](#Users)
|
|
2130
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created User
|
|
2131
|
+
|
|
2132
|
+
| Param | Type | Description |
|
|
2133
|
+
| --- | --- | --- |
|
|
2134
|
+
| request | <code>CreateUserRequest</code> | The request object that contains the necessary information to create a new User |
|
|
2135
|
+
| request.name | <code>string</code> | The name of the User |
|
|
2136
|
+
| request.email | <code>string</code> | The email of the User |
|
|
2137
|
+
| request.password | <code>string</code> | The password of the User |
|
|
2138
|
+
| request.avatar | <code>string</code> | The avatar of the User |
|
|
2139
|
+
|
|
2140
|
+
**Example**
|
|
2141
|
+
```js
|
|
2142
|
+
const request = {
|
|
2143
|
+
name: "John Doe",
|
|
2144
|
+
email: "john.doe@example.com",
|
|
2145
|
+
password: "password",
|
|
2146
|
+
avatar: "https://example.com/avatar.jpg"
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
const users = new SDK.Users(client); // Existing client object
|
|
2150
|
+
|
|
2151
|
+
users.createUser(request)
|
|
2152
|
+
.then(console.log) // successful response
|
|
2153
|
+
.catch(console.error); // an error occurred
|
|
2154
|
+
```
|
|
2155
|
+
<a name="Users+getUser"></a>
|
|
2156
|
+
|
|
2157
|
+
### users.getUser(ref) ⇒ <code>Promise.<Acl></code>
|
|
2158
|
+
Retrieves an existing User in the Workspace.
|
|
2159
|
+
|
|
2160
|
+
**Kind**: instance method of [<code>Users</code>](#Users)
|
|
2161
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the User
|
|
2162
|
+
|
|
2163
|
+
| Param | Type | Description |
|
|
2164
|
+
| --- | --- | --- |
|
|
2165
|
+
| ref | <code>string</code> | The reference of the User to retrieve |
|
|
2166
|
+
|
|
2167
|
+
**Example**
|
|
2168
|
+
```js
|
|
2169
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
2170
|
+
|
|
2171
|
+
const users = new SDK.Users(client); // Existing client object
|
|
2172
|
+
|
|
2173
|
+
users.getUser(ref)
|
|
2174
|
+
.then(console.log) // successful response
|
|
2175
|
+
.catch(console.error); // an error occurred
|
|
2176
|
+
```
|
|
2177
|
+
<a name="Users+updateUser"></a>
|
|
2178
|
+
|
|
2179
|
+
### users.updateUser(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2180
|
+
Updates an existing User in the Workspace.
|
|
2181
|
+
|
|
2182
|
+
**Kind**: instance method of [<code>Users</code>](#Users)
|
|
2183
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated User
|
|
2184
|
+
|
|
2185
|
+
| Param | Type | Description |
|
|
2186
|
+
| --- | --- | --- |
|
|
2187
|
+
| request | <code>UpdateUserRequest</code> | The request object that contains the necessary information to update a User |
|
|
2188
|
+
| request.ref | <code>string</code> | The reference of the User to update |
|
|
2189
|
+
| request.name | <code>string</code> | The name of the User |
|
|
2190
|
+
| request.password | <code>string</code> | The password of the User |
|
|
2191
|
+
| request.avatar | <code>string</code> | The avatar of the User |
|
|
2192
|
+
|
|
2193
|
+
**Example**
|
|
2194
|
+
```js
|
|
2195
|
+
const request = {
|
|
2196
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
2197
|
+
name: "John Doe",
|
|
2198
|
+
password: "password",
|
|
2199
|
+
avatar: "https://example.com/avatar.jpg"
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2202
|
+
const users = new SDK.Users(client); // Existing client object
|
|
2203
|
+
|
|
2204
|
+
users.updateUser(request)
|
|
2205
|
+
.then(console.log) // successful response
|
|
2206
|
+
.catch(console.error); // an error occurred
|
|
2207
|
+
```
|
|
2208
|
+
<a name="Users+deleteUser"></a>
|
|
2209
|
+
|
|
2210
|
+
### users.deleteUser(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2211
|
+
Deletes an existing User from Fonoster.
|
|
2212
|
+
Note that this operation is irreversible.
|
|
2213
|
+
|
|
2214
|
+
**Kind**: instance method of [<code>Users</code>](#Users)
|
|
2215
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted User
|
|
2216
|
+
|
|
2217
|
+
| Param | Type | Description |
|
|
2218
|
+
| --- | --- | --- |
|
|
2219
|
+
| ref | <code>string</code> | The reference of the User to delete |
|
|
2220
|
+
|
|
2221
|
+
**Example**
|
|
2222
|
+
```js
|
|
2223
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
2224
|
+
|
|
2225
|
+
const users = new SDK.Users(client); // Existing client object
|
|
2226
|
+
|
|
2227
|
+
users.deleteUser(ref)
|
|
2228
|
+
.then(console.log) // successful response
|
|
2229
|
+
.catch(console.error); // an error occurred
|
|
2230
|
+
```
|
|
2231
|
+
|
|
2232
|
+
<a name="Workspaces"></a>
|
|
2233
|
+
|
|
2234
|
+
## Workspaces
|
|
2235
|
+
Fonoster Workspaces, part of the Fonoster Identity subsystem,
|
|
2236
|
+
allows you to create, update, retrieve, and delete Workspaces in the system.
|
|
2237
|
+
Note that an active Fonoster deployment is required.
|
|
2238
|
+
|
|
2239
|
+
**Kind**: global class
|
|
2240
|
+
**See**
|
|
2241
|
+
|
|
2242
|
+
- AbstractClient
|
|
2243
|
+
- FonosterClient
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
* [Workspaces](#Workspaces)
|
|
2247
|
+
* [new Workspaces(client)](#new_Workspaces_new)
|
|
2248
|
+
* [.createWorkspace(request)](#Workspaces+createWorkspace) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2249
|
+
* [.getWorkspace(ref)](#Workspaces+getWorkspace) ⇒ <code>Promise.<Acl></code>
|
|
2250
|
+
* [.updateWorkspace(request)](#Workspaces+updateWorkspace) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2251
|
+
* [.deleteWorkspace(ref)](#Workspaces+deleteWorkspace) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2252
|
+
* [.listWorkspaces(request)](#Workspaces+listWorkspaces) ⇒ <code>Promise.<ListWorkspacesResponse></code>
|
|
2253
|
+
* [.inviteUserToWorkspace(request)](#Workspaces+inviteUserToWorkspace) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2254
|
+
* [.resendWorkspaceMembershipInvitation(userRef)](#Workspaces+resendWorkspaceMembershipInvitation) ⇒ <code>Promise.<ResendWorkspaceMembershipInvitationResponse></code>
|
|
2255
|
+
* [.removeUserFromWorkspace(userRef)](#Workspaces+removeUserFromWorkspace) ⇒ <code>Promise.<RemoveUserFromWorkspaceResponse></code>
|
|
2256
|
+
|
|
2257
|
+
<a name="new_Workspaces_new"></a>
|
|
2258
|
+
|
|
2259
|
+
### new Workspaces(client)
|
|
2260
|
+
Constructs a new Workspaces object.
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
| Param | Type | Description |
|
|
2264
|
+
| --- | --- | --- |
|
|
2265
|
+
| client | <code>FonosterClient</code> | Client object with underlying implementations to make requests to Fonoster's API |
|
|
2266
|
+
|
|
2267
|
+
**Example**
|
|
2268
|
+
```js
|
|
2269
|
+
const SDK = require("@fonoster/sdk");
|
|
2270
|
+
|
|
2271
|
+
async function main(request) {
|
|
2272
|
+
const apiKey = "your-api-key";
|
|
2273
|
+
const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
2274
|
+
|
|
2275
|
+
try {
|
|
2276
|
+
const client = SDK.Client({ accessKeyId });
|
|
2277
|
+
await client.loginWithApiKey(apiKey);
|
|
2278
|
+
|
|
2279
|
+
const workspaces = new SDK.Workspaces(client);
|
|
2280
|
+
const response = await workspaces.createWorkspace(request);
|
|
2281
|
+
|
|
2282
|
+
console.log(response); // successful response
|
|
2283
|
+
} catch (e) {
|
|
2284
|
+
console.error(e); // an error occurred
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
const request = {
|
|
2289
|
+
name: "My Workspace"
|
|
2290
|
+
};
|
|
2291
|
+
|
|
2292
|
+
main(request).catch(console.error);
|
|
2293
|
+
```
|
|
2294
|
+
<a name="Workspaces+createWorkspace"></a>
|
|
2295
|
+
|
|
2296
|
+
### workspaces.createWorkspace(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2297
|
+
Creates a new Workspace in the system.
|
|
2298
|
+
|
|
2299
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2300
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the created Workspace
|
|
2301
|
+
|
|
2302
|
+
| Param | Type | Description |
|
|
2303
|
+
| --- | --- | --- |
|
|
2304
|
+
| request | <code>CreateWorkspaceRequest</code> | The request object that contains the necessary information to create a new Workspace |
|
|
2305
|
+
| request.name | <code>string</code> | The name of the Workspace |
|
|
2306
|
+
|
|
2307
|
+
**Example**
|
|
2308
|
+
```js
|
|
2309
|
+
const request = {
|
|
2310
|
+
name: "My Workspace"
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2314
|
+
|
|
2315
|
+
workspaces.createWorkspace(request)
|
|
2316
|
+
.then(console.log) // successful response
|
|
2317
|
+
.catch(console.error); // an error occurred
|
|
2318
|
+
```
|
|
2319
|
+
<a name="Workspaces+getWorkspace"></a>
|
|
2320
|
+
|
|
2321
|
+
### workspaces.getWorkspace(ref) ⇒ <code>Promise.<Acl></code>
|
|
2322
|
+
Retrieves an existing Workspace in the system.
|
|
2323
|
+
|
|
2324
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2325
|
+
**Returns**: <code>Promise.<Acl></code> - - The response object that contains the Workspace
|
|
2326
|
+
|
|
2327
|
+
| Param | Type | Description |
|
|
2328
|
+
| --- | --- | --- |
|
|
2329
|
+
| ref | <code>string</code> | The reference of the Workspace to retrieve |
|
|
2330
|
+
|
|
2331
|
+
**Example**
|
|
2332
|
+
```js
|
|
2333
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
2334
|
+
|
|
2335
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2336
|
+
|
|
2337
|
+
workspaces.getWorkspace(ref)
|
|
2338
|
+
.then(console.log) // successful response
|
|
2339
|
+
.catch(console.error); // an error occurred
|
|
2340
|
+
```
|
|
2341
|
+
<a name="Workspaces+updateWorkspace"></a>
|
|
2342
|
+
|
|
2343
|
+
### workspaces.updateWorkspace(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2344
|
+
Updates an existing Workspace in the system.
|
|
2345
|
+
|
|
2346
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2347
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the updated Workspace
|
|
2348
|
+
|
|
2349
|
+
| Param | Type | Description |
|
|
2350
|
+
| --- | --- | --- |
|
|
2351
|
+
| request | <code>UpdateWorkspaceRequest</code> | The request object that contains the necessary information to update a Workspace |
|
|
2352
|
+
| request.ref | <code>string</code> | The reference of the Workspace to update |
|
|
2353
|
+
| request.name | <code>string</code> | The name of the Workspace |
|
|
2354
|
+
|
|
2355
|
+
**Example**
|
|
2356
|
+
```js
|
|
2357
|
+
const request = {
|
|
2358
|
+
ref: "00000000-0000-0000-0000-000000000000",
|
|
2359
|
+
name: "My Workspace"
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2362
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2363
|
+
|
|
2364
|
+
workspaces.updateWorkspace(request)
|
|
2365
|
+
.then(console.log) // successful response
|
|
2366
|
+
.catch(console.error); // an error occurred
|
|
2367
|
+
```
|
|
2368
|
+
<a name="Workspaces+deleteWorkspace"></a>
|
|
2369
|
+
|
|
2370
|
+
### workspaces.deleteWorkspace(ref) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2371
|
+
Deletes an existing Workspace from Fonoster.
|
|
2372
|
+
Note that this operation is irreversible.
|
|
2373
|
+
|
|
2374
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2375
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the deleted Workspace
|
|
2376
|
+
|
|
2377
|
+
| Param | Type | Description |
|
|
2378
|
+
| --- | --- | --- |
|
|
2379
|
+
| ref | <code>string</code> | The reference of the Workspace to delete |
|
|
2380
|
+
|
|
2381
|
+
**Example**
|
|
2382
|
+
```js
|
|
2383
|
+
const ref = "00000000-0000-0000-0000-000000000000"
|
|
2384
|
+
|
|
2385
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2386
|
+
|
|
2387
|
+
workspaces.deleteWorkspace(ref)
|
|
2388
|
+
.then(console.log) // successful response
|
|
2389
|
+
.catch(console.error); // an error occurred
|
|
2390
|
+
```
|
|
2391
|
+
<a name="Workspaces+listWorkspaces"></a>
|
|
2392
|
+
|
|
2393
|
+
### workspaces.listWorkspaces(request) ⇒ <code>Promise.<ListWorkspacesResponse></code>
|
|
2394
|
+
Retrieves a list of Workspaces from a Workspace.
|
|
2395
|
+
|
|
2396
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2397
|
+
**Returns**: <code>Promise.<ListWorkspacesResponse></code> - - The response object that contains the list of Workspaces
|
|
2398
|
+
|
|
2399
|
+
| Param | Type | Description |
|
|
2400
|
+
| --- | --- | --- |
|
|
2401
|
+
| request | <code>ListWorkspacesRequest</code> | The request object that contains the necessary information to retrieve a list of Workspaces |
|
|
2402
|
+
| request.pageSize | <code>number</code> | The workspace of Workspaces to retrieve |
|
|
2403
|
+
| request.pageToken | <code>string</code> | The token to retrieve the next page of Workspaces |
|
|
2404
|
+
|
|
2405
|
+
**Example**
|
|
2406
|
+
```js
|
|
2407
|
+
const request = {
|
|
2408
|
+
pageSize: 10,
|
|
2409
|
+
pageToken: "00000000-0000-0000-0000-000000000000"
|
|
2410
|
+
};
|
|
2411
|
+
|
|
2412
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2413
|
+
|
|
2414
|
+
workspaces.listWorkspaces(request)
|
|
2415
|
+
.then(console.log) // successful response
|
|
2416
|
+
.catch(console.error); // an error occurred
|
|
2417
|
+
```
|
|
2418
|
+
<a name="Workspaces+inviteUserToWorkspace"></a>
|
|
2419
|
+
|
|
2420
|
+
### workspaces.inviteUserToWorkspace(request) ⇒ <code>Promise.<BaseApiObject></code>
|
|
2421
|
+
Invites a User to a Workspace.
|
|
2422
|
+
|
|
2423
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2424
|
+
**Returns**: <code>Promise.<BaseApiObject></code> - - The response object that contains the reference to the invitation
|
|
2425
|
+
|
|
2426
|
+
| Param | Type | Description |
|
|
2427
|
+
| --- | --- | --- |
|
|
2428
|
+
| request | <code>InviteUserToWorkspaceRequest</code> | The request object that contains the necessary information to invite a User to a Workspace |
|
|
2429
|
+
| request.workspaceRef | <code>string</code> | The reference of the Workspace to invite the User to |
|
|
2430
|
+
| request.email | <code>string</code> | The email of the User to invite |
|
|
2431
|
+
| request.password | <code>string</code> | Temporary password for the User. Leave empty to generate a random password |
|
|
2432
|
+
|
|
2433
|
+
**Example**
|
|
2434
|
+
```js
|
|
2435
|
+
const request = {
|
|
2436
|
+
workspaceRef: "00000000-0000-0000-0000-000000000000",
|
|
2437
|
+
email: "jane.doe@example.com",
|
|
2438
|
+
role: "WORKSPACE_MEMBER",
|
|
2439
|
+
};
|
|
2440
|
+
|
|
2441
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2442
|
+
|
|
2443
|
+
workspaces.inviteUserToWorkspace(request)
|
|
2444
|
+
.then(console.log) // successful response
|
|
2445
|
+
.catch(console.error); // an error occurred
|
|
2446
|
+
```
|
|
2447
|
+
<a name="Workspaces+resendWorkspaceMembershipInvitation"></a>
|
|
2448
|
+
|
|
2449
|
+
### workspaces.resendWorkspaceMembershipInvitation(userRef) ⇒ <code>Promise.<ResendWorkspaceMembershipInvitationResponse></code>
|
|
2450
|
+
Resend a Workspace membership invitation.
|
|
2451
|
+
|
|
2452
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2453
|
+
**Returns**: <code>Promise.<ResendWorkspaceMembershipInvitationResponse></code> - - The response object that contains the reference to the invitation
|
|
2454
|
+
|
|
2455
|
+
| Param | Type | Description |
|
|
2456
|
+
| --- | --- | --- |
|
|
2457
|
+
| userRef | <code>string</code> | The reference to the user to resend the invitation |
|
|
2458
|
+
|
|
2459
|
+
**Example**
|
|
2460
|
+
```js
|
|
2461
|
+
const userRef: "00000000-0000-0000-0000-000000000000";
|
|
2462
|
+
|
|
2463
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
2464
|
+
|
|
2465
|
+
workspaces.resendWorkspaceMembershipInvitation(request)
|
|
2466
|
+
.then(console.log) // successful response
|
|
2467
|
+
.catch(console.error); // an error occurred
|
|
2468
|
+
```
|
|
2469
|
+
<a name="Workspaces+removeUserFromWorkspace"></a>
|
|
2470
|
+
|
|
2471
|
+
### workspaces.removeUserFromWorkspace(userRef) ⇒ <code>Promise.<RemoveUserFromWorkspaceResponse></code>
|
|
2472
|
+
Removes a User from a Workspace.
|
|
2473
|
+
|
|
2474
|
+
**Kind**: instance method of [<code>Workspaces</code>](#Workspaces)
|
|
2475
|
+
**Returns**: <code>Promise.<RemoveUserFromWorkspaceResponse></code> - - The response object that contains the reference to the removed User
|
|
2476
|
+
|
|
2477
|
+
| Param | Type | Description |
|
|
2478
|
+
| --- | --- | --- |
|
|
2479
|
+
| userRef | <code>string</code> | The reference of the User to remove from the Workspace |
|
|
2480
|
+
|
|
2481
|
+
**Example**
|
|
2482
|
+
```js
|
|
2483
|
+
const userRef = "00000000-0000-0000-0000-000000000000";
|
|
2484
|
+
|
|
2485
|
+
const workspaces = new SDK.Workspaces(client); // Existing client object
|
|
354
2486
|
|
|
355
|
-
|
|
2487
|
+
workspaces.removeUserFromWorkspace(userRef)
|
|
356
2488
|
.then(console.log) // successful response
|
|
357
2489
|
.catch(console.error); // an error occurred
|
|
358
2490
|
```
|