@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.
- package/LICENSE +21 -0
- package/dist/acl/acl.d.ts +122 -0
- package/dist/acl/acl.js +173 -0
- package/dist/acl/index.d.ts +2 -0
- package/dist/acl/index.js +38 -0
- package/dist/acl/types.d.ts +11 -0
- package/dist/acl/types.js +2 -0
- package/dist/agents/agents.d.ts +141 -0
- package/dist/agents/agents.js +192 -0
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/index.js +38 -0
- package/dist/agents/types.d.ts +11 -0
- package/dist/agents/types.js +2 -0
- package/dist/client.d.ts +8 -0
- package/dist/client.js +68 -0
- package/dist/credentials/credentials.d.ts +128 -0
- package/dist/credentials/credentials.js +179 -0
- package/dist/credentials/index.d.ts +2 -0
- package/dist/credentials/index.js +38 -0
- package/dist/credentials/types.d.ts +11 -0
- package/dist/credentials/types.js +2 -0
- package/dist/domains/domains.d.ts +138 -0
- package/dist/domains/domains.js +189 -0
- package/dist/domains/index.d.ts +2 -0
- package/dist/domains/index.js +38 -0
- package/dist/domains/types.d.ts +13 -0
- package/dist/domains/types.js +2 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +41 -0
- package/dist/numbers/index.d.ts +2 -0
- package/dist/numbers/index.js +38 -0
- package/dist/numbers/numbers.d.ts +156 -0
- package/dist/numbers/numbers.js +207 -0
- package/dist/numbers/types.d.ts +11 -0
- package/dist/numbers/types.js +2 -0
- package/dist/peers/index.d.ts +2 -0
- package/dist/peers/index.js +38 -0
- package/dist/peers/peers.d.ts +150 -0
- package/dist/peers/peers.js +201 -0
- package/dist/peers/types.d.ts +11 -0
- package/dist/peers/types.js +2 -0
- package/dist/trunks/index.d.ts +2 -0
- package/dist/trunks/index.js +38 -0
- package/dist/trunks/trunks.d.ts +153 -0
- package/dist/trunks/trunks.js +204 -0
- package/dist/trunks/types.d.ts +11 -0
- package/dist/trunks/types.js +2 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +2 -0
- package/package.json +50 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommonConnect as CC } from "@routr/common";
|
|
2
|
+
import { CreateBaseOmit } from "../types";
|
|
3
|
+
export type CreateCredentialsRequest = Omit<CC.Credentials, CreateBaseOmit>;
|
|
4
|
+
export type CreateCredentialsResponse = CC.Credentials;
|
|
5
|
+
export type UpdateCredentialsRequest = {
|
|
6
|
+
ref: string;
|
|
7
|
+
} & Partial<CreateCredentialsRequest>;
|
|
8
|
+
export type UpdateCredentialsResponse = CC.Credentials;
|
|
9
|
+
export type ListCredentialsRequest = CC.ListRequest;
|
|
10
|
+
export type ListCredentialsResponse = CC.ListResponse<CC.Credentials>;
|
|
11
|
+
export type GetCredentialsResponse = CC.Credentials;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { APIClient } from "../client";
|
|
2
|
+
import { ClientOptions } from "../types";
|
|
3
|
+
import { CreateDomainRequest, CreateDomainResponse, GetDomainResponse, ListDomainRequest, ListDomainResponse, UpdateDomainRequest, UpdateDomainResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Use Routr Domains, a capability of Routr SIP Proxy, to create, update, get
|
|
6
|
+
* and delete Domains. The Domains API requires of a running Routr deployment.
|
|
7
|
+
*
|
|
8
|
+
* @extends APIClient
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* const SDK = require("@routr/sdk")
|
|
12
|
+
* const domains = new SDK.Domains()
|
|
13
|
+
*
|
|
14
|
+
* const request = {
|
|
15
|
+
* name: "Local domain",
|
|
16
|
+
* domainUri: "sip.local",
|
|
17
|
+
* accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
18
|
+
* egressPolicies: [{
|
|
19
|
+
* rule: ".*",
|
|
20
|
+
* numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
21
|
+
* }],
|
|
22
|
+
* extended: {
|
|
23
|
+
* "key": "value"
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* domains.createDomain(request)
|
|
28
|
+
* .then(console.log)
|
|
29
|
+
* .catch(console.error) // an error occurred
|
|
30
|
+
*/
|
|
31
|
+
export declare class Domains extends APIClient {
|
|
32
|
+
/**
|
|
33
|
+
* Constructs a new Domain API object.
|
|
34
|
+
*
|
|
35
|
+
* @param {ClientOptions} options - Options to indicate the objects endpoint
|
|
36
|
+
* @see module:core:APIClient
|
|
37
|
+
*/
|
|
38
|
+
constructor(options: ClientOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new Domain on Routr.
|
|
41
|
+
*
|
|
42
|
+
* @param {CreateDomainRequest} request - The request to create an Domain
|
|
43
|
+
* @param {string} request.name - Name of the Domain
|
|
44
|
+
* @param {string} request.domainUri - The FQDN of the Domain
|
|
45
|
+
* @param {string} request.accessControlListRef - The reference to the AccessControlList for the Domain
|
|
46
|
+
* @param {CC.EgressPolicy[]} request.egressPolicies - The list of EgressPolicies for the Domain
|
|
47
|
+
* @param {string} request.extended - Optional extended attributes
|
|
48
|
+
* @return {Promise<CreateDomainResponse>} The newly created Domain
|
|
49
|
+
* @throws if request is null
|
|
50
|
+
* @example
|
|
51
|
+
*
|
|
52
|
+
* const request = {
|
|
53
|
+
* name: "Local domain",
|
|
54
|
+
* domainUri: "sip.local",
|
|
55
|
+
* accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
56
|
+
* egressPolicies: [{
|
|
57
|
+
* rule: ".*",
|
|
58
|
+
* numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
59
|
+
* }],
|
|
60
|
+
* extended: {
|
|
61
|
+
* "key": "value"
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* domains.createDomain(request)
|
|
66
|
+
* .then(console.log)
|
|
67
|
+
* .catch(console.error) // an error occurred
|
|
68
|
+
*/
|
|
69
|
+
createDomain(request: CreateDomainRequest): Promise<CreateDomainResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Updates an already existing Domain on Routr.
|
|
72
|
+
*
|
|
73
|
+
* @param {UpdateDomainRequest} request - Partial with the fields to update
|
|
74
|
+
* @param {string} request.name - Name of the Domain
|
|
75
|
+
* @param {string} request.domainUri - The FQDN of the Domain
|
|
76
|
+
* @param {string} request.accessControlListRef - The reference to the AccessControlList for the Domain
|
|
77
|
+
* @param {CC.EgressPolicy[]} request.egressPolicies - The list of EgressPolicies for the Domain
|
|
78
|
+
* @param {string} request.extended - Optional extended attributes
|
|
79
|
+
* @return {Promise<UpdateDomainResponse>} The updated Domain
|
|
80
|
+
* @example
|
|
81
|
+
*
|
|
82
|
+
* const request = {
|
|
83
|
+
* name: "Local domain updated",
|
|
84
|
+
* accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* domains.updateDomain(request)
|
|
88
|
+
* .then(console.log)
|
|
89
|
+
* .catch(console.error) // an error occurred
|
|
90
|
+
*/
|
|
91
|
+
updateDomain(request: UpdateDomainRequest): Promise<UpdateDomainResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Gets a Domain from Routr.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} ref - The Domain's reference
|
|
96
|
+
* @return {Promise<GetDomainResponse>} The Domain
|
|
97
|
+
* @example
|
|
98
|
+
*
|
|
99
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
100
|
+
*
|
|
101
|
+
* domains.getDomain(ref)
|
|
102
|
+
* .then(console.log)
|
|
103
|
+
* .catch(console.error) // an error occurred
|
|
104
|
+
*/
|
|
105
|
+
getDomain(ref: string): Promise<GetDomainResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Deletes a Domain from Routr.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} ref - The Domain's reference
|
|
110
|
+
* @return {Promise<void>}
|
|
111
|
+
* @example
|
|
112
|
+
*
|
|
113
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
114
|
+
*
|
|
115
|
+
* domains.deleteDomain(ref)
|
|
116
|
+
* .then(console.log)
|
|
117
|
+
* .catch(console.error) // an error occurred
|
|
118
|
+
*/
|
|
119
|
+
deleteDomain(ref: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Lists all Domains from Routr with pagination.
|
|
122
|
+
*
|
|
123
|
+
* @param {ListDomainRequest} request - The request to list Domains
|
|
124
|
+
* @param {number} request.pageSize - The number of Domains to return
|
|
125
|
+
* @param {string} request.pageToken - The page token to use for pagination
|
|
126
|
+
* @return {Promise<ListDomainResponse>} The list of Domains
|
|
127
|
+
* @example
|
|
128
|
+
*
|
|
129
|
+
* const request = {
|
|
130
|
+
* pageSize: 10
|
|
131
|
+
* }
|
|
132
|
+
*
|
|
133
|
+
* domains.listDomains(request)
|
|
134
|
+
* .then(console.log)
|
|
135
|
+
* .catch(console.error) // an error occurred
|
|
136
|
+
*/
|
|
137
|
+
listDomains(request: ListDomainRequest): Promise<ListDomainResponse>;
|
|
138
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
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.Domains = 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 Domains, a capability of Routr SIP Proxy, to create, update, get
|
|
34
|
+
* and delete Domains. The Domains API requires of a running Routr deployment.
|
|
35
|
+
*
|
|
36
|
+
* @extends APIClient
|
|
37
|
+
* @example
|
|
38
|
+
*
|
|
39
|
+
* const SDK = require("@routr/sdk")
|
|
40
|
+
* const domains = new SDK.Domains()
|
|
41
|
+
*
|
|
42
|
+
* const request = {
|
|
43
|
+
* name: "Local domain",
|
|
44
|
+
* domainUri: "sip.local",
|
|
45
|
+
* accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
46
|
+
* egressPolicies: [{
|
|
47
|
+
* rule: ".*",
|
|
48
|
+
* numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
49
|
+
* }],
|
|
50
|
+
* extended: {
|
|
51
|
+
* "key": "value"
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* domains.createDomain(request)
|
|
56
|
+
* .then(console.log)
|
|
57
|
+
* .catch(console.error) // an error occurred
|
|
58
|
+
*/
|
|
59
|
+
class Domains extends client_1.APIClient {
|
|
60
|
+
/**
|
|
61
|
+
* Constructs a new Domain API object.
|
|
62
|
+
*
|
|
63
|
+
* @param {ClientOptions} options - Options to indicate the objects endpoint
|
|
64
|
+
* @see module:core:APIClient
|
|
65
|
+
*/
|
|
66
|
+
constructor(options) {
|
|
67
|
+
super(options);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new Domain on Routr.
|
|
71
|
+
*
|
|
72
|
+
* @param {CreateDomainRequest} request - The request to create an Domain
|
|
73
|
+
* @param {string} request.name - Name of the Domain
|
|
74
|
+
* @param {string} request.domainUri - The FQDN of the Domain
|
|
75
|
+
* @param {string} request.accessControlListRef - The reference to the AccessControlList for the Domain
|
|
76
|
+
* @param {CC.EgressPolicy[]} request.egressPolicies - The list of EgressPolicies for the Domain
|
|
77
|
+
* @param {string} request.extended - Optional extended attributes
|
|
78
|
+
* @return {Promise<CreateDomainResponse>} The newly created Domain
|
|
79
|
+
* @throws if request is null
|
|
80
|
+
* @example
|
|
81
|
+
*
|
|
82
|
+
* const request = {
|
|
83
|
+
* name: "Local domain",
|
|
84
|
+
* domainUri: "sip.local",
|
|
85
|
+
* accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
86
|
+
* egressPolicies: [{
|
|
87
|
+
* rule: ".*",
|
|
88
|
+
* numberRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
89
|
+
* }],
|
|
90
|
+
* extended: {
|
|
91
|
+
* "key": "value"
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
*
|
|
95
|
+
* domains.createDomain(request)
|
|
96
|
+
* .then(console.log)
|
|
97
|
+
* .catch(console.error) // an error occurred
|
|
98
|
+
*/
|
|
99
|
+
createDomain(request) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
return this.client.domains.create(request);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Updates an already existing Domain on Routr.
|
|
106
|
+
*
|
|
107
|
+
* @param {UpdateDomainRequest} request - Partial with the fields to update
|
|
108
|
+
* @param {string} request.name - Name of the Domain
|
|
109
|
+
* @param {string} request.domainUri - The FQDN of the Domain
|
|
110
|
+
* @param {string} request.accessControlListRef - The reference to the AccessControlList for the Domain
|
|
111
|
+
* @param {CC.EgressPolicy[]} request.egressPolicies - The list of EgressPolicies for the Domain
|
|
112
|
+
* @param {string} request.extended - Optional extended attributes
|
|
113
|
+
* @return {Promise<UpdateDomainResponse>} The updated Domain
|
|
114
|
+
* @example
|
|
115
|
+
*
|
|
116
|
+
* const request = {
|
|
117
|
+
* name: "Local domain updated",
|
|
118
|
+
* accessControlListRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
119
|
+
* }
|
|
120
|
+
*
|
|
121
|
+
* domains.updateDomain(request)
|
|
122
|
+
* .then(console.log)
|
|
123
|
+
* .catch(console.error) // an error occurred
|
|
124
|
+
*/
|
|
125
|
+
updateDomain(request) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
return this.client.domains.update(request);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gets a Domain from Routr.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} ref - The Domain's reference
|
|
134
|
+
* @return {Promise<GetDomainResponse>} The Domain
|
|
135
|
+
* @example
|
|
136
|
+
*
|
|
137
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
138
|
+
*
|
|
139
|
+
* domains.getDomain(ref)
|
|
140
|
+
* .then(console.log)
|
|
141
|
+
* .catch(console.error) // an error occurred
|
|
142
|
+
*/
|
|
143
|
+
getDomain(ref) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
return this.client.domains.get(ref);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Deletes a Domain from Routr.
|
|
150
|
+
*
|
|
151
|
+
* @param {string} ref - The Domain's reference
|
|
152
|
+
* @return {Promise<void>}
|
|
153
|
+
* @example
|
|
154
|
+
*
|
|
155
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
156
|
+
*
|
|
157
|
+
* domains.deleteDomain(ref)
|
|
158
|
+
* .then(console.log)
|
|
159
|
+
* .catch(console.error) // an error occurred
|
|
160
|
+
*/
|
|
161
|
+
deleteDomain(ref) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
return this.client.domains.del(ref);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Lists all Domains from Routr with pagination.
|
|
168
|
+
*
|
|
169
|
+
* @param {ListDomainRequest} request - The request to list Domains
|
|
170
|
+
* @param {number} request.pageSize - The number of Domains to return
|
|
171
|
+
* @param {string} request.pageToken - The page token to use for pagination
|
|
172
|
+
* @return {Promise<ListDomainResponse>} The list of Domains
|
|
173
|
+
* @example
|
|
174
|
+
*
|
|
175
|
+
* const request = {
|
|
176
|
+
* pageSize: 10
|
|
177
|
+
* }
|
|
178
|
+
*
|
|
179
|
+
* domains.listDomains(request)
|
|
180
|
+
* .then(console.log)
|
|
181
|
+
* .catch(console.error) // an error occurred
|
|
182
|
+
*/
|
|
183
|
+
listDomains(request) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
return this.client.domains.list(request);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.Domains = Domains;
|
|
@@ -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("./domains"), exports);
|
|
37
|
+
var domains_1 = require("./domains");
|
|
38
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return domains_1.Domains; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommonConnect as CC } from "@routr/common";
|
|
2
|
+
import { CreateBaseOmit } from "../types";
|
|
3
|
+
export type CreateDomainRequest = Omit<CC.Domain, CreateBaseOmit | "accessControlList" | "egressPolicies"> & {
|
|
4
|
+
egressPolicies?: Omit<CC.EgressPolicy, "number">[];
|
|
5
|
+
};
|
|
6
|
+
export type CreateDomainResponse = CC.Domain;
|
|
7
|
+
export type UpdateDomainRequest = {
|
|
8
|
+
ref: string;
|
|
9
|
+
} & Partial<CreateDomainRequest>;
|
|
10
|
+
export type UpdateDomainResponse = CC.Domain;
|
|
11
|
+
export type ListDomainRequest = CC.ListRequest;
|
|
12
|
+
export type ListDomainResponse = CC.ListResponse<CC.Domain>;
|
|
13
|
+
export type GetDomainResponse = CC.Domain;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ACL from "./acl";
|
|
2
|
+
import Agents from "./agents";
|
|
3
|
+
import Domains from "./domains";
|
|
4
|
+
import Credentials from "./credentials";
|
|
5
|
+
import Peers from "./peers";
|
|
6
|
+
import Numbers from "./numbers";
|
|
7
|
+
import Trunks from "./trunks";
|
|
8
|
+
declare const SDK: {
|
|
9
|
+
ACL: typeof ACL;
|
|
10
|
+
Agents: typeof Agents;
|
|
11
|
+
Domains: typeof Domains;
|
|
12
|
+
Numbers: typeof Numbers;
|
|
13
|
+
Peers: typeof Peers;
|
|
14
|
+
Trunks: typeof Trunks;
|
|
15
|
+
Credentials: typeof Credentials;
|
|
16
|
+
};
|
|
17
|
+
export { SDK as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
|
+
* http://github.com/fonoster
|
|
10
|
+
*
|
|
11
|
+
* This file is part of Routr.
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the MIT License (the "License");
|
|
14
|
+
* you may not use this file except in compliance with
|
|
15
|
+
* the License. You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* https://opensource.org/licenses/MIT
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
const acl_1 = __importDefault(require("./acl"));
|
|
26
|
+
const agents_1 = __importDefault(require("./agents"));
|
|
27
|
+
const domains_1 = __importDefault(require("./domains"));
|
|
28
|
+
const credentials_1 = __importDefault(require("./credentials"));
|
|
29
|
+
const peers_1 = __importDefault(require("./peers"));
|
|
30
|
+
const numbers_1 = __importDefault(require("./numbers"));
|
|
31
|
+
const trunks_1 = __importDefault(require("./trunks"));
|
|
32
|
+
const SDK = {
|
|
33
|
+
ACL: acl_1.default,
|
|
34
|
+
Agents: agents_1.default,
|
|
35
|
+
Domains: domains_1.default,
|
|
36
|
+
Numbers: numbers_1.default,
|
|
37
|
+
Peers: peers_1.default,
|
|
38
|
+
Trunks: trunks_1.default,
|
|
39
|
+
Credentials: credentials_1.default
|
|
40
|
+
};
|
|
41
|
+
exports.default = SDK;
|
|
@@ -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("./numbers"), exports);
|
|
37
|
+
var numbers_1 = require("./numbers");
|
|
38
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return numbers_1.Numbers; } });
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { APIClient } from "../client";
|
|
2
|
+
import { ClientOptions } from "../types";
|
|
3
|
+
import { CreateNumberRequest, CreateNumberResponse, GetNumberResponse, ListNumberRequest, ListNumberResponse, UpdateNumberRequest, UpdateNumberResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Use Routr Numbers, a capability of Routr SIP Proxy, to create, update, get
|
|
6
|
+
* and delete Numbers. The Number API requires of a running Routr deployment.
|
|
7
|
+
*
|
|
8
|
+
* @extends APIClient
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* const SDK = require("@routr/sdk")
|
|
12
|
+
* const numbers = new SDK.Numbers()
|
|
13
|
+
*
|
|
14
|
+
* const request = {
|
|
15
|
+
* name: "(415) 555-1212",
|
|
16
|
+
* telUrl: "teL:+14155551212",
|
|
17
|
+
* aorLink: "sip:100@sip.local",
|
|
18
|
+
* city: "San Francisco",
|
|
19
|
+
* country: "United States",
|
|
20
|
+
* countryISOCode: "US",
|
|
21
|
+
* sessionAffinityHeader: "X-Room-Id"
|
|
22
|
+
* extraHeaders: [{
|
|
23
|
+
* name: "X-Room-Id",
|
|
24
|
+
* value: "abc-us-123"
|
|
25
|
+
* }],
|
|
26
|
+
* extended: {
|
|
27
|
+
* "key": "value"
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* numbers.createNumber(request)
|
|
32
|
+
* .then(console.log)
|
|
33
|
+
* .catch(console.error) // an error occurred
|
|
34
|
+
*/
|
|
35
|
+
export declare class Numbers extends APIClient {
|
|
36
|
+
/**
|
|
37
|
+
* Constructs a new Number API object.
|
|
38
|
+
*
|
|
39
|
+
* @param {ClientOptions} options - Options to indicate the objects endpoint
|
|
40
|
+
* @see module:core:APIClient
|
|
41
|
+
*/
|
|
42
|
+
constructor(options: ClientOptions);
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new Number on Routr.
|
|
45
|
+
*
|
|
46
|
+
* @param {CreateNumberRequest} request - The request to create an Number
|
|
47
|
+
* @param {string} request.name - Name of the Number
|
|
48
|
+
* @param {string} request.telUrl - The number URI to be used (e.g. te:+1234567890)
|
|
49
|
+
* @param {string} request.aorLink - The AOR link to be used (e.g. sip:1001@sip.local)
|
|
50
|
+
* @param {string} request.city - The city where the number is located
|
|
51
|
+
* @param {string} request.country - The country where the number is located
|
|
52
|
+
* @param {string} request.countryISOCode - The country ISO code where the number is located
|
|
53
|
+
* @param {{ name: string, value: string}[]} request.extraHeaders - Extra headers to be used
|
|
54
|
+
* @param {string} request.trunkRef - The trunk reference to be used
|
|
55
|
+
* @param {string} request.sessionAffinityHeader - Optional session affinity header
|
|
56
|
+
* @param {string} request.extended - Optional extended attributes
|
|
57
|
+
* @return {Promise<CreateNumberResponse>} The newly created Number
|
|
58
|
+
* @throws if request is null
|
|
59
|
+
* @example
|
|
60
|
+
*
|
|
61
|
+
* const request = {
|
|
62
|
+
* name: "(415) 555-1212",
|
|
63
|
+
* telUrl: "teL:+14155551212",
|
|
64
|
+
* aorLink: "sip:100@sip.local",
|
|
65
|
+
* city: "San Francisco",
|
|
66
|
+
* country: "United States",
|
|
67
|
+
* countryISOCode: "US",
|
|
68
|
+
* sessionAffinityHeader: "X-Room-Id"
|
|
69
|
+
* extraHeaders: [{
|
|
70
|
+
* name: "X-Room-Id",
|
|
71
|
+
* value: "abc-us-123"
|
|
72
|
+
* }],
|
|
73
|
+
* extended: {
|
|
74
|
+
* "key": "value"
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* numbers.createNumber(request)
|
|
79
|
+
* .then(console.log)
|
|
80
|
+
* .catch(console.error) // an error occurred
|
|
81
|
+
*/
|
|
82
|
+
createNumber(request: CreateNumberRequest): Promise<CreateNumberResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Updates an already existing Number on Routr.
|
|
85
|
+
*
|
|
86
|
+
* @param {UpdateNumberRequest} request - Partial with the fields to update
|
|
87
|
+
* @param {string} request.name - Name of the Number
|
|
88
|
+
* @param {string} request.telUrl - The number URI to be used (e.g. te:+1234567890)
|
|
89
|
+
* @param {string} request.aorLink - The AOR link to be used (e.g. sip:1001@sip.local)
|
|
90
|
+
* @param {string} request.city - The city where the number is located
|
|
91
|
+
* @param {string} request.country - The country where the number is located
|
|
92
|
+
* @param {string} request.countryISOCode - The country ISO code where the number is located
|
|
93
|
+
* @param {{ name: string, value: string}[]} request.extraHeaders - Extra headers to be used
|
|
94
|
+
* @param {string} request.trunkRef - The trunk reference to be used
|
|
95
|
+
* @param {string} request.sessionAffinityHeader - Optional session affinity header
|
|
96
|
+
* @param {string} request.extended - Optional extended attributes
|
|
97
|
+
* @return {Promise<UpdateNumberResponse>} The updated Number
|
|
98
|
+
* @example
|
|
99
|
+
*
|
|
100
|
+
* const request = {
|
|
101
|
+
* name: "(415) 555-1212 (friendly name)",
|
|
102
|
+
* aorLink: "sip:2001@sip.local"
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* numbers.updateNumber(request)
|
|
106
|
+
* .then(console.log)
|
|
107
|
+
* .catch(console.error) // an error occurred
|
|
108
|
+
*/
|
|
109
|
+
updateNumber(request: UpdateNumberRequest): Promise<UpdateNumberResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Gets a Number from Routr.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} ref - The Number's reference
|
|
114
|
+
* @return {Promise<GetNumberResponse>} The Number
|
|
115
|
+
* @example
|
|
116
|
+
*
|
|
117
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
118
|
+
*
|
|
119
|
+
* numbers.getNumber(ref)
|
|
120
|
+
* .then(console.log)
|
|
121
|
+
* .catch(console.error) // an error occurred
|
|
122
|
+
*/
|
|
123
|
+
getNumber(ref: string): Promise<GetNumberResponse>;
|
|
124
|
+
/**
|
|
125
|
+
* Deletes a Number from Routr.
|
|
126
|
+
*
|
|
127
|
+
* @param {string} ref - The Number's reference
|
|
128
|
+
* @return {Promise<void>}
|
|
129
|
+
* @example
|
|
130
|
+
*
|
|
131
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
132
|
+
*
|
|
133
|
+
* numbers.deleteNumber(ref)
|
|
134
|
+
* .then(console.log)
|
|
135
|
+
* .catch(console.error) // an error occurred
|
|
136
|
+
*/
|
|
137
|
+
deleteNumber(ref: string): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Lists all Numbers from Routr with pagination.
|
|
140
|
+
*
|
|
141
|
+
* @param {ListNumberRequest} request - The request to list Numbers
|
|
142
|
+
* @param {number} request.pageSize - The number of Numbers to return
|
|
143
|
+
* @param {string} request.pageToken - The page token to use for pagination
|
|
144
|
+
* @return {Promise<ListNumberResponse>} The list of Numbers
|
|
145
|
+
* @example
|
|
146
|
+
*
|
|
147
|
+
* const request = {
|
|
148
|
+
* pageSize: 10
|
|
149
|
+
* }
|
|
150
|
+
*
|
|
151
|
+
* numbers.listNumbers(request)
|
|
152
|
+
* .then(console.log)
|
|
153
|
+
* .catch(console.error) // an error occurred
|
|
154
|
+
*/
|
|
155
|
+
listNumbers(request: ListNumberRequest): Promise<ListNumberResponse>;
|
|
156
|
+
}
|