@routr/sdk 2.0.8-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/dist/acl/acl.d.ts +122 -0
  3. package/dist/acl/acl.js +173 -0
  4. package/dist/acl/index.d.ts +2 -0
  5. package/dist/acl/index.js +38 -0
  6. package/dist/acl/types.d.ts +11 -0
  7. package/dist/acl/types.js +2 -0
  8. package/dist/agents/agents.d.ts +141 -0
  9. package/dist/agents/agents.js +192 -0
  10. package/dist/agents/index.d.ts +2 -0
  11. package/dist/agents/index.js +38 -0
  12. package/dist/agents/types.d.ts +11 -0
  13. package/dist/agents/types.js +2 -0
  14. package/dist/client.d.ts +8 -0
  15. package/dist/client.js +68 -0
  16. package/dist/credentials/credentials.d.ts +128 -0
  17. package/dist/credentials/credentials.js +179 -0
  18. package/dist/credentials/index.d.ts +2 -0
  19. package/dist/credentials/index.js +38 -0
  20. package/dist/credentials/types.d.ts +11 -0
  21. package/dist/credentials/types.js +2 -0
  22. package/dist/domains/domains.d.ts +138 -0
  23. package/dist/domains/domains.js +189 -0
  24. package/dist/domains/index.d.ts +2 -0
  25. package/dist/domains/index.js +38 -0
  26. package/dist/domains/types.d.ts +13 -0
  27. package/dist/domains/types.js +2 -0
  28. package/dist/index.d.ts +17 -0
  29. package/dist/index.js +41 -0
  30. package/dist/numbers/index.d.ts +2 -0
  31. package/dist/numbers/index.js +38 -0
  32. package/dist/numbers/numbers.d.ts +156 -0
  33. package/dist/numbers/numbers.js +207 -0
  34. package/dist/numbers/types.d.ts +11 -0
  35. package/dist/numbers/types.js +2 -0
  36. package/dist/peers/index.d.ts +2 -0
  37. package/dist/peers/index.js +38 -0
  38. package/dist/peers/peers.d.ts +150 -0
  39. package/dist/peers/peers.js +201 -0
  40. package/dist/peers/types.d.ts +11 -0
  41. package/dist/peers/types.js +2 -0
  42. package/dist/trunks/index.d.ts +2 -0
  43. package/dist/trunks/index.js +38 -0
  44. package/dist/trunks/trunks.d.ts +153 -0
  45. package/dist/trunks/trunks.js +204 -0
  46. package/dist/trunks/types.d.ts +11 -0
  47. package/dist/trunks/types.js +2 -0
  48. package/dist/types.d.ts +6 -0
  49. package/dist/types.js +2 -0
  50. package/package.json +50 -0
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Numbers = void 0;
13
+ /*
14
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
15
+ * http://github.com/fonoster
16
+ *
17
+ * This file is part of Routr.
18
+ *
19
+ * Licensed under the MIT License (the "License");
20
+ * you may not use this file except in compliance with
21
+ * the License. You may obtain a copy of the License at
22
+ *
23
+ * https://opensource.org/licenses/MIT
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
31
+ const client_1 = require("../client");
32
+ /**
33
+ * @classdesc Use Routr Numbers, a capability of Routr SIP Proxy, to create, update, get
34
+ * and delete Numbers. The Number API requires of a running Routr deployment.
35
+ *
36
+ * @extends APIClient
37
+ * @example
38
+ *
39
+ * const SDK = require("@routr/sdk")
40
+ * const numbers = new SDK.Numbers()
41
+ *
42
+ * const request = {
43
+ * name: "(415) 555-1212",
44
+ * telUrl: "teL:+14155551212",
45
+ * aorLink: "sip:100@sip.local",
46
+ * city: "San Francisco",
47
+ * country: "United States",
48
+ * countryISOCode: "US",
49
+ * sessionAffinityHeader: "X-Room-Id"
50
+ * extraHeaders: [{
51
+ * name: "X-Room-Id",
52
+ * value: "abc-us-123"
53
+ * }],
54
+ * extended: {
55
+ * "key": "value"
56
+ * }
57
+ * }
58
+ *
59
+ * numbers.createNumber(request)
60
+ * .then(console.log)
61
+ * .catch(console.error) // an error occurred
62
+ */
63
+ class Numbers extends client_1.APIClient {
64
+ /**
65
+ * Constructs a new Number API object.
66
+ *
67
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
68
+ * @see module:core:APIClient
69
+ */
70
+ constructor(options) {
71
+ super(options);
72
+ }
73
+ /**
74
+ * Creates a new Number on Routr.
75
+ *
76
+ * @param {CreateNumberRequest} request - The request to create an Number
77
+ * @param {string} request.name - Name of the Number
78
+ * @param {string} request.telUrl - The number URI to be used (e.g. te:+1234567890)
79
+ * @param {string} request.aorLink - The AOR link to be used (e.g. sip:1001@sip.local)
80
+ * @param {string} request.city - The city where the number is located
81
+ * @param {string} request.country - The country where the number is located
82
+ * @param {string} request.countryISOCode - The country ISO code where the number is located
83
+ * @param {{ name: string, value: string}[]} request.extraHeaders - Extra headers to be used
84
+ * @param {string} request.trunkRef - The trunk reference to be used
85
+ * @param {string} request.sessionAffinityHeader - Optional session affinity header
86
+ * @param {string} request.extended - Optional extended attributes
87
+ * @return {Promise<CreateNumberResponse>} The newly created Number
88
+ * @throws if request is null
89
+ * @example
90
+ *
91
+ * const request = {
92
+ * name: "(415) 555-1212",
93
+ * telUrl: "teL:+14155551212",
94
+ * aorLink: "sip:100@sip.local",
95
+ * city: "San Francisco",
96
+ * country: "United States",
97
+ * countryISOCode: "US",
98
+ * sessionAffinityHeader: "X-Room-Id"
99
+ * extraHeaders: [{
100
+ * name: "X-Room-Id",
101
+ * value: "abc-us-123"
102
+ * }],
103
+ * extended: {
104
+ * "key": "value"
105
+ * }
106
+ * }
107
+ *
108
+ * numbers.createNumber(request)
109
+ * .then(console.log)
110
+ * .catch(console.error) // an error occurred
111
+ */
112
+ createNumber(request) {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ return this.client.numbers.create(request);
115
+ });
116
+ }
117
+ /**
118
+ * Updates an already existing Number on Routr.
119
+ *
120
+ * @param {UpdateNumberRequest} request - Partial with the fields to update
121
+ * @param {string} request.name - Name of the Number
122
+ * @param {string} request.telUrl - The number URI to be used (e.g. te:+1234567890)
123
+ * @param {string} request.aorLink - The AOR link to be used (e.g. sip:1001@sip.local)
124
+ * @param {string} request.city - The city where the number is located
125
+ * @param {string} request.country - The country where the number is located
126
+ * @param {string} request.countryISOCode - The country ISO code where the number is located
127
+ * @param {{ name: string, value: string}[]} request.extraHeaders - Extra headers to be used
128
+ * @param {string} request.trunkRef - The trunk reference to be used
129
+ * @param {string} request.sessionAffinityHeader - Optional session affinity header
130
+ * @param {string} request.extended - Optional extended attributes
131
+ * @return {Promise<UpdateNumberResponse>} The updated Number
132
+ * @example
133
+ *
134
+ * const request = {
135
+ * name: "(415) 555-1212 (friendly name)",
136
+ * aorLink: "sip:2001@sip.local"
137
+ * }
138
+ *
139
+ * numbers.updateNumber(request)
140
+ * .then(console.log)
141
+ * .catch(console.error) // an error occurred
142
+ */
143
+ updateNumber(request) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ return this.client.numbers.update(request);
146
+ });
147
+ }
148
+ /**
149
+ * Gets a Number from Routr.
150
+ *
151
+ * @param {string} ref - The Number's reference
152
+ * @return {Promise<GetNumberResponse>} The Number
153
+ * @example
154
+ *
155
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
156
+ *
157
+ * numbers.getNumber(ref)
158
+ * .then(console.log)
159
+ * .catch(console.error) // an error occurred
160
+ */
161
+ getNumber(ref) {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ return this.client.numbers.get(ref);
164
+ });
165
+ }
166
+ /**
167
+ * Deletes a Number from Routr.
168
+ *
169
+ * @param {string} ref - The Number's reference
170
+ * @return {Promise<void>}
171
+ * @example
172
+ *
173
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
174
+ *
175
+ * numbers.deleteNumber(ref)
176
+ * .then(console.log)
177
+ * .catch(console.error) // an error occurred
178
+ */
179
+ deleteNumber(ref) {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ return this.client.numbers.del(ref);
182
+ });
183
+ }
184
+ /**
185
+ * Lists all Numbers from Routr with pagination.
186
+ *
187
+ * @param {ListNumberRequest} request - The request to list Numbers
188
+ * @param {number} request.pageSize - The number of Numbers to return
189
+ * @param {string} request.pageToken - The page token to use for pagination
190
+ * @return {Promise<ListNumberResponse>} The list of Numbers
191
+ * @example
192
+ *
193
+ * const request = {
194
+ * pageSize: 10
195
+ * }
196
+ *
197
+ * numbers.listNumbers(request)
198
+ * .then(console.log)
199
+ * .catch(console.error) // an error occurred
200
+ */
201
+ listNumbers(request) {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ return this.client.numbers.list(request);
204
+ });
205
+ }
206
+ }
207
+ exports.Numbers = Numbers;
@@ -0,0 +1,11 @@
1
+ import { CommonConnect as CC } from "@routr/common";
2
+ import { CreateBaseOmit } from "../types";
3
+ export type CreateNumberRequest = Omit<CC.INumber, CreateBaseOmit | "trunk">;
4
+ export type CreateNumberResponse = CC.INumber;
5
+ export type UpdateNumberRequest = {
6
+ ref: string;
7
+ } & Partial<CreateNumberRequest>;
8
+ export type UpdateNumberResponse = CC.INumber;
9
+ export type ListNumberRequest = CC.ListRequest;
10
+ export type ListNumberResponse = CC.ListResponse<CC.INumber>;
11
+ export type GetNumberResponse = CC.INumber;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./peers";
2
+ export { Peers as default } from "./peers";
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.default = void 0;
18
+ /*
19
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
20
+ * http://github.com/fonoster
21
+ *
22
+ * This file is part of Routr.
23
+ *
24
+ * Licensed under the MIT License (the "License");
25
+ * you may not use this file except in compliance with
26
+ * the License. You may obtain a copy of the License at
27
+ *
28
+ * https://opensource.org/licenses/MIT
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software
31
+ * distributed under the License is distributed on an "AS IS" BASIS,
32
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ * See the License for the specific language governing permissions and
34
+ * limitations under the License.
35
+ */
36
+ __exportStar(require("./peers"), exports);
37
+ var peers_1 = require("./peers");
38
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return peers_1.Peers; } });
@@ -0,0 +1,150 @@
1
+ import { APIClient } from "../client";
2
+ import { ClientOptions } from "../types";
3
+ import { CreatePeerRequest, CreatePeerResponse, GetPeerResponse, ListPeerRequest, ListPeerResponse, UpdatePeerRequest, UpdatePeerResponse } from "./types";
4
+ /**
5
+ * @classdesc Use Routr Peers, a capability of Routr SIP Proxy, to create, update, get
6
+ * and delete Peers. The Peers API requires of a running Routr deployment.
7
+ *
8
+ * @extends APIClient
9
+ * @example
10
+ *
11
+ * const SDK = require("@routr/sdk")
12
+ * const peers = new SDK.Peers()
13
+ *
14
+ * const request = {
15
+ * name: "Asterisk Conference Server",
16
+ * username: "conference",
17
+ * aor: "backend:conference",
18
+ * contactAddr: "10.0.0.1:5060",
19
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
20
+ * credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
21
+ * balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
22
+ * withSessionAffinity: true,
23
+ * enabled: true,
24
+ * extended: {
25
+ * "key": "value"
26
+ * }
27
+ * }
28
+ *
29
+ * peers.createPeer(request)
30
+ * .then(console.log)
31
+ * .catch(console.error) // an error occurred
32
+ */
33
+ export declare class Peers extends APIClient {
34
+ /**
35
+ * Constructs a new Peer API object.
36
+ *
37
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
38
+ * @see module:core:APIClient
39
+ */
40
+ constructor(options: ClientOptions);
41
+ /**
42
+ * Creates a new Peer on Routr.
43
+ *
44
+ * @param {CreatePeerRequest} request - The request to create an Peer
45
+ * @param {string} request.name - Name of the Peer
46
+ * @param {string} request.aor - Address of Record of the Peer
47
+ * @param {string} request.contactAddr - Optional contact address of the Peer
48
+ * @param {string} request.accessControlListRef - Access Control List reference of the Peer
49
+ * @param {string} request.credentialsRef - Credentials reference of the Credentials for the Peer
50
+ * @param {LoadBalancingAlgorithm} request.balancingAlgorithm - Optional balancing algorithm for the Peer (defaults to "round-robin")
51
+ * @param {boolean} request.withSessionAffinity - Whether the Peer has session affinity or not (defaults to false)
52
+ * @param {boolean} request.enabled - Whether the Peer is enabled or not (for future use)
53
+ * @param {JsonObject} request.extended - Optional extended attributes
54
+ * @return {Promise<CreatePeerResponse>} The newly created Peer
55
+ * @throws if request is null
56
+ * @example
57
+ *
58
+ * const request = {
59
+ * name: "Asterisk Conference Server",
60
+ * username: "conference",
61
+ * aor: "backend:conference",
62
+ * contactAddr: "10.0.0.1:5060",
63
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
64
+ * credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
65
+ * balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
66
+ * withSessionAffinity: true,
67
+ * enabled: true,
68
+ * extended: {
69
+ * "key": "value"
70
+ * }
71
+ * }
72
+ *
73
+ * peers.createPeer(request)
74
+ * .then(console.log)
75
+ * .catch(console.error) // an error occurred
76
+ */
77
+ createPeer(request: CreatePeerRequest): Promise<CreatePeerResponse>;
78
+ /**
79
+ * Updates an already existing Peer on Routr.
80
+ *
81
+ * @param {UpdatePeerRequest} request - Partial with the fields to update
82
+ * @param {string} request.name - Name of the Peer
83
+ * @param {string} request.aor - Address of Record of the Peer
84
+ * @param {string} request.contactAddr - Optional contact address of the Peer
85
+ * @param {string} request.accessControlListRef - Access Control List reference of the Peer
86
+ * @param {string} request.credentialsRef - Credentials reference of the Credentials for the Peer
87
+ * @param {LoadBalancingAlgorithm} request.balancingAlgorithm - Optional balancing algorithm for the Peer (defaults to "round-robin")
88
+ * @param {boolean} request.withSessionAffinity - Whether the Peer has session affinity or not (defaults to false)
89
+ * @param {boolean} request.enabled - Whether the Peer is enabled or not (for future use)
90
+ * @param {JsonObject} request.extended - Optional extended attributes
91
+ * @return {Promise<UpdatePeerResponse>} The updated Peer
92
+ * @example
93
+ *
94
+ * const request = {
95
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
96
+ * name: "Feature Server"
97
+ * }
98
+ *
99
+ * peers.updatePeer(request)
100
+ * .then(console.log)
101
+ * .catch(console.error) // an error occurred
102
+ */
103
+ updatePeer(request: UpdatePeerRequest): Promise<UpdatePeerResponse>;
104
+ /**
105
+ * Gets an Peer from Routr.
106
+ *
107
+ * @param {string} ref - The Peer's reference
108
+ * @return {Promise<GetPeerResponse>} The Peer
109
+ * @example
110
+ *
111
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
112
+ *
113
+ * peers.getPeer(ref)
114
+ * .then(console.log)
115
+ * .catch(console.error) // an error occurred
116
+ */
117
+ getPeer(ref: string): Promise<GetPeerResponse>;
118
+ /**
119
+ * Deletes an Peer from Routr.
120
+ *
121
+ * @param {string} ref - The Peer's reference
122
+ * @return {Promise<void>}
123
+ * @example
124
+ *
125
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
126
+ *
127
+ * peers.deletePeer(ref)
128
+ * .then(console.log)
129
+ * .catch(console.error) // an error occurred
130
+ */
131
+ deletePeer(ref: string): Promise<void>;
132
+ /**
133
+ * Lists all Peers from Routr with pagination.
134
+ *
135
+ * @param {ListPeerRequest} request - The request to list Peers
136
+ * @param {number} request.pageSize - The number of Peers to return
137
+ * @param {string} request.pageToken - The page token to use for pagination
138
+ * @return {Promise<ListPeerResponse>} The list of Peers in the current page
139
+ * @example
140
+ *
141
+ * const request = {
142
+ * pageSize: 10
143
+ * }
144
+ *
145
+ * peers.listPeers(request)
146
+ * .then(console.log)
147
+ * .catch(console.error) // an error occurred
148
+ */
149
+ listPeers(request: ListPeerRequest): Promise<ListPeerResponse>;
150
+ }
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Peers = void 0;
13
+ /*
14
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
15
+ * http://github.com/fonoster
16
+ *
17
+ * This file is part of Routr.
18
+ *
19
+ * Licensed under the MIT License (the "License");
20
+ * you may not use this file except in compliance with
21
+ * the License. You may obtain a copy of the License at
22
+ *
23
+ * https://opensource.org/licenses/MIT
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
31
+ const client_1 = require("../client");
32
+ /**
33
+ * @classdesc Use Routr Peers, a capability of Routr SIP Proxy, to create, update, get
34
+ * and delete Peers. The Peers API requires of a running Routr deployment.
35
+ *
36
+ * @extends APIClient
37
+ * @example
38
+ *
39
+ * const SDK = require("@routr/sdk")
40
+ * const peers = new SDK.Peers()
41
+ *
42
+ * const request = {
43
+ * name: "Asterisk Conference Server",
44
+ * username: "conference",
45
+ * aor: "backend:conference",
46
+ * contactAddr: "10.0.0.1:5060",
47
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
48
+ * credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
49
+ * balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
50
+ * withSessionAffinity: true,
51
+ * enabled: true,
52
+ * extended: {
53
+ * "key": "value"
54
+ * }
55
+ * }
56
+ *
57
+ * peers.createPeer(request)
58
+ * .then(console.log)
59
+ * .catch(console.error) // an error occurred
60
+ */
61
+ class Peers extends client_1.APIClient {
62
+ /**
63
+ * Constructs a new Peer API object.
64
+ *
65
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
66
+ * @see module:core:APIClient
67
+ */
68
+ constructor(options) {
69
+ super(options);
70
+ }
71
+ /**
72
+ * Creates a new Peer on Routr.
73
+ *
74
+ * @param {CreatePeerRequest} request - The request to create an Peer
75
+ * @param {string} request.name - Name of the Peer
76
+ * @param {string} request.aor - Address of Record of the Peer
77
+ * @param {string} request.contactAddr - Optional contact address of the Peer
78
+ * @param {string} request.accessControlListRef - Access Control List reference of the Peer
79
+ * @param {string} request.credentialsRef - Credentials reference of the Credentials for the Peer
80
+ * @param {LoadBalancingAlgorithm} request.balancingAlgorithm - Optional balancing algorithm for the Peer (defaults to "round-robin")
81
+ * @param {boolean} request.withSessionAffinity - Whether the Peer has session affinity or not (defaults to false)
82
+ * @param {boolean} request.enabled - Whether the Peer is enabled or not (for future use)
83
+ * @param {JsonObject} request.extended - Optional extended attributes
84
+ * @return {Promise<CreatePeerResponse>} The newly created Peer
85
+ * @throws if request is null
86
+ * @example
87
+ *
88
+ * const request = {
89
+ * name: "Asterisk Conference Server",
90
+ * username: "conference",
91
+ * aor: "backend:conference",
92
+ * contactAddr: "10.0.0.1:5060",
93
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
94
+ * credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
95
+ * balancingAlgorithm: LoadBalancingAlgorithm.LEAST_SESSIONS,
96
+ * withSessionAffinity: true,
97
+ * enabled: true,
98
+ * extended: {
99
+ * "key": "value"
100
+ * }
101
+ * }
102
+ *
103
+ * peers.createPeer(request)
104
+ * .then(console.log)
105
+ * .catch(console.error) // an error occurred
106
+ */
107
+ createPeer(request) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return this.client.peers.create(request);
110
+ });
111
+ }
112
+ /**
113
+ * Updates an already existing Peer on Routr.
114
+ *
115
+ * @param {UpdatePeerRequest} request - Partial with the fields to update
116
+ * @param {string} request.name - Name of the Peer
117
+ * @param {string} request.aor - Address of Record of the Peer
118
+ * @param {string} request.contactAddr - Optional contact address of the Peer
119
+ * @param {string} request.accessControlListRef - Access Control List reference of the Peer
120
+ * @param {string} request.credentialsRef - Credentials reference of the Credentials for the Peer
121
+ * @param {LoadBalancingAlgorithm} request.balancingAlgorithm - Optional balancing algorithm for the Peer (defaults to "round-robin")
122
+ * @param {boolean} request.withSessionAffinity - Whether the Peer has session affinity or not (defaults to false)
123
+ * @param {boolean} request.enabled - Whether the Peer is enabled or not (for future use)
124
+ * @param {JsonObject} request.extended - Optional extended attributes
125
+ * @return {Promise<UpdatePeerResponse>} The updated Peer
126
+ * @example
127
+ *
128
+ * const request = {
129
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
130
+ * name: "Feature Server"
131
+ * }
132
+ *
133
+ * peers.updatePeer(request)
134
+ * .then(console.log)
135
+ * .catch(console.error) // an error occurred
136
+ */
137
+ updatePeer(request) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ return this.client.peers.update(request);
140
+ });
141
+ }
142
+ /**
143
+ * Gets an Peer from Routr.
144
+ *
145
+ * @param {string} ref - The Peer's reference
146
+ * @return {Promise<GetPeerResponse>} The Peer
147
+ * @example
148
+ *
149
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
150
+ *
151
+ * peers.getPeer(ref)
152
+ * .then(console.log)
153
+ * .catch(console.error) // an error occurred
154
+ */
155
+ getPeer(ref) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ return this.client.peers.get(ref);
158
+ });
159
+ }
160
+ /**
161
+ * Deletes an Peer from Routr.
162
+ *
163
+ * @param {string} ref - The Peer's reference
164
+ * @return {Promise<void>}
165
+ * @example
166
+ *
167
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
168
+ *
169
+ * peers.deletePeer(ref)
170
+ * .then(console.log)
171
+ * .catch(console.error) // an error occurred
172
+ */
173
+ deletePeer(ref) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ return this.client.peers.del(ref);
176
+ });
177
+ }
178
+ /**
179
+ * Lists all Peers from Routr with pagination.
180
+ *
181
+ * @param {ListPeerRequest} request - The request to list Peers
182
+ * @param {number} request.pageSize - The number of Peers to return
183
+ * @param {string} request.pageToken - The page token to use for pagination
184
+ * @return {Promise<ListPeerResponse>} The list of Peers in the current page
185
+ * @example
186
+ *
187
+ * const request = {
188
+ * pageSize: 10
189
+ * }
190
+ *
191
+ * peers.listPeers(request)
192
+ * .then(console.log)
193
+ * .catch(console.error) // an error occurred
194
+ */
195
+ listPeers(request) {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ return this.client.peers.list(request);
198
+ });
199
+ }
200
+ }
201
+ exports.Peers = Peers;
@@ -0,0 +1,11 @@
1
+ import { CommonConnect as CC } from "@routr/common";
2
+ import { CreateBaseOmit } from "../types";
3
+ export type CreatePeerRequest = Omit<CC.Peer, CreateBaseOmit | "accessControlList" | "credentials">;
4
+ export type CreatePeerResponse = CC.Peer;
5
+ export type UpdatePeerRequest = {
6
+ ref: string;
7
+ } & Partial<CreatePeerRequest>;
8
+ export type UpdatePeerResponse = CC.Peer;
9
+ export type ListPeerRequest = CC.ListRequest;
10
+ export type ListPeerResponse = CC.ListResponse<CC.Peer>;
11
+ export type GetPeerResponse = CC.Peer;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./trunks";
2
+ export { Trunks as default } from "./trunks";
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.default = void 0;
18
+ /*
19
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
20
+ * http://github.com/fonoster
21
+ *
22
+ * This file is part of Routr.
23
+ *
24
+ * Licensed under the MIT License (the "License");
25
+ * you may not use this file except in compliance with
26
+ * the License. You may obtain a copy of the License at
27
+ *
28
+ * https://opensource.org/licenses/MIT
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software
31
+ * distributed under the License is distributed on an "AS IS" BASIS,
32
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ * See the License for the specific language governing permissions and
34
+ * limitations under the License.
35
+ */
36
+ __exportStar(require("./trunks"), exports);
37
+ var trunks_1 = require("./trunks");
38
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return trunks_1.Trunks; } });