@routr/sdk 2.1.11 → 2.1.12
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 +1323 -0
- package/dist/acl/acl.d.ts +2 -2
- package/dist/acl/acl.js +2 -2
- package/dist/agents/agents.d.ts +4 -4
- package/dist/agents/agents.js +4 -4
- package/dist/credentials/credentials.d.ts +2 -2
- package/dist/credentials/credentials.js +2 -2
- package/dist/numbers/numbers.d.ts +5 -5
- package/dist/numbers/numbers.js +5 -5
- package/dist/peers/peers.d.ts +2 -2
- package/dist/peers/peers.js +2 -2
- package/dist/trunks/trunks.d.ts +1 -1
- package/dist/trunks/trunks.js +1 -1
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
sdk
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
SDK for Routr Connect server
|
|
5
|
+
|
|
6
|
+
[](https://routr.io)
|
|
7
|
+
[](https://npmjs.org/package/@routr/sdk)
|
|
8
|
+
[](https://npmjs.org/package/@routr/sdk)
|
|
9
|
+
[](https://github.com/fonoster/routr/blob/main/package.json)
|
|
10
|
+
|
|
11
|
+
<!-- toc -->
|
|
12
|
+
* [Installation](#installation)
|
|
13
|
+
* [APIs](#apis)
|
|
14
|
+
<!-- tocstop -->
|
|
15
|
+
# Installation
|
|
16
|
+
<!-- installation -->
|
|
17
|
+
```sh-session
|
|
18
|
+
$ npm install --save @routr/sdk
|
|
19
|
+
```
|
|
20
|
+
<!-- usagestop -->
|
|
21
|
+
# APIs
|
|
22
|
+
<!-- apis -->
|
|
23
|
+
* [`Access Control List`](#ACL)
|
|
24
|
+
* [`Agents`](#Agents)
|
|
25
|
+
* [`Credentials`](#Credentials)
|
|
26
|
+
* [`Domains`](#Domains)
|
|
27
|
+
* [`Numbers`](#Numbers)
|
|
28
|
+
* [`Peers`](#Peers)
|
|
29
|
+
* [`Trunks`](#Trunks)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<a name="ACL"></a>
|
|
33
|
+
|
|
34
|
+
## ACL ⇐ <code>APIClient</code>
|
|
35
|
+
Use Routr ACL, a capability of Routr SIP Proxy, to create, update, get
|
|
36
|
+
and delete Access Control Lists. The ACL API requires of a running Routr deployment.
|
|
37
|
+
|
|
38
|
+
**Kind**: global class
|
|
39
|
+
**Extends**: <code>APIClient</code>
|
|
40
|
+
**See**: module:core:APIClient
|
|
41
|
+
|
|
42
|
+
* [ACL](#ACL) ⇐ <code>APIClient</code>
|
|
43
|
+
* [new ACL(options)](#new_ACL_new)
|
|
44
|
+
* [.createACL(request)](#ACL+createACL) ⇒ <code>Promise.<CreateACLResponse></code>
|
|
45
|
+
* [.updateACL(request)](#ACL+updateACL) ⇒ <code>Promise.<UpdateACLResponse></code>
|
|
46
|
+
* [.getACL(ref)](#ACL+getACL) ⇒ <code>Promise.<GetACLResponse></code>
|
|
47
|
+
* [.deleteACL(ref)](#ACL+deleteACL) ⇒ <code>Promise.<void></code>
|
|
48
|
+
* [.listACLs(request)](#ACL+listACLs) ⇒ <code>Promise.<ListACLResponse></code>
|
|
49
|
+
|
|
50
|
+
<a name="new_ACL_new"></a>
|
|
51
|
+
|
|
52
|
+
### new ACL(options)
|
|
53
|
+
Constructs a new ACL API object.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
| Param | Type | Description |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
59
|
+
|
|
60
|
+
**Example**
|
|
61
|
+
```js
|
|
62
|
+
const SDK = require("@routr/sdk")
|
|
63
|
+
const acl = new SDK.ACL()
|
|
64
|
+
|
|
65
|
+
const request = {
|
|
66
|
+
name: "Peer network",
|
|
67
|
+
allow: "27.116.56.0/22",
|
|
68
|
+
deny: "0.0.0.0/0"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
acl.createACL(request)
|
|
72
|
+
.then(console.log)
|
|
73
|
+
.catch(console.error) // an error occurred
|
|
74
|
+
```
|
|
75
|
+
<a name="ACL+createACL"></a>
|
|
76
|
+
|
|
77
|
+
### acL.createACL(request) ⇒ <code>Promise.<CreateACLResponse></code>
|
|
78
|
+
Creates a new AccessControlList on Routr.
|
|
79
|
+
|
|
80
|
+
**Kind**: instance method of [<code>ACL</code>](#ACL)
|
|
81
|
+
**Returns**: <code>Promise.<CreateACLResponse></code> - The newly created AccessControlList
|
|
82
|
+
**Throws**:
|
|
83
|
+
|
|
84
|
+
- if request is null
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
| Param | Type | Description |
|
|
88
|
+
| --- | --- | --- |
|
|
89
|
+
| request | <code>CreateACLRequest</code> | The request to create an ACL |
|
|
90
|
+
| request.name | <code>string</code> | Name of the ACL |
|
|
91
|
+
| request.allow | <code>Array.<string></code> | List of IP addresses or CIDR blocks to allow |
|
|
92
|
+
| request.deny | <code>Array.<string></code> | List of IP addresses or CIDR blocks to deny |
|
|
93
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
94
|
+
|
|
95
|
+
**Example**
|
|
96
|
+
```js
|
|
97
|
+
const request = {
|
|
98
|
+
name: "Peer network",
|
|
99
|
+
allow: "27.116.56.0/22",
|
|
100
|
+
deny: "0.0.0.0/0"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
acl.createACL(request)
|
|
104
|
+
.then(console.log)
|
|
105
|
+
.catch(console.error) // an error occurred
|
|
106
|
+
```
|
|
107
|
+
<a name="ACL+updateACL"></a>
|
|
108
|
+
|
|
109
|
+
### acL.updateACL(request) ⇒ <code>Promise.<UpdateACLResponse></code>
|
|
110
|
+
Updates an already existing AccessControlList on Routr.
|
|
111
|
+
|
|
112
|
+
**Kind**: instance method of [<code>ACL</code>](#ACL)
|
|
113
|
+
**Returns**: <code>Promise.<UpdateACLResponse></code> - The AccessControlList
|
|
114
|
+
|
|
115
|
+
| Param | Type | Description |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| request | <code>UpdateACLRequest</code> | Partial with the fields to update |
|
|
118
|
+
| request.name | <code>string</code> | Name of the ACL |
|
|
119
|
+
| request.allow | <code>Array.<string></code> | List of IP addresses or CIDR blocks to allow |
|
|
120
|
+
| request.deny | <code>Array.<string></code> | List of IP addresses or CIDR blocks to deny |
|
|
121
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
122
|
+
|
|
123
|
+
**Example**
|
|
124
|
+
```js
|
|
125
|
+
const request = {
|
|
126
|
+
ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
127
|
+
name: "Peer network updated",
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
acl.updateACL(request)
|
|
131
|
+
.then(console.log)
|
|
132
|
+
.catch(console.error) // an error occurred
|
|
133
|
+
```
|
|
134
|
+
<a name="ACL+getACL"></a>
|
|
135
|
+
|
|
136
|
+
### acL.getACL(ref) ⇒ <code>Promise.<GetACLResponse></code>
|
|
137
|
+
Gets an AccessControlList from Routr.
|
|
138
|
+
|
|
139
|
+
**Kind**: instance method of [<code>ACL</code>](#ACL)
|
|
140
|
+
**Returns**: <code>Promise.<GetACLResponse></code> - The AccessControlList
|
|
141
|
+
|
|
142
|
+
| Param | Type | Description |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| ref | <code>string</code> | The ACL reference |
|
|
145
|
+
|
|
146
|
+
**Example**
|
|
147
|
+
```js
|
|
148
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
149
|
+
|
|
150
|
+
acl.getACL(ref)
|
|
151
|
+
.then(console.log)
|
|
152
|
+
.catch(console.error) // an error occurred
|
|
153
|
+
```
|
|
154
|
+
<a name="ACL+deleteACL"></a>
|
|
155
|
+
|
|
156
|
+
### acL.deleteACL(ref) ⇒ <code>Promise.<void></code>
|
|
157
|
+
Deletes an AccessControlList from Routr.
|
|
158
|
+
|
|
159
|
+
**Kind**: instance method of [<code>ACL</code>](#ACL)
|
|
160
|
+
|
|
161
|
+
| Param | Type | Description |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| ref | <code>string</code> | The ACL reference |
|
|
164
|
+
|
|
165
|
+
**Example**
|
|
166
|
+
```js
|
|
167
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
168
|
+
|
|
169
|
+
acl.deleteACL(ref)
|
|
170
|
+
.then(console.log)
|
|
171
|
+
.catch(console.error) // an error occurred
|
|
172
|
+
```
|
|
173
|
+
<a name="ACL+listACLs"></a>
|
|
174
|
+
|
|
175
|
+
### acL.listACLs(request) ⇒ <code>Promise.<ListACLResponse></code>
|
|
176
|
+
Lists all AccessControlLists from Routr with pagination.
|
|
177
|
+
|
|
178
|
+
**Kind**: instance method of [<code>ACL</code>](#ACL)
|
|
179
|
+
**Returns**: <code>Promise.<ListACLResponse></code> - The list of AccessControlLists
|
|
180
|
+
|
|
181
|
+
| Param | Type | Description |
|
|
182
|
+
| --- | --- | --- |
|
|
183
|
+
| request | <code>ListACLRequest</code> | The request to list ACLs |
|
|
184
|
+
| request.pageSize | <code>number</code> | The number of ACLs to return |
|
|
185
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
186
|
+
|
|
187
|
+
**Example**
|
|
188
|
+
```js
|
|
189
|
+
const request = {
|
|
190
|
+
pageSize: 10
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
acl.listACLs(request)
|
|
194
|
+
.then(console.log)
|
|
195
|
+
.catch(console.error) // an error occurred
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
<a name="Agents"></a>
|
|
199
|
+
|
|
200
|
+
## Agents ⇐ <code>APIClient</code>
|
|
201
|
+
Use Routr Agents, a capability of Routr SIP Proxy, to create, update, get
|
|
202
|
+
and delete Agents. The Agents API requires of a running Routr deployment.
|
|
203
|
+
|
|
204
|
+
**Kind**: global class
|
|
205
|
+
**Extends**: <code>APIClient</code>
|
|
206
|
+
**See**: module:core:APIClient
|
|
207
|
+
|
|
208
|
+
* [Agents](#Agents) ⇐ <code>APIClient</code>
|
|
209
|
+
* [new Agents(options)](#new_Agents_new)
|
|
210
|
+
* [.createAgent(request)](#Agents+createAgent) ⇒ <code>Promise.<CreateAgentResponse></code>
|
|
211
|
+
* [.updateAgent(request)](#Agents+updateAgent) ⇒ <code>Promise.<UpdateAgentResponse></code>
|
|
212
|
+
* [.getAgent(ref)](#Agents+getAgent) ⇒ <code>Promise.<GetAgentResponse></code>
|
|
213
|
+
* [.deleteAgent(ref)](#Agents+deleteAgent) ⇒ <code>Promise.<void></code>
|
|
214
|
+
* [.listAgents(request)](#Agents+listAgents) ⇒ <code>Promise.<ListAgentResponse></code>
|
|
215
|
+
|
|
216
|
+
<a name="new_Agents_new"></a>
|
|
217
|
+
|
|
218
|
+
### new Agents(options)
|
|
219
|
+
Constructs a new Agent API object.
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
| Param | Type | Description |
|
|
223
|
+
| --- | --- | --- |
|
|
224
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
225
|
+
|
|
226
|
+
**Example**
|
|
227
|
+
```js
|
|
228
|
+
const SDK = require("@routr/sdk")
|
|
229
|
+
const agents = new SDK.Agents()
|
|
230
|
+
|
|
231
|
+
const request = {
|
|
232
|
+
name: "Jonh Doe",
|
|
233
|
+
username: "jdoe",
|
|
234
|
+
privacy: Privacy.PRIVATE,
|
|
235
|
+
domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
236
|
+
credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
237
|
+
enabled: true,
|
|
238
|
+
extended: {
|
|
239
|
+
"key": "value"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
agents.createAgent(request)
|
|
244
|
+
.then(console.log)
|
|
245
|
+
.catch(console.error) // an error occurred
|
|
246
|
+
```
|
|
247
|
+
<a name="Agents+createAgent"></a>
|
|
248
|
+
|
|
249
|
+
### agents.createAgent(request) ⇒ <code>Promise.<CreateAgentResponse></code>
|
|
250
|
+
Creates a new Agent on Routr.
|
|
251
|
+
|
|
252
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
253
|
+
**Returns**: <code>Promise.<CreateAgentResponse></code> - The newly created Agent
|
|
254
|
+
**Throws**:
|
|
255
|
+
|
|
256
|
+
- if request is null
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
| Param | Type | Description |
|
|
260
|
+
| --- | --- | --- |
|
|
261
|
+
| request | <code>CreateAgentRequest</code> | The request to create an Agent |
|
|
262
|
+
| request.name | <code>string</code> | Name of the Agent |
|
|
263
|
+
| request.username | <code>string</code> | Username of the Agent |
|
|
264
|
+
| request.privacy | <code>Privacy</code> | Privacy of the Agent (e.g., Privacy.PRIVATE) |
|
|
265
|
+
| request.domainRef | <code>string</code> | Domain reference of the Domain the Agent belongs to |
|
|
266
|
+
| request.credentialsRef | <code>string</code> | Credentials reference of the Credentials for the Agent |
|
|
267
|
+
| request.enabled | <code>boolean</code> | Whether the Agent is enabled or not (for future use) |
|
|
268
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
269
|
+
|
|
270
|
+
**Example**
|
|
271
|
+
```js
|
|
272
|
+
const request = {
|
|
273
|
+
name: "Jonh Doe",
|
|
274
|
+
username: "jdoe",
|
|
275
|
+
privacy: Privacy.PRIVATE,
|
|
276
|
+
domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
277
|
+
credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
278
|
+
enabled: true,
|
|
279
|
+
extended: {
|
|
280
|
+
"key": "value"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
agents.createAgent(request)
|
|
285
|
+
.then(console.log)
|
|
286
|
+
.catch(console.error) // an error occurred
|
|
287
|
+
```
|
|
288
|
+
<a name="Agents+updateAgent"></a>
|
|
289
|
+
|
|
290
|
+
### agents.updateAgent(request) ⇒ <code>Promise.<UpdateAgentResponse></code>
|
|
291
|
+
Updates an already existing Agent on Routr.
|
|
292
|
+
|
|
293
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
294
|
+
**Returns**: <code>Promise.<UpdateAgentResponse></code> - The updated Agent
|
|
295
|
+
|
|
296
|
+
| Param | Type | Description |
|
|
297
|
+
| --- | --- | --- |
|
|
298
|
+
| request | <code>UpdateAgentRequest</code> | Partial with the fields to update |
|
|
299
|
+
| request.name | <code>string</code> | Name of the Agent |
|
|
300
|
+
| request.privacy | <code>Privacy</code> | Privacy of the Agent (e.g., Privacy.PRIVATE) |
|
|
301
|
+
| request.domainRef | <code>string</code> | Domain reference of the Domain the Agent belongs to |
|
|
302
|
+
| request.credentialsRef | <code>string</code> | Credentials reference of the Credentials for the Agent |
|
|
303
|
+
| request.enabled | <code>boolean</code> | Whether the Agent is enabled or not (for future use) |
|
|
304
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
305
|
+
|
|
306
|
+
**Example**
|
|
307
|
+
```js
|
|
308
|
+
const request = {
|
|
309
|
+
ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
310
|
+
name: "John D Doe",
|
|
311
|
+
enabled: false
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
agents.updateAgent(request)
|
|
315
|
+
.then(console.log)
|
|
316
|
+
.catch(console.error) // an error occurred
|
|
317
|
+
```
|
|
318
|
+
<a name="Agents+getAgent"></a>
|
|
319
|
+
|
|
320
|
+
### agents.getAgent(ref) ⇒ <code>Promise.<GetAgentResponse></code>
|
|
321
|
+
Gets an Agent from Routr.
|
|
322
|
+
|
|
323
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
324
|
+
**Returns**: <code>Promise.<GetAgentResponse></code> - The Agent
|
|
325
|
+
|
|
326
|
+
| Param | Type | Description |
|
|
327
|
+
| --- | --- | --- |
|
|
328
|
+
| ref | <code>string</code> | The Agent's reference |
|
|
329
|
+
|
|
330
|
+
**Example**
|
|
331
|
+
```js
|
|
332
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
333
|
+
|
|
334
|
+
agents.getAgent(ref)
|
|
335
|
+
.then(console.log)
|
|
336
|
+
.catch(console.error) // an error occurred
|
|
337
|
+
```
|
|
338
|
+
<a name="Agents+deleteAgent"></a>
|
|
339
|
+
|
|
340
|
+
### agents.deleteAgent(ref) ⇒ <code>Promise.<void></code>
|
|
341
|
+
Deletes an Agent from Routr.
|
|
342
|
+
|
|
343
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
344
|
+
|
|
345
|
+
| Param | Type | Description |
|
|
346
|
+
| --- | --- | --- |
|
|
347
|
+
| ref | <code>string</code> | The Agent's reference |
|
|
348
|
+
|
|
349
|
+
**Example**
|
|
350
|
+
```js
|
|
351
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
352
|
+
|
|
353
|
+
agents.deleteAgent(ref)
|
|
354
|
+
.then(console.log)
|
|
355
|
+
.catch(console.error) // an error occurred
|
|
356
|
+
```
|
|
357
|
+
<a name="Agents+listAgents"></a>
|
|
358
|
+
|
|
359
|
+
### agents.listAgents(request) ⇒ <code>Promise.<ListAgentResponse></code>
|
|
360
|
+
Lists all Agents from Routr with pagination.
|
|
361
|
+
|
|
362
|
+
**Kind**: instance method of [<code>Agents</code>](#Agents)
|
|
363
|
+
**Returns**: <code>Promise.<ListAgentResponse></code> - The list of Agents in the current page
|
|
364
|
+
|
|
365
|
+
| Param | Type | Description |
|
|
366
|
+
| --- | --- | --- |
|
|
367
|
+
| request | <code>ListAgentRequest</code> | The request to list Agents |
|
|
368
|
+
| request.pageSize | <code>number</code> | The number of Agents to return |
|
|
369
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
370
|
+
|
|
371
|
+
**Example**
|
|
372
|
+
```js
|
|
373
|
+
const request = {
|
|
374
|
+
pageSize: 10
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
agents.listAgents(request)
|
|
378
|
+
.then(console.log)
|
|
379
|
+
.catch(console.error) // an error occurred
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
<a name="Credentials"></a>
|
|
383
|
+
|
|
384
|
+
## Credentials ⇐ <code>APIClient</code>
|
|
385
|
+
Use Routr Credentials, a capability of Routr SIP Proxy, to create, update, get
|
|
386
|
+
and delete Credentials. The Credentials API requires of a running Routr deployment.
|
|
387
|
+
|
|
388
|
+
**Kind**: global class
|
|
389
|
+
**Extends**: <code>APIClient</code>
|
|
390
|
+
**See**: module:core:APIClient
|
|
391
|
+
|
|
392
|
+
* [Credentials](#Credentials) ⇐ <code>APIClient</code>
|
|
393
|
+
* [new Credentials(options)](#new_Credentials_new)
|
|
394
|
+
* [.createCredentials(request)](#Credentials+createCredentials) ⇒ <code>Promise.<CreateCredentialsResponse></code>
|
|
395
|
+
* [.updateCredentials(request)](#Credentials+updateCredentials) ⇒ <code>Promise.<UpdateCredentialsResponse></code>
|
|
396
|
+
* [.getCredentials(ref)](#Credentials+getCredentials) ⇒ <code>Promise.<GetCredentialsResponse></code>
|
|
397
|
+
* [.deleteCredentials(ref)](#Credentials+deleteCredentials) ⇒ <code>Promise.<void></code>
|
|
398
|
+
* [.listCredentials(request)](#Credentials+listCredentials) ⇒ <code>Promise.<ListCredentialsResponse></code>
|
|
399
|
+
|
|
400
|
+
<a name="new_Credentials_new"></a>
|
|
401
|
+
|
|
402
|
+
### new Credentials(options)
|
|
403
|
+
Constructs a new Credentials API object.
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
| Param | Type | Description |
|
|
407
|
+
| --- | --- | --- |
|
|
408
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
409
|
+
|
|
410
|
+
**Example**
|
|
411
|
+
```js
|
|
412
|
+
const SDK = require("@routr/sdk")
|
|
413
|
+
const credentials = new SDK.Credentials()
|
|
414
|
+
|
|
415
|
+
const request = {
|
|
416
|
+
name: "Credentials for John Doe",
|
|
417
|
+
username: "jdoe",
|
|
418
|
+
password: "123456",
|
|
419
|
+
extended: {
|
|
420
|
+
"key": "value"
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
credentials.createCredentials(request)
|
|
425
|
+
.then(console.log)
|
|
426
|
+
.catch(console.error) // an error occurred
|
|
427
|
+
```
|
|
428
|
+
<a name="Credentials+createCredentials"></a>
|
|
429
|
+
|
|
430
|
+
### credentials.createCredentials(request) ⇒ <code>Promise.<CreateCredentialsResponse></code>
|
|
431
|
+
Creates a new Credentials on Routr.
|
|
432
|
+
|
|
433
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
434
|
+
**Returns**: <code>Promise.<CreateCredentialsResponse></code> - The newly created Credentials
|
|
435
|
+
**Throws**:
|
|
436
|
+
|
|
437
|
+
- if request is null
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
| Param | Type | Description |
|
|
441
|
+
| --- | --- | --- |
|
|
442
|
+
| request | <code>CreateCredentialsRequest</code> | The request to create an Credentials |
|
|
443
|
+
| request.name | <code>string</code> | The friendly name of the Credentials |
|
|
444
|
+
| request.username | <code>string</code> | Username of the Credentials |
|
|
445
|
+
| request.password | <code>string</code> | Password of the Credentials |
|
|
446
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
447
|
+
|
|
448
|
+
**Example**
|
|
449
|
+
```js
|
|
450
|
+
const request = {
|
|
451
|
+
name: "Credentials for John Doe",
|
|
452
|
+
username: "jdoe",
|
|
453
|
+
password: "123456",
|
|
454
|
+
extended: {
|
|
455
|
+
"key": "value"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
credentials.createCredentials(request)
|
|
460
|
+
.then(console.log)
|
|
461
|
+
.catch(console.error) // an error occurred
|
|
462
|
+
```
|
|
463
|
+
<a name="Credentials+updateCredentials"></a>
|
|
464
|
+
|
|
465
|
+
### credentials.updateCredentials(request) ⇒ <code>Promise.<UpdateCredentialsResponse></code>
|
|
466
|
+
Updates an already existing Credentials on Routr.
|
|
467
|
+
|
|
468
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
469
|
+
**Returns**: <code>Promise.<UpdateCredentialsResponse></code> - The updated Credentials
|
|
470
|
+
|
|
471
|
+
| Param | Type | Description |
|
|
472
|
+
| --- | --- | --- |
|
|
473
|
+
| request | <code>UpdateCredentialsRequest</code> | Partial with the fields to update |
|
|
474
|
+
| request.name | <code>string</code> | The friendly name of the Credentials |
|
|
475
|
+
| request.username | <code>string</code> | Username of the Credentials |
|
|
476
|
+
| request.password | <code>string</code> | Password of the Credentials |
|
|
477
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
478
|
+
|
|
479
|
+
**Example**
|
|
480
|
+
```js
|
|
481
|
+
const request = {
|
|
482
|
+
ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
483
|
+
name: "John Doe's Credentials"
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
credentials.updateCredentials(request)
|
|
487
|
+
.then(console.log)
|
|
488
|
+
.catch(console.error) // an error occurred
|
|
489
|
+
```
|
|
490
|
+
<a name="Credentials+getCredentials"></a>
|
|
491
|
+
|
|
492
|
+
### credentials.getCredentials(ref) ⇒ <code>Promise.<GetCredentialsResponse></code>
|
|
493
|
+
Gets an Credentials from Routr.
|
|
494
|
+
|
|
495
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
496
|
+
**Returns**: <code>Promise.<GetCredentialsResponse></code> - The Credentials
|
|
497
|
+
|
|
498
|
+
| Param | Type | Description |
|
|
499
|
+
| --- | --- | --- |
|
|
500
|
+
| ref | <code>string</code> | The Credentials's reference |
|
|
501
|
+
|
|
502
|
+
**Example**
|
|
503
|
+
```js
|
|
504
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
505
|
+
|
|
506
|
+
credentials.getCredentials(ref)
|
|
507
|
+
.then(console.log)
|
|
508
|
+
.catch(console.error) // an error occurred
|
|
509
|
+
```
|
|
510
|
+
<a name="Credentials+deleteCredentials"></a>
|
|
511
|
+
|
|
512
|
+
### credentials.deleteCredentials(ref) ⇒ <code>Promise.<void></code>
|
|
513
|
+
Deletes an Credentials from Routr.
|
|
514
|
+
|
|
515
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
516
|
+
|
|
517
|
+
| Param | Type | Description |
|
|
518
|
+
| --- | --- | --- |
|
|
519
|
+
| ref | <code>string</code> | The Credentials's reference |
|
|
520
|
+
|
|
521
|
+
**Example**
|
|
522
|
+
```js
|
|
523
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
524
|
+
|
|
525
|
+
credentials.deleteCredentials(ref)
|
|
526
|
+
.then(console.log)
|
|
527
|
+
.catch(console.error) // an error occurred
|
|
528
|
+
```
|
|
529
|
+
<a name="Credentials+listCredentials"></a>
|
|
530
|
+
|
|
531
|
+
### credentials.listCredentials(request) ⇒ <code>Promise.<ListCredentialsResponse></code>
|
|
532
|
+
Lists all Credentials from Routr with pagination.
|
|
533
|
+
|
|
534
|
+
**Kind**: instance method of [<code>Credentials</code>](#Credentials)
|
|
535
|
+
**Returns**: <code>Promise.<ListCredentialsResponse></code> - The list of Credentials in the current page
|
|
536
|
+
|
|
537
|
+
| Param | Type | Description |
|
|
538
|
+
| --- | --- | --- |
|
|
539
|
+
| request | <code>ListCredentialsRequest</code> | The request to list Credentials |
|
|
540
|
+
| request.pageSize | <code>number</code> | The number of Credentials to return |
|
|
541
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
542
|
+
|
|
543
|
+
**Example**
|
|
544
|
+
```js
|
|
545
|
+
const request = {
|
|
546
|
+
pageSize: 10
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
credentials.listCredentials(request)
|
|
550
|
+
.then(console.log)
|
|
551
|
+
.catch(console.error) // an error occurred
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
<a name="Domains"></a>
|
|
555
|
+
|
|
556
|
+
## Domains ⇐ <code>APIClient</code>
|
|
557
|
+
Use Routr Domains, a capability of Routr SIP Proxy, to create, update, get
|
|
558
|
+
and delete Domains. The Domains API requires of a running Routr deployment.
|
|
559
|
+
|
|
560
|
+
**Kind**: global class
|
|
561
|
+
**Extends**: <code>APIClient</code>
|
|
562
|
+
**See**: module:core:APIClient
|
|
563
|
+
|
|
564
|
+
* [Domains](#Domains) ⇐ <code>APIClient</code>
|
|
565
|
+
* [new Domains(options)](#new_Domains_new)
|
|
566
|
+
* [.createDomain(request)](#Domains+createDomain) ⇒ <code>Promise.<CreateDomainResponse></code>
|
|
567
|
+
* [.updateDomain(request)](#Domains+updateDomain) ⇒ <code>Promise.<UpdateDomainResponse></code>
|
|
568
|
+
* [.getDomain(ref)](#Domains+getDomain) ⇒ <code>Promise.<GetDomainResponse></code>
|
|
569
|
+
* [.deleteDomain(ref)](#Domains+deleteDomain) ⇒ <code>Promise.<void></code>
|
|
570
|
+
* [.listDomains(request)](#Domains+listDomains) ⇒ <code>Promise.<ListDomainResponse></code>
|
|
571
|
+
|
|
572
|
+
<a name="new_Domains_new"></a>
|
|
573
|
+
|
|
574
|
+
### new Domains(options)
|
|
575
|
+
Constructs a new Domain API object.
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
| Param | Type | Description |
|
|
579
|
+
| --- | --- | --- |
|
|
580
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
581
|
+
|
|
582
|
+
**Example**
|
|
583
|
+
```js
|
|
584
|
+
const SDK = require("@routr/sdk")
|
|
585
|
+
const domains = new SDK.Domains()
|
|
586
|
+
|
|
587
|
+
const request = {
|
|
588
|
+
name: "Local domain",
|
|
589
|
+
domainUri: "sip.local",
|
|
590
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
591
|
+
egressPolicies: [{
|
|
592
|
+
rule: ".*",
|
|
593
|
+
numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
594
|
+
}],
|
|
595
|
+
extended: {
|
|
596
|
+
"key": "value"
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
domains.createDomain(request)
|
|
601
|
+
.then(console.log)
|
|
602
|
+
.catch(console.error) // an error occurred
|
|
603
|
+
```
|
|
604
|
+
<a name="Domains+createDomain"></a>
|
|
605
|
+
|
|
606
|
+
### domains.createDomain(request) ⇒ <code>Promise.<CreateDomainResponse></code>
|
|
607
|
+
Creates a new Domain on Routr.
|
|
608
|
+
|
|
609
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
610
|
+
**Returns**: <code>Promise.<CreateDomainResponse></code> - The newly created Domain
|
|
611
|
+
**Throws**:
|
|
612
|
+
|
|
613
|
+
- if request is null
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
| Param | Type | Description |
|
|
617
|
+
| --- | --- | --- |
|
|
618
|
+
| request | <code>CreateDomainRequest</code> | The request to create an Domain |
|
|
619
|
+
| request.name | <code>string</code> | Name of the Domain |
|
|
620
|
+
| request.domainUri | <code>string</code> | The FQDN of the Domain |
|
|
621
|
+
| request.accessControlListRef | <code>string</code> | The reference to the AccessControlList for the Domain |
|
|
622
|
+
| request.egressPolicies | <code>Array.<CC.EgressPolicy></code> | The list of EgressPolicies for the Domain |
|
|
623
|
+
| request.extended | <code>string</code> | Optional extended attributes |
|
|
624
|
+
|
|
625
|
+
**Example**
|
|
626
|
+
```js
|
|
627
|
+
const request = {
|
|
628
|
+
name: "Local domain",
|
|
629
|
+
domainUri: "sip.local",
|
|
630
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
631
|
+
egressPolicies: [{
|
|
632
|
+
rule: ".*",
|
|
633
|
+
numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
634
|
+
}],
|
|
635
|
+
extended: {
|
|
636
|
+
"key": "value"
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
domains.createDomain(request)
|
|
641
|
+
.then(console.log)
|
|
642
|
+
.catch(console.error) // an error occurred
|
|
643
|
+
```
|
|
644
|
+
<a name="Domains+updateDomain"></a>
|
|
645
|
+
|
|
646
|
+
### domains.updateDomain(request) ⇒ <code>Promise.<UpdateDomainResponse></code>
|
|
647
|
+
Updates an already existing Domain on Routr.
|
|
648
|
+
|
|
649
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
650
|
+
**Returns**: <code>Promise.<UpdateDomainResponse></code> - The updated Domain
|
|
651
|
+
|
|
652
|
+
| Param | Type | Description |
|
|
653
|
+
| --- | --- | --- |
|
|
654
|
+
| request | <code>UpdateDomainRequest</code> | Partial with the fields to update |
|
|
655
|
+
| request.name | <code>string</code> | Name of the Domain |
|
|
656
|
+
| request.accessControlListRef | <code>string</code> | The reference to the AccessControlList for the Domain |
|
|
657
|
+
| request.egressPolicies | <code>Array.<CC.EgressPolicy></code> | The list of EgressPolicies for the Domain |
|
|
658
|
+
| request.extended | <code>string</code> | Optional extended attributes |
|
|
659
|
+
|
|
660
|
+
**Example**
|
|
661
|
+
```js
|
|
662
|
+
const request = {
|
|
663
|
+
name: "Local domain updated",
|
|
664
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
domains.updateDomain(request)
|
|
668
|
+
.then(console.log)
|
|
669
|
+
.catch(console.error) // an error occurred
|
|
670
|
+
```
|
|
671
|
+
<a name="Domains+getDomain"></a>
|
|
672
|
+
|
|
673
|
+
### domains.getDomain(ref) ⇒ <code>Promise.<GetDomainResponse></code>
|
|
674
|
+
Gets a Domain from Routr.
|
|
675
|
+
|
|
676
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
677
|
+
**Returns**: <code>Promise.<GetDomainResponse></code> - The Domain
|
|
678
|
+
|
|
679
|
+
| Param | Type | Description |
|
|
680
|
+
| --- | --- | --- |
|
|
681
|
+
| ref | <code>string</code> | The Domain's reference |
|
|
682
|
+
|
|
683
|
+
**Example**
|
|
684
|
+
```js
|
|
685
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
686
|
+
|
|
687
|
+
domains.getDomain(ref)
|
|
688
|
+
.then(console.log)
|
|
689
|
+
.catch(console.error) // an error occurred
|
|
690
|
+
```
|
|
691
|
+
<a name="Domains+deleteDomain"></a>
|
|
692
|
+
|
|
693
|
+
### domains.deleteDomain(ref) ⇒ <code>Promise.<void></code>
|
|
694
|
+
Deletes a Domain from Routr.
|
|
695
|
+
|
|
696
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
697
|
+
|
|
698
|
+
| Param | Type | Description |
|
|
699
|
+
| --- | --- | --- |
|
|
700
|
+
| ref | <code>string</code> | The Domain's reference |
|
|
701
|
+
|
|
702
|
+
**Example**
|
|
703
|
+
```js
|
|
704
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
705
|
+
|
|
706
|
+
domains.deleteDomain(ref)
|
|
707
|
+
.then(console.log)
|
|
708
|
+
.catch(console.error) // an error occurred
|
|
709
|
+
```
|
|
710
|
+
<a name="Domains+listDomains"></a>
|
|
711
|
+
|
|
712
|
+
### domains.listDomains(request) ⇒ <code>Promise.<ListDomainResponse></code>
|
|
713
|
+
Lists all Domains from Routr with pagination.
|
|
714
|
+
|
|
715
|
+
**Kind**: instance method of [<code>Domains</code>](#Domains)
|
|
716
|
+
**Returns**: <code>Promise.<ListDomainResponse></code> - The list of Domains
|
|
717
|
+
|
|
718
|
+
| Param | Type | Description |
|
|
719
|
+
| --- | --- | --- |
|
|
720
|
+
| request | <code>ListDomainRequest</code> | The request to list Domains |
|
|
721
|
+
| request.pageSize | <code>number</code> | The number of Domains to return |
|
|
722
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
723
|
+
|
|
724
|
+
**Example**
|
|
725
|
+
```js
|
|
726
|
+
const request = {
|
|
727
|
+
pageSize: 10
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
domains.listDomains(request)
|
|
731
|
+
.then(console.log)
|
|
732
|
+
.catch(console.error) // an error occurred
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
<a name="Numbers"></a>
|
|
736
|
+
|
|
737
|
+
## Numbers ⇐ <code>APIClient</code>
|
|
738
|
+
Use Routr Numbers, a capability of Routr SIP Proxy, to create, update, get
|
|
739
|
+
and delete Numbers. The Number API requires of a running Routr deployment.
|
|
740
|
+
|
|
741
|
+
**Kind**: global class
|
|
742
|
+
**Extends**: <code>APIClient</code>
|
|
743
|
+
**See**: module:core:APIClient
|
|
744
|
+
|
|
745
|
+
* [Numbers](#Numbers) ⇐ <code>APIClient</code>
|
|
746
|
+
* [new Numbers(options)](#new_Numbers_new)
|
|
747
|
+
* [.createNumber(request)](#Numbers+createNumber) ⇒ <code>Promise.<CreateNumberResponse></code>
|
|
748
|
+
* [.updateNumber(request)](#Numbers+updateNumber) ⇒ <code>Promise.<UpdateNumberResponse></code>
|
|
749
|
+
* [.getNumber(ref)](#Numbers+getNumber) ⇒ <code>Promise.<GetNumberResponse></code>
|
|
750
|
+
* [.deleteNumber(ref)](#Numbers+deleteNumber) ⇒ <code>Promise.<void></code>
|
|
751
|
+
* [.listNumbers(request)](#Numbers+listNumbers) ⇒ <code>Promise.<ListNumberResponse></code>
|
|
752
|
+
|
|
753
|
+
<a name="new_Numbers_new"></a>
|
|
754
|
+
|
|
755
|
+
### new Numbers(options)
|
|
756
|
+
Constructs a new Number API object.
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
| Param | Type | Description |
|
|
760
|
+
| --- | --- | --- |
|
|
761
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
762
|
+
|
|
763
|
+
**Example**
|
|
764
|
+
```js
|
|
765
|
+
const SDK = require("@routr/sdk")
|
|
766
|
+
const numbers = new SDK.Numbers()
|
|
767
|
+
|
|
768
|
+
const request = {
|
|
769
|
+
name: "(415) 555-1212",
|
|
770
|
+
telUrl: "teL:+14155551212",
|
|
771
|
+
trunkRef: "6f941c63-880c-419a-a72a-4a107cbaf5c5",
|
|
772
|
+
aorLink: "sip:100@sip.local",
|
|
773
|
+
city: "San Francisco",
|
|
774
|
+
country: "United States",
|
|
775
|
+
countryISOCode: "US",
|
|
776
|
+
sessionAffinityHeader: "X-Room-Id"
|
|
777
|
+
extraHeaders: [{
|
|
778
|
+
name: "X-Room-Id",
|
|
779
|
+
value: "abc-us-123"
|
|
780
|
+
}],
|
|
781
|
+
extended: {
|
|
782
|
+
"key": "value"
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
numbers.createNumber(request)
|
|
787
|
+
.then(console.log)
|
|
788
|
+
.catch(console.error) // an error occurred
|
|
789
|
+
```
|
|
790
|
+
<a name="Numbers+createNumber"></a>
|
|
791
|
+
|
|
792
|
+
### numbers.createNumber(request) ⇒ <code>Promise.<CreateNumberResponse></code>
|
|
793
|
+
Creates a new Number on Routr.
|
|
794
|
+
|
|
795
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
796
|
+
**Returns**: <code>Promise.<CreateNumberResponse></code> - The newly created Number
|
|
797
|
+
**Throws**:
|
|
798
|
+
|
|
799
|
+
- if request is null
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
| Param | Type | Description |
|
|
803
|
+
| --- | --- | --- |
|
|
804
|
+
| request | <code>CreateNumberRequest</code> | The request to create an Number |
|
|
805
|
+
| request.name | <code>string</code> | Name of the Number |
|
|
806
|
+
| request.telUrl | <code>string</code> | The number URI to be used (e.g., te:+1234567890) |
|
|
807
|
+
| request.aorLink | <code>string</code> | The AOR link to be used (e.g., sip:1001@sip.local) |
|
|
808
|
+
| request.city | <code>string</code> | The city where the number is located |
|
|
809
|
+
| request.country | <code>string</code> | The country where the number is located |
|
|
810
|
+
| request.countryISOCode | <code>string</code> | The country ISO code where the number is located |
|
|
811
|
+
| request.extraHeaders | <code>Array.<Object></code> | Extra headers to be used (e.g., [{name: "X-Room-Id", value: "abc-us-123"}]) |
|
|
812
|
+
| request.trunkRef | <code>string</code> | The Trunk reference to be used |
|
|
813
|
+
| request.sessionAffinityHeader | <code>string</code> | Optional session affinity header |
|
|
814
|
+
| request.extended | <code>string</code> | Optional extended attributes |
|
|
815
|
+
|
|
816
|
+
**Example**
|
|
817
|
+
```js
|
|
818
|
+
const request = {
|
|
819
|
+
name: "(415) 555-1212",
|
|
820
|
+
telUrl: "teL:+14155551212",
|
|
821
|
+
trunkRef: "6f941c63-880c-419a-a72a-4a107cbaf5c5",
|
|
822
|
+
aorLink: "sip:100@sip.local",
|
|
823
|
+
city: "San Francisco",
|
|
824
|
+
country: "United States",
|
|
825
|
+
countryISOCode: "US",
|
|
826
|
+
sessionAffinityHeader: "X-Room-Id"
|
|
827
|
+
extraHeaders: [{
|
|
828
|
+
name: "X-Room-Id",
|
|
829
|
+
value: "abc-us-123"
|
|
830
|
+
}],
|
|
831
|
+
extended: {
|
|
832
|
+
"key": "value"
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
numbers.createNumber(request)
|
|
837
|
+
.then(console.log)
|
|
838
|
+
.catch(console.error) // an error occurred
|
|
839
|
+
```
|
|
840
|
+
<a name="Numbers+updateNumber"></a>
|
|
841
|
+
|
|
842
|
+
### numbers.updateNumber(request) ⇒ <code>Promise.<UpdateNumberResponse></code>
|
|
843
|
+
Updates an already existing Number on Routr.
|
|
844
|
+
|
|
845
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
846
|
+
**Returns**: <code>Promise.<UpdateNumberResponse></code> - The updated Number
|
|
847
|
+
|
|
848
|
+
| Param | Type | Description |
|
|
849
|
+
| --- | --- | --- |
|
|
850
|
+
| request | <code>UpdateNumberRequest</code> | Partial with the fields to update |
|
|
851
|
+
| request.name | <code>string</code> | Name of the Number |
|
|
852
|
+
| request.aorLink | <code>string</code> | The AOR link to be used (e.g., sip:1001@sip.local) |
|
|
853
|
+
| request.extraHeaders | <code>Array.<Object></code> | Extra headers to be used (e.g., [{name: "X-Room-Id", value: "abc-us-123"}]) |
|
|
854
|
+
| request.trunkRef | <code>string</code> | The Trunk reference to be used |
|
|
855
|
+
| request.sessionAffinityHeader | <code>string</code> | Optional session affinity header |
|
|
856
|
+
| request.extended | <code>string</code> | Optional extended attributes |
|
|
857
|
+
|
|
858
|
+
**Example**
|
|
859
|
+
```js
|
|
860
|
+
const request = {
|
|
861
|
+
name: "(415) 555-1212 (friendly name)",
|
|
862
|
+
aorLink: "sip:2001@sip.local"
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
numbers.updateNumber(request)
|
|
866
|
+
.then(console.log)
|
|
867
|
+
.catch(console.error) // an error occurred
|
|
868
|
+
```
|
|
869
|
+
<a name="Numbers+getNumber"></a>
|
|
870
|
+
|
|
871
|
+
### numbers.getNumber(ref) ⇒ <code>Promise.<GetNumberResponse></code>
|
|
872
|
+
Gets a Number from Routr.
|
|
873
|
+
|
|
874
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
875
|
+
**Returns**: <code>Promise.<GetNumberResponse></code> - The Number
|
|
876
|
+
|
|
877
|
+
| Param | Type | Description |
|
|
878
|
+
| --- | --- | --- |
|
|
879
|
+
| ref | <code>string</code> | The Number's reference |
|
|
880
|
+
|
|
881
|
+
**Example**
|
|
882
|
+
```js
|
|
883
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
884
|
+
|
|
885
|
+
numbers.getNumber(ref)
|
|
886
|
+
.then(console.log)
|
|
887
|
+
.catch(console.error) // an error occurred
|
|
888
|
+
```
|
|
889
|
+
<a name="Numbers+deleteNumber"></a>
|
|
890
|
+
|
|
891
|
+
### numbers.deleteNumber(ref) ⇒ <code>Promise.<void></code>
|
|
892
|
+
Deletes a Number from Routr.
|
|
893
|
+
|
|
894
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
895
|
+
|
|
896
|
+
| Param | Type | Description |
|
|
897
|
+
| --- | --- | --- |
|
|
898
|
+
| ref | <code>string</code> | The Number's reference |
|
|
899
|
+
|
|
900
|
+
**Example**
|
|
901
|
+
```js
|
|
902
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
903
|
+
|
|
904
|
+
numbers.deleteNumber(ref)
|
|
905
|
+
.then(console.log)
|
|
906
|
+
.catch(console.error) // an error occurred
|
|
907
|
+
```
|
|
908
|
+
<a name="Numbers+listNumbers"></a>
|
|
909
|
+
|
|
910
|
+
### numbers.listNumbers(request) ⇒ <code>Promise.<ListNumberResponse></code>
|
|
911
|
+
Lists all Numbers from Routr with pagination.
|
|
912
|
+
|
|
913
|
+
**Kind**: instance method of [<code>Numbers</code>](#Numbers)
|
|
914
|
+
**Returns**: <code>Promise.<ListNumberResponse></code> - The list of Numbers
|
|
915
|
+
|
|
916
|
+
| Param | Type | Description |
|
|
917
|
+
| --- | --- | --- |
|
|
918
|
+
| request | <code>ListNumberRequest</code> | The request to list Numbers |
|
|
919
|
+
| request.pageSize | <code>number</code> | The number of Numbers to return |
|
|
920
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
921
|
+
|
|
922
|
+
**Example**
|
|
923
|
+
```js
|
|
924
|
+
const request = {
|
|
925
|
+
pageSize: 10
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
numbers.listNumbers(request)
|
|
929
|
+
.then(console.log)
|
|
930
|
+
.catch(console.error) // an error occurred
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
<a name="Peers"></a>
|
|
934
|
+
|
|
935
|
+
## Peers ⇐ <code>APIClient</code>
|
|
936
|
+
Use Routr Peers, a capability of Routr SIP Proxy, to create, update, get
|
|
937
|
+
and delete Peers. The Peers API requires of a running Routr deployment.
|
|
938
|
+
|
|
939
|
+
**Kind**: global class
|
|
940
|
+
**Extends**: <code>APIClient</code>
|
|
941
|
+
**See**: module:core:APIClient
|
|
942
|
+
|
|
943
|
+
* [Peers](#Peers) ⇐ <code>APIClient</code>
|
|
944
|
+
* [new Peers(options)](#new_Peers_new)
|
|
945
|
+
* [.createPeer(request)](#Peers+createPeer) ⇒ <code>Promise.<CreatePeerResponse></code>
|
|
946
|
+
* [.updatePeer(request)](#Peers+updatePeer) ⇒ <code>Promise.<UpdatePeerResponse></code>
|
|
947
|
+
* [.getPeer(ref)](#Peers+getPeer) ⇒ <code>Promise.<GetPeerResponse></code>
|
|
948
|
+
* [.deletePeer(ref)](#Peers+deletePeer) ⇒ <code>Promise.<void></code>
|
|
949
|
+
* [.listPeers(request)](#Peers+listPeers) ⇒ <code>Promise.<ListPeerResponse></code>
|
|
950
|
+
|
|
951
|
+
<a name="new_Peers_new"></a>
|
|
952
|
+
|
|
953
|
+
### new Peers(options)
|
|
954
|
+
Constructs a new Peer API object.
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
| Param | Type | Description |
|
|
958
|
+
| --- | --- | --- |
|
|
959
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
960
|
+
|
|
961
|
+
**Example**
|
|
962
|
+
```js
|
|
963
|
+
const SDK = require("@routr/sdk")
|
|
964
|
+
const peers = new SDK.Peers()
|
|
965
|
+
|
|
966
|
+
const request = {
|
|
967
|
+
name: "Asterisk Conference Server",
|
|
968
|
+
username: "conference",
|
|
969
|
+
aor: "backend:conference",
|
|
970
|
+
contactAddr: "10.0.0.1:5060",
|
|
971
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
972
|
+
credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
973
|
+
balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
|
|
974
|
+
withSessionAffinity: true,
|
|
975
|
+
enabled: true,
|
|
976
|
+
extended: {
|
|
977
|
+
"key": "value"
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
peers.createPeer(request)
|
|
982
|
+
.then(console.log)
|
|
983
|
+
.catch(console.error) // an error occurred
|
|
984
|
+
```
|
|
985
|
+
<a name="Peers+createPeer"></a>
|
|
986
|
+
|
|
987
|
+
### peers.createPeer(request) ⇒ <code>Promise.<CreatePeerResponse></code>
|
|
988
|
+
Creates a new Peer on Routr.
|
|
989
|
+
|
|
990
|
+
**Kind**: instance method of [<code>Peers</code>](#Peers)
|
|
991
|
+
**Returns**: <code>Promise.<CreatePeerResponse></code> - The newly created Peer
|
|
992
|
+
**Throws**:
|
|
993
|
+
|
|
994
|
+
- if request is null
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
| Param | Type | Description |
|
|
998
|
+
| --- | --- | --- |
|
|
999
|
+
| request | <code>CreatePeerRequest</code> | The request to create an Peer |
|
|
1000
|
+
| request.name | <code>string</code> | Name of the Peer |
|
|
1001
|
+
| request.aor | <code>string</code> | Address of Record of the Peer |
|
|
1002
|
+
| request.contactAddr | <code>string</code> | Optional contact address of the Peer |
|
|
1003
|
+
| request.accessControlListRef | <code>string</code> | Access Control List reference of the Peer |
|
|
1004
|
+
| request.credentialsRef | <code>string</code> | Credentials reference of the Credentials for the Peer |
|
|
1005
|
+
| request.balancingAlgorithm | <code>LoadBalancingAlgorithm</code> | Optional balancing algorithm for the Peer (defaults to "round-robin") |
|
|
1006
|
+
| request.withSessionAffinity | <code>boolean</code> | Whether the Peer has session affinity or not (defaults to false) |
|
|
1007
|
+
| request.enabled | <code>boolean</code> | Whether the Peer is enabled or not (for future use) |
|
|
1008
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
1009
|
+
|
|
1010
|
+
**Example**
|
|
1011
|
+
```js
|
|
1012
|
+
const request = {
|
|
1013
|
+
name: "Asterisk Conference Server",
|
|
1014
|
+
username: "conference",
|
|
1015
|
+
aor: "backend:conference",
|
|
1016
|
+
contactAddr: "10.0.0.1:5060",
|
|
1017
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1018
|
+
credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1019
|
+
balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
|
|
1020
|
+
withSessionAffinity: true,
|
|
1021
|
+
enabled: true,
|
|
1022
|
+
extended: {
|
|
1023
|
+
"key": "value"
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
peers.createPeer(request)
|
|
1028
|
+
.then(console.log)
|
|
1029
|
+
.catch(console.error) // an error occurred
|
|
1030
|
+
```
|
|
1031
|
+
<a name="Peers+updatePeer"></a>
|
|
1032
|
+
|
|
1033
|
+
### peers.updatePeer(request) ⇒ <code>Promise.<UpdatePeerResponse></code>
|
|
1034
|
+
Updates an already existing Peer on Routr.
|
|
1035
|
+
|
|
1036
|
+
**Kind**: instance method of [<code>Peers</code>](#Peers)
|
|
1037
|
+
**Returns**: <code>Promise.<UpdatePeerResponse></code> - The updated Peer
|
|
1038
|
+
|
|
1039
|
+
| Param | Type | Description |
|
|
1040
|
+
| --- | --- | --- |
|
|
1041
|
+
| request | <code>UpdatePeerRequest</code> | Partial with the fields to update |
|
|
1042
|
+
| request.name | <code>string</code> | Name of the Peer |
|
|
1043
|
+
| request.aor | <code>string</code> | Address of Record of the Peer |
|
|
1044
|
+
| request.contactAddr | <code>string</code> | Optional contact address of the Peer |
|
|
1045
|
+
| request.accessControlListRef | <code>string</code> | Access Control List reference of the Peer |
|
|
1046
|
+
| request.credentialsRef | <code>string</code> | Credentials reference of the Credentials for the Peer |
|
|
1047
|
+
| request.balancingAlgorithm | <code>LoadBalancingAlgorithm</code> | Optional balancing algorithm for the Peer (defaults to "round-robin") |
|
|
1048
|
+
| request.withSessionAffinity | <code>boolean</code> | Whether the Peer has session affinity or not (defaults to false) |
|
|
1049
|
+
| request.enabled | <code>boolean</code> | Whether the Peer is enabled or not (for future use) |
|
|
1050
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
1051
|
+
|
|
1052
|
+
**Example**
|
|
1053
|
+
```js
|
|
1054
|
+
const request = {
|
|
1055
|
+
ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1056
|
+
name: "Feature Server"
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
peers.updatePeer(request)
|
|
1060
|
+
.then(console.log)
|
|
1061
|
+
.catch(console.error) // an error occurred
|
|
1062
|
+
```
|
|
1063
|
+
<a name="Peers+getPeer"></a>
|
|
1064
|
+
|
|
1065
|
+
### peers.getPeer(ref) ⇒ <code>Promise.<GetPeerResponse></code>
|
|
1066
|
+
Gets an Peer from Routr.
|
|
1067
|
+
|
|
1068
|
+
**Kind**: instance method of [<code>Peers</code>](#Peers)
|
|
1069
|
+
**Returns**: <code>Promise.<GetPeerResponse></code> - The Peer
|
|
1070
|
+
|
|
1071
|
+
| Param | Type | Description |
|
|
1072
|
+
| --- | --- | --- |
|
|
1073
|
+
| ref | <code>string</code> | The Peer's reference |
|
|
1074
|
+
|
|
1075
|
+
**Example**
|
|
1076
|
+
```js
|
|
1077
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
1078
|
+
|
|
1079
|
+
peers.getPeer(ref)
|
|
1080
|
+
.then(console.log)
|
|
1081
|
+
.catch(console.error) // an error occurred
|
|
1082
|
+
```
|
|
1083
|
+
<a name="Peers+deletePeer"></a>
|
|
1084
|
+
|
|
1085
|
+
### peers.deletePeer(ref) ⇒ <code>Promise.<void></code>
|
|
1086
|
+
Deletes an Peer from Routr.
|
|
1087
|
+
|
|
1088
|
+
**Kind**: instance method of [<code>Peers</code>](#Peers)
|
|
1089
|
+
|
|
1090
|
+
| Param | Type | Description |
|
|
1091
|
+
| --- | --- | --- |
|
|
1092
|
+
| ref | <code>string</code> | The Peer's reference |
|
|
1093
|
+
|
|
1094
|
+
**Example**
|
|
1095
|
+
```js
|
|
1096
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
1097
|
+
|
|
1098
|
+
peers.deletePeer(ref)
|
|
1099
|
+
.then(console.log)
|
|
1100
|
+
.catch(console.error) // an error occurred
|
|
1101
|
+
```
|
|
1102
|
+
<a name="Peers+listPeers"></a>
|
|
1103
|
+
|
|
1104
|
+
### peers.listPeers(request) ⇒ <code>Promise.<ListPeerResponse></code>
|
|
1105
|
+
Lists all Peers from Routr with pagination.
|
|
1106
|
+
|
|
1107
|
+
**Kind**: instance method of [<code>Peers</code>](#Peers)
|
|
1108
|
+
**Returns**: <code>Promise.<ListPeerResponse></code> - The list of Peers in the current page
|
|
1109
|
+
|
|
1110
|
+
| Param | Type | Description |
|
|
1111
|
+
| --- | --- | --- |
|
|
1112
|
+
| request | <code>ListPeerRequest</code> | The request to list Peers |
|
|
1113
|
+
| request.pageSize | <code>number</code> | The number of Peers to return |
|
|
1114
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
1115
|
+
|
|
1116
|
+
**Example**
|
|
1117
|
+
```js
|
|
1118
|
+
const request = {
|
|
1119
|
+
pageSize: 10
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
peers.listPeers(request)
|
|
1123
|
+
.then(console.log)
|
|
1124
|
+
.catch(console.error) // an error occurred
|
|
1125
|
+
```
|
|
1126
|
+
|
|
1127
|
+
<a name="Trunks"></a>
|
|
1128
|
+
|
|
1129
|
+
## Trunks ⇐ <code>APIClient</code>
|
|
1130
|
+
Use Routr Trunks, a capability of Routr SIP Proxy, to create, update, get
|
|
1131
|
+
and delete Trunks. The Trunks API requires of a running Routr deployment.
|
|
1132
|
+
|
|
1133
|
+
**Kind**: global class
|
|
1134
|
+
**Extends**: <code>APIClient</code>
|
|
1135
|
+
**See**: module:core:APIClient
|
|
1136
|
+
|
|
1137
|
+
* [Trunks](#Trunks) ⇐ <code>APIClient</code>
|
|
1138
|
+
* [new Trunks(options)](#new_Trunks_new)
|
|
1139
|
+
* [.createTrunk(request)](#Trunks+createTrunk) ⇒ <code>Promise.<CreateTrunkResponse></code>
|
|
1140
|
+
* [.updateTrunk(request)](#Trunks+updateTrunk) ⇒ <code>Promise.<UpdateTrunkResponse></code>
|
|
1141
|
+
* [.getTrunk(ref)](#Trunks+getTrunk) ⇒ <code>Promise.<GetTrunkResponse></code>
|
|
1142
|
+
* [.deleteTrunk(ref)](#Trunks+deleteTrunk) ⇒ <code>Promise.<void></code>
|
|
1143
|
+
* [.listTrunks(request)](#Trunks+listTrunks) ⇒ <code>Promise.<ListTrunkResponse></code>
|
|
1144
|
+
|
|
1145
|
+
<a name="new_Trunks_new"></a>
|
|
1146
|
+
|
|
1147
|
+
### new Trunks(options)
|
|
1148
|
+
Constructs a new Trunk API object.
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
| Param | Type | Description |
|
|
1152
|
+
| --- | --- | --- |
|
|
1153
|
+
| options | <code>ClientOptions</code> | Options to indicate the objects endpoint |
|
|
1154
|
+
|
|
1155
|
+
**Example**
|
|
1156
|
+
```js
|
|
1157
|
+
const SDK = require("@routr/sdk")
|
|
1158
|
+
const trunks = new SDK.Trunks()
|
|
1159
|
+
|
|
1160
|
+
const request = {
|
|
1161
|
+
name: "Trunk from Twilio",
|
|
1162
|
+
inboundUri: "sip:twilio.sip.acme.io",
|
|
1163
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1164
|
+
inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1165
|
+
outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1166
|
+
uris: [{
|
|
1167
|
+
host: "acme.sip.twilio.com",
|
|
1168
|
+
port: 5060,
|
|
1169
|
+
transport: "udp",
|
|
1170
|
+
user: "AC1234567890",
|
|
1171
|
+
weight: 1,
|
|
1172
|
+
priority: 1
|
|
1173
|
+
}],
|
|
1174
|
+
extended: {
|
|
1175
|
+
"key": "value"
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
trunks.createTrunk(request)
|
|
1180
|
+
.then(console.log)
|
|
1181
|
+
.catch(console.error) // an error occurred
|
|
1182
|
+
```
|
|
1183
|
+
<a name="Trunks+createTrunk"></a>
|
|
1184
|
+
|
|
1185
|
+
### trunks.createTrunk(request) ⇒ <code>Promise.<CreateTrunkResponse></code>
|
|
1186
|
+
Creates a new Trunk on Routr.
|
|
1187
|
+
|
|
1188
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1189
|
+
**Returns**: <code>Promise.<CreateTrunkResponse></code> - The newly created Trunk
|
|
1190
|
+
**Throws**:
|
|
1191
|
+
|
|
1192
|
+
- if request is null
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
| Param | Type | Description |
|
|
1196
|
+
| --- | --- | --- |
|
|
1197
|
+
| request | <code>CreateTrunkRequest</code> | The request to create an Trunk |
|
|
1198
|
+
| request.name | <code>string</code> | Name of the Trunk |
|
|
1199
|
+
| request.inboundUri | <code>string</code> | Inbound URI of the Trunk |
|
|
1200
|
+
| request.accessControlListRef | <code>string</code> | Access Control List reference |
|
|
1201
|
+
| request.inboundCredentialsRef | <code>string</code> | The reference of the inbound credentials |
|
|
1202
|
+
| request.outboundCredentialsRef | <code>string</code> | The reference of the outbound credentials |
|
|
1203
|
+
| request.uris | <code>Array.<TrunkURI></code> | The outbound URIs of the Trunk |
|
|
1204
|
+
|
|
1205
|
+
**Example**
|
|
1206
|
+
```js
|
|
1207
|
+
const request = {
|
|
1208
|
+
name: "Trunk from Twilio",
|
|
1209
|
+
inboundUri: "sip:twilio.sip.acme.io",
|
|
1210
|
+
accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1211
|
+
inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1212
|
+
outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1213
|
+
uris: [{
|
|
1214
|
+
host: "acme.sip.twilio.com",
|
|
1215
|
+
port: 5060,
|
|
1216
|
+
transport: "udp",
|
|
1217
|
+
user: "AC1234567890",
|
|
1218
|
+
weight: 1,
|
|
1219
|
+
priority: 1
|
|
1220
|
+
}],
|
|
1221
|
+
extended: {
|
|
1222
|
+
"key": "value"
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
trunks.createTrunk(request)
|
|
1227
|
+
.then(console.log)
|
|
1228
|
+
.catch(console.error) // an error occurred
|
|
1229
|
+
```
|
|
1230
|
+
<a name="Trunks+updateTrunk"></a>
|
|
1231
|
+
|
|
1232
|
+
### trunks.updateTrunk(request) ⇒ <code>Promise.<UpdateTrunkResponse></code>
|
|
1233
|
+
Updates an already existing Trunk on Routr.
|
|
1234
|
+
|
|
1235
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1236
|
+
**Returns**: <code>Promise.<UpdateTrunkResponse></code> - The updated Trunk
|
|
1237
|
+
|
|
1238
|
+
| Param | Type | Description |
|
|
1239
|
+
| --- | --- | --- |
|
|
1240
|
+
| request | <code>UpdateTrunkRequest</code> | Partial with the fields to update |
|
|
1241
|
+
| request.name | <code>string</code> | Name of the Trunk |
|
|
1242
|
+
| request.inboundUri | <code>string</code> | Inbound URI of the Trunk |
|
|
1243
|
+
| request.accessControlListRef | <code>string</code> | Access Control List reference |
|
|
1244
|
+
| request.inboundCredentialsRef | <code>string</code> | The reference of the inbound credentials |
|
|
1245
|
+
| request.outboundCredentialsRef | <code>string</code> | The reference of the outbound credentials |
|
|
1246
|
+
| request.uris | <code>Array.<TrunkURI></code> | The outbound URIs of the Trunk |
|
|
1247
|
+
| request.extended | <code>Object</code> | Optional extended attributes |
|
|
1248
|
+
|
|
1249
|
+
**Example**
|
|
1250
|
+
```js
|
|
1251
|
+
const request = {
|
|
1252
|
+
ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
1253
|
+
name: "Trunk from Twilio (US-East)",
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
trunks.updateTrunk(request)
|
|
1257
|
+
.then(console.log)
|
|
1258
|
+
.catch(console.error) // an error occurred
|
|
1259
|
+
```
|
|
1260
|
+
<a name="Trunks+getTrunk"></a>
|
|
1261
|
+
|
|
1262
|
+
### trunks.getTrunk(ref) ⇒ <code>Promise.<GetTrunkResponse></code>
|
|
1263
|
+
Gets an Trunk from Routr.
|
|
1264
|
+
|
|
1265
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1266
|
+
**Returns**: <code>Promise.<GetTrunkResponse></code> - The Trunk
|
|
1267
|
+
|
|
1268
|
+
| Param | Type | Description |
|
|
1269
|
+
| --- | --- | --- |
|
|
1270
|
+
| ref | <code>string</code> | The Trunk's reference |
|
|
1271
|
+
|
|
1272
|
+
**Example**
|
|
1273
|
+
```js
|
|
1274
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
1275
|
+
|
|
1276
|
+
trunks.getTrunk(ref)
|
|
1277
|
+
.then(console.log)
|
|
1278
|
+
.catch(console.error) // an error occurred
|
|
1279
|
+
```
|
|
1280
|
+
<a name="Trunks+deleteTrunk"></a>
|
|
1281
|
+
|
|
1282
|
+
### trunks.deleteTrunk(ref) ⇒ <code>Promise.<void></code>
|
|
1283
|
+
Deletes an Trunk from Routr.
|
|
1284
|
+
|
|
1285
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1286
|
+
|
|
1287
|
+
| Param | Type | Description |
|
|
1288
|
+
| --- | --- | --- |
|
|
1289
|
+
| ref | <code>string</code> | The Trunk's reference |
|
|
1290
|
+
|
|
1291
|
+
**Example**
|
|
1292
|
+
```js
|
|
1293
|
+
const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
1294
|
+
|
|
1295
|
+
trunks.deleteTrunk(ref)
|
|
1296
|
+
.then(console.log)
|
|
1297
|
+
.catch(console.error) // an error occurred
|
|
1298
|
+
```
|
|
1299
|
+
<a name="Trunks+listTrunks"></a>
|
|
1300
|
+
|
|
1301
|
+
### trunks.listTrunks(request) ⇒ <code>Promise.<ListTrunkResponse></code>
|
|
1302
|
+
Lists all Trunks from Routr with pagination.
|
|
1303
|
+
|
|
1304
|
+
**Kind**: instance method of [<code>Trunks</code>](#Trunks)
|
|
1305
|
+
**Returns**: <code>Promise.<ListTrunkResponse></code> - The list of Trunks in the current page
|
|
1306
|
+
|
|
1307
|
+
| Param | Type | Description |
|
|
1308
|
+
| --- | --- | --- |
|
|
1309
|
+
| request | <code>ListTrunkRequest</code> | The request to list Trunks |
|
|
1310
|
+
| request.pageSize | <code>number</code> | The number of Trunks to return |
|
|
1311
|
+
| request.pageToken | <code>string</code> | The page token to use for pagination |
|
|
1312
|
+
|
|
1313
|
+
**Example**
|
|
1314
|
+
```js
|
|
1315
|
+
const request = {
|
|
1316
|
+
pageSize: 10
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
trunks.listTrunks(request)
|
|
1320
|
+
.then(console.log)
|
|
1321
|
+
.catch(console.error) // an error occurred
|
|
1322
|
+
```
|
|
1323
|
+
|