@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Fonoster Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { APIClient } from "../client";
|
|
2
|
+
import { ClientOptions } from "../types";
|
|
3
|
+
import { CreateACLRequest, CreateACLResponse, GetACLResponse, ListACLRequest, ListACLResponse, UpdateACLRequest, UpdateACLResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Use Routr ACL, a capability of Routr SIP Proxy, to create, update, get
|
|
6
|
+
* and delete Access Control Lists. The ACL API requires of a running Routr deployment.
|
|
7
|
+
*
|
|
8
|
+
* @extends APIClient
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* const SDK = require("@routr/sdk")
|
|
12
|
+
* const acl = new SDK.ACL()
|
|
13
|
+
*
|
|
14
|
+
* const request = {
|
|
15
|
+
* name: "Peer network",
|
|
16
|
+
* allow: "27.116.56.0/22",
|
|
17
|
+
* deny: "0.0.0.0/0"
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* acl.createACL(request)
|
|
21
|
+
* .then(console.log)
|
|
22
|
+
* .catch(console.error) // an error occurred
|
|
23
|
+
*/
|
|
24
|
+
export declare class ACL extends APIClient {
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a new ACL API object.
|
|
27
|
+
*
|
|
28
|
+
* @param {ClientOptions} options - Options to indicate the objects endpoint
|
|
29
|
+
* @see module:core:APIClient
|
|
30
|
+
*/
|
|
31
|
+
constructor(options: ClientOptions);
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new AccessControlList on Routr.
|
|
34
|
+
*
|
|
35
|
+
* @param {CreateACLRequest} request - The request to create an ACL
|
|
36
|
+
* @param {string} request.name - Name of the ACL
|
|
37
|
+
* @param {string[]} request.allow - List of IP addresses or CIDR blocks to allow
|
|
38
|
+
* @param {string[]} request.deny - List of IP addresses or CIDR blocks to deny
|
|
39
|
+
* @param {JsonObject} request.extended - Optional extended attributes
|
|
40
|
+
* @return {Promise<CreateACLResponse>} The newly created AccessControlList
|
|
41
|
+
* @throws if request is null
|
|
42
|
+
* @example
|
|
43
|
+
*
|
|
44
|
+
* const request = {
|
|
45
|
+
* name: "Peer network",
|
|
46
|
+
* allow: "27.116.56.0/22",
|
|
47
|
+
* deny: "0.0.0.0/0"
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* acl.createACL(request)
|
|
51
|
+
* .then(console.log)
|
|
52
|
+
* .catch(console.error) // an error occurred
|
|
53
|
+
*/
|
|
54
|
+
createACL(request: CreateACLRequest): Promise<CreateACLResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Updates an already existing AccessControlList on Routr.
|
|
57
|
+
*
|
|
58
|
+
* @param {UpdateACLRequest} request - Partial with the fields to update
|
|
59
|
+
* @param {string} request.name - Name of the ACL
|
|
60
|
+
* @param {string[]} request.allow - List of IP addresses or CIDR blocks to allow
|
|
61
|
+
* @param {string[]} request.deny - List of IP addresses or CIDR blocks to deny
|
|
62
|
+
* @param {JsonObject} request.extended - Optional extended attributes
|
|
63
|
+
* @return {Promise<UpdateACLResponse>} The AccessControlList
|
|
64
|
+
* @example
|
|
65
|
+
*
|
|
66
|
+
* const request = {
|
|
67
|
+
* ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
68
|
+
* name: "Peer network updated",
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* acl.updateACL(request)
|
|
72
|
+
* .then(console.log)
|
|
73
|
+
* .catch(console.error) // an error occurred
|
|
74
|
+
*/
|
|
75
|
+
updateACL(request: UpdateACLRequest): Promise<UpdateACLResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Gets an AccessControlList from Routr.
|
|
78
|
+
*
|
|
79
|
+
* @param {string} ref - The ACL reference
|
|
80
|
+
* @return {Promise<GetACLResponse>} The AccessControlList
|
|
81
|
+
* @example
|
|
82
|
+
*
|
|
83
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
84
|
+
*
|
|
85
|
+
* acl.getACL(ref)
|
|
86
|
+
* .then(console.log)
|
|
87
|
+
* .catch(console.error) // an error occurred
|
|
88
|
+
*/
|
|
89
|
+
getACL(ref: string): Promise<GetACLResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Deletes an AccessControlList from Routr.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} ref - The ACL reference
|
|
94
|
+
* @return {Promise<void>}
|
|
95
|
+
* @example
|
|
96
|
+
*
|
|
97
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
98
|
+
*
|
|
99
|
+
* acl.deleteACL(ref)
|
|
100
|
+
* .then(console.log)
|
|
101
|
+
* .catch(console.error) // an error occurred
|
|
102
|
+
*/
|
|
103
|
+
deleteACL(ref: string): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Lists all AccessControlLists from Routr with pagination.
|
|
106
|
+
*
|
|
107
|
+
* @param {ListACLRequest} request - The request to list ACLs
|
|
108
|
+
* @param {number} request.pageSize - The number of ACLs to return
|
|
109
|
+
* @param {string} request.pageToken - The page token to use for pagination
|
|
110
|
+
* @return {Promise<ListACLResponse>} The list of AccessControlLists
|
|
111
|
+
* @example
|
|
112
|
+
*
|
|
113
|
+
* const request = {
|
|
114
|
+
* pageSize: 10
|
|
115
|
+
* }
|
|
116
|
+
*
|
|
117
|
+
* acl.listACLs(request)
|
|
118
|
+
* .then(console.log)
|
|
119
|
+
* .catch(console.error) // an error occurred
|
|
120
|
+
*/
|
|
121
|
+
listACLs(request: ListACLRequest): Promise<ListACLResponse>;
|
|
122
|
+
}
|
package/dist/acl/acl.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
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.ACL = 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 ACL, a capability of Routr SIP Proxy, to create, update, get
|
|
34
|
+
* and delete Access Control Lists. The ACL API requires of a running Routr deployment.
|
|
35
|
+
*
|
|
36
|
+
* @extends APIClient
|
|
37
|
+
* @example
|
|
38
|
+
*
|
|
39
|
+
* const SDK = require("@routr/sdk")
|
|
40
|
+
* const acl = new SDK.ACL()
|
|
41
|
+
*
|
|
42
|
+
* const request = {
|
|
43
|
+
* name: "Peer network",
|
|
44
|
+
* allow: "27.116.56.0/22",
|
|
45
|
+
* deny: "0.0.0.0/0"
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* acl.createACL(request)
|
|
49
|
+
* .then(console.log)
|
|
50
|
+
* .catch(console.error) // an error occurred
|
|
51
|
+
*/
|
|
52
|
+
class ACL extends client_1.APIClient {
|
|
53
|
+
/**
|
|
54
|
+
* Constructs a new ACL API object.
|
|
55
|
+
*
|
|
56
|
+
* @param {ClientOptions} options - Options to indicate the objects endpoint
|
|
57
|
+
* @see module:core:APIClient
|
|
58
|
+
*/
|
|
59
|
+
constructor(options) {
|
|
60
|
+
super(options);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new AccessControlList on Routr.
|
|
64
|
+
*
|
|
65
|
+
* @param {CreateACLRequest} request - The request to create an ACL
|
|
66
|
+
* @param {string} request.name - Name of the ACL
|
|
67
|
+
* @param {string[]} request.allow - List of IP addresses or CIDR blocks to allow
|
|
68
|
+
* @param {string[]} request.deny - List of IP addresses or CIDR blocks to deny
|
|
69
|
+
* @param {JsonObject} request.extended - Optional extended attributes
|
|
70
|
+
* @return {Promise<CreateACLResponse>} The newly created AccessControlList
|
|
71
|
+
* @throws if request is null
|
|
72
|
+
* @example
|
|
73
|
+
*
|
|
74
|
+
* const request = {
|
|
75
|
+
* name: "Peer network",
|
|
76
|
+
* allow: "27.116.56.0/22",
|
|
77
|
+
* deny: "0.0.0.0/0"
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* acl.createACL(request)
|
|
81
|
+
* .then(console.log)
|
|
82
|
+
* .catch(console.error) // an error occurred
|
|
83
|
+
*/
|
|
84
|
+
createACL(request) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
return this.client.acl.create(request);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Updates an already existing AccessControlList on Routr.
|
|
91
|
+
*
|
|
92
|
+
* @param {UpdateACLRequest} request - Partial with the fields to update
|
|
93
|
+
* @param {string} request.name - Name of the ACL
|
|
94
|
+
* @param {string[]} request.allow - List of IP addresses or CIDR blocks to allow
|
|
95
|
+
* @param {string[]} request.deny - List of IP addresses or CIDR blocks to deny
|
|
96
|
+
* @param {JsonObject} request.extended - Optional extended attributes
|
|
97
|
+
* @return {Promise<UpdateACLResponse>} The AccessControlList
|
|
98
|
+
* @example
|
|
99
|
+
*
|
|
100
|
+
* const request = {
|
|
101
|
+
* ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
102
|
+
* name: "Peer network updated",
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* acl.updateACL(request)
|
|
106
|
+
* .then(console.log)
|
|
107
|
+
* .catch(console.error) // an error occurred
|
|
108
|
+
*/
|
|
109
|
+
updateACL(request) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
return this.client.acl.update(request);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Gets an AccessControlList from Routr.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} ref - The ACL reference
|
|
118
|
+
* @return {Promise<GetACLResponse>} The AccessControlList
|
|
119
|
+
* @example
|
|
120
|
+
*
|
|
121
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
122
|
+
*
|
|
123
|
+
* acl.getACL(ref)
|
|
124
|
+
* .then(console.log)
|
|
125
|
+
* .catch(console.error) // an error occurred
|
|
126
|
+
*/
|
|
127
|
+
getACL(ref) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
return this.client.acl.get(ref);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Deletes an AccessControlList from Routr.
|
|
134
|
+
*
|
|
135
|
+
* @param {string} ref - The ACL reference
|
|
136
|
+
* @return {Promise<void>}
|
|
137
|
+
* @example
|
|
138
|
+
*
|
|
139
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
140
|
+
*
|
|
141
|
+
* acl.deleteACL(ref)
|
|
142
|
+
* .then(console.log)
|
|
143
|
+
* .catch(console.error) // an error occurred
|
|
144
|
+
*/
|
|
145
|
+
deleteACL(ref) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
return this.client.acl.del(ref);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Lists all AccessControlLists from Routr with pagination.
|
|
152
|
+
*
|
|
153
|
+
* @param {ListACLRequest} request - The request to list ACLs
|
|
154
|
+
* @param {number} request.pageSize - The number of ACLs to return
|
|
155
|
+
* @param {string} request.pageToken - The page token to use for pagination
|
|
156
|
+
* @return {Promise<ListACLResponse>} The list of AccessControlLists
|
|
157
|
+
* @example
|
|
158
|
+
*
|
|
159
|
+
* const request = {
|
|
160
|
+
* pageSize: 10
|
|
161
|
+
* }
|
|
162
|
+
*
|
|
163
|
+
* acl.listACLs(request)
|
|
164
|
+
* .then(console.log)
|
|
165
|
+
* .catch(console.error) // an error occurred
|
|
166
|
+
*/
|
|
167
|
+
listACLs(request) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
return this.client.acl.list(request);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.ACL = ACL;
|
|
@@ -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("./acl"), exports);
|
|
37
|
+
var acl_1 = require("./acl");
|
|
38
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return acl_1.ACL; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommonConnect as CC } from "@routr/common";
|
|
2
|
+
import { CreateBaseOmit } from "../types";
|
|
3
|
+
export type CreateACLRequest = Omit<CC.AccessControlList, CreateBaseOmit>;
|
|
4
|
+
export type CreateACLResponse = CC.AccessControlList;
|
|
5
|
+
export type UpdateACLRequest = {
|
|
6
|
+
ref: string;
|
|
7
|
+
} & Partial<CreateACLRequest>;
|
|
8
|
+
export type UpdateACLResponse = CC.AccessControlList;
|
|
9
|
+
export type ListACLRequest = CC.ListRequest;
|
|
10
|
+
export type ListACLResponse = CC.ListResponse<CC.AccessControlList>;
|
|
11
|
+
export type GetACLResponse = CC.AccessControlList;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { APIClient } from "../client";
|
|
2
|
+
import { ClientOptions } from "../types";
|
|
3
|
+
import { CreateAgentRequest, CreateAgentResponse, GetAgentResponse, ListAgentRequest, ListAgentResponse, UpdateAgentRequest, UpdateAgentResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Use Routr Agents, a capability of Routr SIP Proxy, to create, update, get
|
|
6
|
+
* and delete Agents. The Agents API requires of a running Routr deployment.
|
|
7
|
+
*
|
|
8
|
+
* @extends APIClient
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* const SDK = require("@routr/sdk")
|
|
12
|
+
* const agents = new SDK.Agents()
|
|
13
|
+
*
|
|
14
|
+
* const request = {
|
|
15
|
+
* name: "Jonh Doe",
|
|
16
|
+
* username: "jdoe",
|
|
17
|
+
* privacy: Privacy.PRIVATE,
|
|
18
|
+
* domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
19
|
+
* credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
20
|
+
* enabled: true,
|
|
21
|
+
* extended: {
|
|
22
|
+
* "key": "value"
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* agents.createAgent(request)
|
|
27
|
+
* .then(console.log)
|
|
28
|
+
* .catch(console.error) // an error occurred
|
|
29
|
+
*/
|
|
30
|
+
export declare class Agents extends APIClient {
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new Agent API object.
|
|
33
|
+
*
|
|
34
|
+
* @param {ClientOptions} options - Options to indicate the objects endpoint
|
|
35
|
+
* @see module:core:APIClient
|
|
36
|
+
*/
|
|
37
|
+
constructor(options: ClientOptions);
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new Agent on Routr.
|
|
40
|
+
*
|
|
41
|
+
* @param {CreateAgentRequest} request - The request to create an Agent
|
|
42
|
+
* @param {string} request.name - Name of the Agent
|
|
43
|
+
* @param {string} request.username - Username of the Agent
|
|
44
|
+
* @param {Privacy} request.privacy - Privacy of the Agent (e.g. Privacy.PRIVATE)
|
|
45
|
+
* @param {string} request.domainRef - Domain reference of the Domain the Agent belongs to
|
|
46
|
+
* @param {string} request.credentialsRef - Credentials reference of the Credentials for the Agent
|
|
47
|
+
* @param {boolean} request.enabled - Whether the Agent is enabled or not (for future use)
|
|
48
|
+
* @param {JsonObject} request.extended - Optional extended attributes
|
|
49
|
+
* @return {Promise<CreateAgentResponse>} The newly created Agent
|
|
50
|
+
* @throws if request is null
|
|
51
|
+
* @example
|
|
52
|
+
*
|
|
53
|
+
* const request = {
|
|
54
|
+
* name: "Jonh Doe",
|
|
55
|
+
* username: "jdoe",
|
|
56
|
+
* privacy: Privacy.PRIVATE,
|
|
57
|
+
* domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
58
|
+
* credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
59
|
+
* enabled: true,
|
|
60
|
+
* extended: {
|
|
61
|
+
* "key": "value"
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* agents.createAgent(request)
|
|
66
|
+
* .then(console.log)
|
|
67
|
+
* .catch(console.error) // an error occurred
|
|
68
|
+
*/
|
|
69
|
+
createAgent(request: CreateAgentRequest): Promise<CreateAgentResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Updates an already existing Agent on Routr.
|
|
72
|
+
*
|
|
73
|
+
* @param {UpdateAgentRequest} request - Partial with the fields to update
|
|
74
|
+
* @param {string} request.name - Name of the Agent
|
|
75
|
+
* @param {string} request.username - Username of the Agent
|
|
76
|
+
* @param {Privacy} request.privacy - Privacy of the Agent (e.g. Privacy.PRIVATE)
|
|
77
|
+
* @param {string} request.domainRef - Domain reference of the Domain the Agent belongs to
|
|
78
|
+
* @param {string} request.credentialsRef - Credentials reference of the Credentials for the Agent
|
|
79
|
+
* @param {boolean} request.enabled - Whether the Agent is enabled or not (for future use)
|
|
80
|
+
* @param {JsonObject} request.extended - Optional extended attributes
|
|
81
|
+
* @return {Promise<UpdateAgentResponse>} The updated Agent
|
|
82
|
+
* @example
|
|
83
|
+
*
|
|
84
|
+
* const request = {
|
|
85
|
+
* ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
|
|
86
|
+
* name: "John D Doe",
|
|
87
|
+
* enabled: false
|
|
88
|
+
* }
|
|
89
|
+
*
|
|
90
|
+
* agents.updateAgent(request)
|
|
91
|
+
* .then(console.log)
|
|
92
|
+
* .catch(console.error) // an error occurred
|
|
93
|
+
*/
|
|
94
|
+
updateAgent(request: UpdateAgentRequest): Promise<UpdateAgentResponse>;
|
|
95
|
+
/**
|
|
96
|
+
* Gets an Agent from Routr.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} ref - The Agent's reference
|
|
99
|
+
* @return {Promise<GetAgentResponse>} The Agent
|
|
100
|
+
* @example
|
|
101
|
+
*
|
|
102
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
103
|
+
*
|
|
104
|
+
* agents.getAgent(ref)
|
|
105
|
+
* .then(console.log)
|
|
106
|
+
* .catch(console.error) // an error occurred
|
|
107
|
+
*/
|
|
108
|
+
getAgent(ref: string): Promise<GetAgentResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* Deletes an Agent from Routr.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} ref - The Agent's reference
|
|
113
|
+
* @return {Promise<void>}
|
|
114
|
+
* @example
|
|
115
|
+
*
|
|
116
|
+
* const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
|
|
117
|
+
*
|
|
118
|
+
* agents.deleteAgent(ref)
|
|
119
|
+
* .then(console.log)
|
|
120
|
+
* .catch(console.error) // an error occurred
|
|
121
|
+
*/
|
|
122
|
+
deleteAgent(ref: string): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Lists all Agents from Routr with pagination.
|
|
125
|
+
*
|
|
126
|
+
* @param {ListAgentRequest} request - The request to list Agents
|
|
127
|
+
* @param {number} request.pageSize - The number of Agents to return
|
|
128
|
+
* @param {string} request.pageToken - The page token to use for pagination
|
|
129
|
+
* @return {Promise<ListAgentResponse>} The list of Agents in the current page
|
|
130
|
+
* @example
|
|
131
|
+
*
|
|
132
|
+
* const request = {
|
|
133
|
+
* pageSize: 10
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* agents.listAgents(request)
|
|
137
|
+
* .then(console.log)
|
|
138
|
+
* .catch(console.error) // an error occurred
|
|
139
|
+
*/
|
|
140
|
+
listAgents(request: ListAgentRequest): Promise<ListAgentResponse>;
|
|
141
|
+
}
|