@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,153 @@
1
+ import { APIClient } from "../client";
2
+ import { ClientOptions } from "../types";
3
+ import { CreateTrunkRequest, CreateTrunkResponse, GetTrunkResponse, ListTrunkRequest, ListTrunkResponse, UpdateTrunkRequest, UpdateTrunkResponse } from "./types";
4
+ /**
5
+ * @classdesc Use Routr Trunks, a capability of Routr SIP Proxy, to create, update, get
6
+ * and delete Trunks. The Trunks API requires of a running Routr deployment.
7
+ *
8
+ * @extends APIClient
9
+ * @example
10
+ *
11
+ * const SDK = require("@routr/sdk")
12
+ * const trunks = new SDK.Trunks()
13
+ *
14
+ * const request = {
15
+ * name: "Trunk from Twilio",
16
+ * inboundUri: "sip:twilio.sip.acme.io",
17
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
18
+ * inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
19
+ * outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
20
+ * uris: [{
21
+ * host: "acme.sip.twilio.com",
22
+ * port: 5060,
23
+ * transport: "udp",
24
+ * user: "AC1234567890",
25
+ * weight: 1,
26
+ * priority: 1
27
+ * }],
28
+ * extended: {
29
+ * "key": "value"
30
+ * }
31
+ * }
32
+ *
33
+ * trunks.createTrunk(request)
34
+ * .then(console.log)
35
+ * .catch(console.error) // an error occurred
36
+ */
37
+ export declare class Trunks extends APIClient {
38
+ /**
39
+ * Constructs a new Trunk API object.
40
+ *
41
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
42
+ * @see module:core:APIClient
43
+ */
44
+ constructor(options: ClientOptions);
45
+ /**
46
+ * Creates a new Trunk on Routr.
47
+ *
48
+ * @param {CreateTrunkRequest} request - The request to create an Trunk
49
+ * @param {string} request.name - Name of the Trunk
50
+ * @param {string} request.inboundUri - Inbound URI of the Trunk
51
+ * @param {string} request.accessControlListRef - Access Control List reference
52
+ * @param {string} request.inboundCredentialsRef - The reference of the inbound credentials
53
+ * @param {string} request.outboundCredentialsRef - The reference of the outbound credentials
54
+ * @param {TrunkURI[]} request.uris - The outbound URIs of the Trunk
55
+ * @return {Promise<CreateTrunkResponse>} The newly created Trunk
56
+ * @throws if request is null
57
+ * @example
58
+ *
59
+ * const request = {
60
+ * name: "Trunk from Twilio",
61
+ * inboundUri: "sip:twilio.sip.acme.io",
62
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
63
+ * inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
64
+ * outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
65
+ * uris: [{
66
+ * host: "acme.sip.twilio.com",
67
+ * port: 5060,
68
+ * transport: "udp",
69
+ * user: "AC1234567890",
70
+ * weight: 1,
71
+ * priority: 1
72
+ * }],
73
+ * extended: {
74
+ * "key": "value"
75
+ * }
76
+ * }
77
+ *
78
+ * trunks.createTrunk(request)
79
+ * .then(console.log)
80
+ * .catch(console.error) // an error occurred
81
+ */
82
+ createTrunk(request: CreateTrunkRequest): Promise<CreateTrunkResponse>;
83
+ /**
84
+ * Updates an already existing Trunk on Routr.
85
+ *
86
+ * @param {UpdateTrunkRequest} request - Partial with the fields to update
87
+ * @param {string} request.name - Name of the Trunk
88
+ * @param {string} request.inboundUri - Inbound URI of the Trunk
89
+ * @param {string} request.accessControlListRef - Access Control List reference
90
+ * @param {string} request.inboundCredentialsRef - The reference of the inbound credentials
91
+ * @param {string} request.outboundCredentialsRef - The reference of the outbound credentials
92
+ * @param {TrunkURI[]} request.uris - The outbound URIs of the Trunk
93
+ * @param {JsonObject} request.extended - Optional extended attributes
94
+ * @return {Promise<UpdateTrunkResponse>} The updated Trunk
95
+ * @example
96
+ *
97
+ * const request = {
98
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
99
+ * name: "Trunk from Twilio (US-East)",
100
+ * }
101
+ *
102
+ * trunks.updateTrunk(request)
103
+ * .then(console.log)
104
+ * .catch(console.error) // an error occurred
105
+ */
106
+ updateTrunk(request: UpdateTrunkRequest): Promise<UpdateTrunkResponse>;
107
+ /**
108
+ * Gets an Trunk from Routr.
109
+ *
110
+ * @param {string} ref - The Trunk's reference
111
+ * @return {Promise<GetTrunkResponse>} The Trunk
112
+ * @example
113
+ *
114
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
115
+ *
116
+ * trunks.getTrunk(ref)
117
+ * .then(console.log)
118
+ * .catch(console.error) // an error occurred
119
+ */
120
+ getTrunk(ref: string): Promise<GetTrunkResponse>;
121
+ /**
122
+ * Deletes an Trunk from Routr.
123
+ *
124
+ * @param {string} ref - The Trunk's reference
125
+ * @return {Promise<void>}
126
+ * @example
127
+ *
128
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
129
+ *
130
+ * trunks.deleteTrunk(ref)
131
+ * .then(console.log)
132
+ * .catch(console.error) // an error occurred
133
+ */
134
+ deleteTrunk(ref: string): Promise<void>;
135
+ /**
136
+ * Lists all Trunks from Routr with pagination.
137
+ *
138
+ * @param {ListTrunkRequest} request - The request to list Trunks
139
+ * @param {number} request.pageSize - The number of Trunks to return
140
+ * @param {string} request.pageToken - The page token to use for pagination
141
+ * @return {Promise<ListTrunkResponse>} The list of Trunks in the current page
142
+ * @example
143
+ *
144
+ * const request = {
145
+ * pageSize: 10
146
+ * }
147
+ *
148
+ * trunks.listTrunks(request)
149
+ * .then(console.log)
150
+ * .catch(console.error) // an error occurred
151
+ */
152
+ listTrunks(request: ListTrunkRequest): Promise<ListTrunkResponse>;
153
+ }
@@ -0,0 +1,204 @@
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.Trunks = 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 Trunks, a capability of Routr SIP Proxy, to create, update, get
34
+ * and delete Trunks. The Trunks API requires of a running Routr deployment.
35
+ *
36
+ * @extends APIClient
37
+ * @example
38
+ *
39
+ * const SDK = require("@routr/sdk")
40
+ * const trunks = new SDK.Trunks()
41
+ *
42
+ * const request = {
43
+ * name: "Trunk from Twilio",
44
+ * inboundUri: "sip:twilio.sip.acme.io",
45
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
46
+ * inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
47
+ * outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
48
+ * uris: [{
49
+ * host: "acme.sip.twilio.com",
50
+ * port: 5060,
51
+ * transport: "udp",
52
+ * user: "AC1234567890",
53
+ * weight: 1,
54
+ * priority: 1
55
+ * }],
56
+ * extended: {
57
+ * "key": "value"
58
+ * }
59
+ * }
60
+ *
61
+ * trunks.createTrunk(request)
62
+ * .then(console.log)
63
+ * .catch(console.error) // an error occurred
64
+ */
65
+ class Trunks extends client_1.APIClient {
66
+ /**
67
+ * Constructs a new Trunk API object.
68
+ *
69
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
70
+ * @see module:core:APIClient
71
+ */
72
+ constructor(options) {
73
+ super(options);
74
+ }
75
+ /**
76
+ * Creates a new Trunk on Routr.
77
+ *
78
+ * @param {CreateTrunkRequest} request - The request to create an Trunk
79
+ * @param {string} request.name - Name of the Trunk
80
+ * @param {string} request.inboundUri - Inbound URI of the Trunk
81
+ * @param {string} request.accessControlListRef - Access Control List reference
82
+ * @param {string} request.inboundCredentialsRef - The reference of the inbound credentials
83
+ * @param {string} request.outboundCredentialsRef - The reference of the outbound credentials
84
+ * @param {TrunkURI[]} request.uris - The outbound URIs of the Trunk
85
+ * @return {Promise<CreateTrunkResponse>} The newly created Trunk
86
+ * @throws if request is null
87
+ * @example
88
+ *
89
+ * const request = {
90
+ * name: "Trunk from Twilio",
91
+ * inboundUri: "sip:twilio.sip.acme.io",
92
+ * accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
93
+ * inboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
94
+ * outboundCredentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
95
+ * uris: [{
96
+ * host: "acme.sip.twilio.com",
97
+ * port: 5060,
98
+ * transport: "udp",
99
+ * user: "AC1234567890",
100
+ * weight: 1,
101
+ * priority: 1
102
+ * }],
103
+ * extended: {
104
+ * "key": "value"
105
+ * }
106
+ * }
107
+ *
108
+ * trunks.createTrunk(request)
109
+ * .then(console.log)
110
+ * .catch(console.error) // an error occurred
111
+ */
112
+ createTrunk(request) {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ return this.client.trunks.create(request);
115
+ });
116
+ }
117
+ /**
118
+ * Updates an already existing Trunk on Routr.
119
+ *
120
+ * @param {UpdateTrunkRequest} request - Partial with the fields to update
121
+ * @param {string} request.name - Name of the Trunk
122
+ * @param {string} request.inboundUri - Inbound URI of the Trunk
123
+ * @param {string} request.accessControlListRef - Access Control List reference
124
+ * @param {string} request.inboundCredentialsRef - The reference of the inbound credentials
125
+ * @param {string} request.outboundCredentialsRef - The reference of the outbound credentials
126
+ * @param {TrunkURI[]} request.uris - The outbound URIs of the Trunk
127
+ * @param {JsonObject} request.extended - Optional extended attributes
128
+ * @return {Promise<UpdateTrunkResponse>} The updated Trunk
129
+ * @example
130
+ *
131
+ * const request = {
132
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
133
+ * name: "Trunk from Twilio (US-East)",
134
+ * }
135
+ *
136
+ * trunks.updateTrunk(request)
137
+ * .then(console.log)
138
+ * .catch(console.error) // an error occurred
139
+ */
140
+ updateTrunk(request) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ return this.client.trunks.update(request);
143
+ });
144
+ }
145
+ /**
146
+ * Gets an Trunk from Routr.
147
+ *
148
+ * @param {string} ref - The Trunk's reference
149
+ * @return {Promise<GetTrunkResponse>} The Trunk
150
+ * @example
151
+ *
152
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
153
+ *
154
+ * trunks.getTrunk(ref)
155
+ * .then(console.log)
156
+ * .catch(console.error) // an error occurred
157
+ */
158
+ getTrunk(ref) {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ return this.client.trunks.get(ref);
161
+ });
162
+ }
163
+ /**
164
+ * Deletes an Trunk from Routr.
165
+ *
166
+ * @param {string} ref - The Trunk's reference
167
+ * @return {Promise<void>}
168
+ * @example
169
+ *
170
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
171
+ *
172
+ * trunks.deleteTrunk(ref)
173
+ * .then(console.log)
174
+ * .catch(console.error) // an error occurred
175
+ */
176
+ deleteTrunk(ref) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ return this.client.trunks.del(ref);
179
+ });
180
+ }
181
+ /**
182
+ * Lists all Trunks from Routr with pagination.
183
+ *
184
+ * @param {ListTrunkRequest} request - The request to list Trunks
185
+ * @param {number} request.pageSize - The number of Trunks to return
186
+ * @param {string} request.pageToken - The page token to use for pagination
187
+ * @return {Promise<ListTrunkResponse>} The list of Trunks in the current page
188
+ * @example
189
+ *
190
+ * const request = {
191
+ * pageSize: 10
192
+ * }
193
+ *
194
+ * trunks.listTrunks(request)
195
+ * .then(console.log)
196
+ * .catch(console.error) // an error occurred
197
+ */
198
+ listTrunks(request) {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ return this.client.trunks.list(request);
201
+ });
202
+ }
203
+ }
204
+ exports.Trunks = Trunks;
@@ -0,0 +1,11 @@
1
+ import { CommonConnect as CC } from "@routr/common";
2
+ import { CreateBaseOmit } from "../types";
3
+ export type CreateTrunkRequest = Omit<CC.Trunk, CreateBaseOmit | "accessControlList" | "inboundCredentials" | "outboundCredentials">;
4
+ export type CreateTrunkResponse = CC.Trunk;
5
+ export type UpdateTrunkRequest = {
6
+ ref: string;
7
+ } & Partial<CreateTrunkRequest>;
8
+ export type UpdateTrunkResponse = CC.Trunk;
9
+ export type ListTrunkRequest = CC.ListRequest;
10
+ export type ListTrunkResponse = CC.ListResponse<CC.Trunk>;
11
+ export type GetTrunkResponse = CC.Trunk;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface ClientOptions {
2
+ endpoint: string;
3
+ username?: string;
4
+ password?: string;
5
+ }
6
+ export type CreateBaseOmit = "ref" | "apiVersion" | "createdAt" | "updatedAt";
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@routr/sdk",
3
+ "version": "2.0.8-alpha.20",
4
+ "description": "The Routr SDK for Node.js",
5
+ "author": "Pedro Sanders <psanders@fonoster.com>",
6
+ "homepage": "https://github.com/fonoster/routr#readme",
7
+ "license": "MIT",
8
+ "main": "dist/sdk",
9
+ "types": "dist/sdk",
10
+ "directories": {
11
+ "src": "src",
12
+ "test": "test"
13
+ },
14
+ "scripts": {
15
+ "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
16
+ "build": "tsc -b tsconfig.json"
17
+ },
18
+ "dependencies": {
19
+ "@fonoster/logger": "0.3.18",
20
+ "@grpc/grpc-js": "^1.8.4",
21
+ "@opentelemetry/api": "^1.0.4",
22
+ "@opentelemetry/exporter-jaeger": "^1.0.4",
23
+ "@opentelemetry/instrumentation": "^0.27.0",
24
+ "@opentelemetry/instrumentation-grpc": "^0.27.0",
25
+ "@opentelemetry/resources": "^1.0.4",
26
+ "@opentelemetry/sdk-trace-base": "^1.0.4",
27
+ "@opentelemetry/sdk-trace-node": "^1.0.4",
28
+ "@opentelemetry/semantic-conventions": "^1.0.4",
29
+ "@routr/common": "^2.0.8-alpha.20",
30
+ "google-protobuf": "^3.9.2",
31
+ "pb-util": "^1.0.3"
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/fonoster/routr.git"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/fonoster/routr/issues"
45
+ },
46
+ "devDependencies": {
47
+ "@types/google-protobuf": "^3.15.6"
48
+ },
49
+ "gitHead": "a22ee8342d03f5dfe46fddba89ffe3e6d0d5deb6"
50
+ }