@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,192 @@
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.Agents = 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 Agents, a capability of Routr SIP Proxy, to create, update, get
34
+ * and delete Agents. The Agents API requires of a running Routr deployment.
35
+ *
36
+ * @extends APIClient
37
+ * @example
38
+ *
39
+ * const SDK = require("@routr/sdk")
40
+ * const agents = new SDK.Agents()
41
+ *
42
+ * const request = {
43
+ * name: "Jonh Doe",
44
+ * username: "jdoe",
45
+ * privacy: Privacy.PRIVATE,
46
+ * domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
47
+ * credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
48
+ * enabled: true,
49
+ * extended: {
50
+ * "key": "value"
51
+ * }
52
+ * }
53
+ *
54
+ * agents.createAgent(request)
55
+ * .then(console.log)
56
+ * .catch(console.error) // an error occurred
57
+ */
58
+ class Agents extends client_1.APIClient {
59
+ /**
60
+ * Constructs a new Agent API object.
61
+ *
62
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
63
+ * @see module:core:APIClient
64
+ */
65
+ constructor(options) {
66
+ super(options);
67
+ }
68
+ /**
69
+ * Creates a new Agent on Routr.
70
+ *
71
+ * @param {CreateAgentRequest} request - The request to create an Agent
72
+ * @param {string} request.name - Name of the Agent
73
+ * @param {string} request.username - Username of the Agent
74
+ * @param {Privacy} request.privacy - Privacy of the Agent (e.g. Privacy.PRIVATE)
75
+ * @param {string} request.domainRef - Domain reference of the Domain the Agent belongs to
76
+ * @param {string} request.credentialsRef - Credentials reference of the Credentials for the Agent
77
+ * @param {boolean} request.enabled - Whether the Agent is enabled or not (for future use)
78
+ * @param {JsonObject} request.extended - Optional extended attributes
79
+ * @return {Promise<CreateAgentResponse>} The newly created Agent
80
+ * @throws if request is null
81
+ * @example
82
+ *
83
+ * const request = {
84
+ * name: "Jonh Doe",
85
+ * username: "jdoe",
86
+ * privacy: Privacy.PRIVATE,
87
+ * domainRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
88
+ * credentialsRef: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
89
+ * enabled: true,
90
+ * extended: {
91
+ * "key": "value"
92
+ * }
93
+ * }
94
+ *
95
+ * agents.createAgent(request)
96
+ * .then(console.log)
97
+ * .catch(console.error) // an error occurred
98
+ */
99
+ createAgent(request) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ return this.client.agents.create(request);
102
+ });
103
+ }
104
+ /**
105
+ * Updates an already existing Agent on Routr.
106
+ *
107
+ * @param {UpdateAgentRequest} request - Partial with the fields to update
108
+ * @param {string} request.name - Name of the Agent
109
+ * @param {string} request.username - Username of the Agent
110
+ * @param {Privacy} request.privacy - Privacy of the Agent (e.g. Privacy.PRIVATE)
111
+ * @param {string} request.domainRef - Domain reference of the Domain the Agent belongs to
112
+ * @param {string} request.credentialsRef - Credentials reference of the Credentials for the Agent
113
+ * @param {boolean} request.enabled - Whether the Agent is enabled or not (for future use)
114
+ * @param {JsonObject} request.extended - Optional extended attributes
115
+ * @return {Promise<UpdateAgentResponse>} The updated Agent
116
+ * @example
117
+ *
118
+ * const request = {
119
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
120
+ * name: "John D Doe",
121
+ * enabled: false
122
+ * }
123
+ *
124
+ * agents.updateAgent(request)
125
+ * .then(console.log)
126
+ * .catch(console.error) // an error occurred
127
+ */
128
+ updateAgent(request) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ return this.client.agents.update(request);
131
+ });
132
+ }
133
+ /**
134
+ * Gets an Agent from Routr.
135
+ *
136
+ * @param {string} ref - The Agent's reference
137
+ * @return {Promise<GetAgentResponse>} The Agent
138
+ * @example
139
+ *
140
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
141
+ *
142
+ * agents.getAgent(ref)
143
+ * .then(console.log)
144
+ * .catch(console.error) // an error occurred
145
+ */
146
+ getAgent(ref) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ return this.client.agents.get(ref);
149
+ });
150
+ }
151
+ /**
152
+ * Deletes an Agent from Routr.
153
+ *
154
+ * @param {string} ref - The Agent's reference
155
+ * @return {Promise<void>}
156
+ * @example
157
+ *
158
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
159
+ *
160
+ * agents.deleteAgent(ref)
161
+ * .then(console.log)
162
+ * .catch(console.error) // an error occurred
163
+ */
164
+ deleteAgent(ref) {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ return this.client.agents.del(ref);
167
+ });
168
+ }
169
+ /**
170
+ * Lists all Agents from Routr with pagination.
171
+ *
172
+ * @param {ListAgentRequest} request - The request to list Agents
173
+ * @param {number} request.pageSize - The number of Agents to return
174
+ * @param {string} request.pageToken - The page token to use for pagination
175
+ * @return {Promise<ListAgentResponse>} The list of Agents in the current page
176
+ * @example
177
+ *
178
+ * const request = {
179
+ * pageSize: 10
180
+ * }
181
+ *
182
+ * agents.listAgents(request)
183
+ * .then(console.log)
184
+ * .catch(console.error) // an error occurred
185
+ */
186
+ listAgents(request) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ return this.client.agents.list(request);
189
+ });
190
+ }
191
+ }
192
+ exports.Agents = Agents;
@@ -0,0 +1,2 @@
1
+ export * from "./agents";
2
+ export { Agents as default } from "./agents";
@@ -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("./agents"), exports);
37
+ var agents_1 = require("./agents");
38
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return agents_1.Agents; } });
@@ -0,0 +1,11 @@
1
+ import { CommonConnect as CC } from "@routr/common";
2
+ import { CreateBaseOmit } from "../types";
3
+ export type CreateAgentRequest = Omit<CC.Agent, CreateBaseOmit | "domain" | "credentials">;
4
+ export type CreateAgentResponse = CC.Agent;
5
+ export type UpdateAgentRequest = {
6
+ ref: string;
7
+ } & Partial<CreateAgentRequest>;
8
+ export type UpdateAgentResponse = CC.Agent;
9
+ export type ListAgentRequest = CC.ListRequest;
10
+ export type ListAgentResponse = CC.ListResponse<CC.Agent>;
11
+ export type GetAgentResponse = CC.Agent;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { CommonConnect as CC } from "@routr/common";
2
+ import { APIClient as ConnectClient } from "@routr/common/src/connect";
3
+ import { ClientOptions } from "./types";
4
+ export declare abstract class APIClient {
5
+ client: ConnectClient;
6
+ constructor(options: ClientOptions);
7
+ getService(): CC.APIClient;
8
+ }
package/dist/client.js ADDED
@@ -0,0 +1,68 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.APIClient = void 0;
27
+ /*
28
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
29
+ * http://github.com/fonoster
30
+ *
31
+ * This file is part of Routr.
32
+ *
33
+ * Licensed under the MIT License (the "License");
34
+ * you may not use this file except in compliance with
35
+ * the License. You may obtain a copy of the License at
36
+ *
37
+ * https://opensource.org/licenses/MIT
38
+ *
39
+ * Unless required by applicable law or agreed to in writing, software
40
+ * distributed under the License is distributed on an "AS IS" BASIS,
41
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42
+ * See the License for the specific language governing permissions and
43
+ * limitations under the License.
44
+ */
45
+ /* eslint-disable require-jsdoc */
46
+ const grpc = __importStar(require("@grpc/grpc-js"));
47
+ const grpc_js_1 = require("@grpc/grpc-js");
48
+ const common_1 = require("@routr/common");
49
+ class APIClient {
50
+ constructor(options) {
51
+ const metadata = new grpc_js_1.Metadata();
52
+ if (options.username && options.password) {
53
+ metadata.set("authorization", `Basic ${Buffer.from(`${options.username}:${options.password}`).toString("base64")}`);
54
+ }
55
+ const credentials = process.env.ALLOW_INSECURE === "true"
56
+ ? grpc.credentials.createInsecure()
57
+ : grpc.credentials.createSsl();
58
+ this.client = common_1.CommonConnect.apiClient({
59
+ apiAddr: options.endpoint,
60
+ metadata,
61
+ credentials
62
+ });
63
+ }
64
+ getService() {
65
+ return this.client;
66
+ }
67
+ }
68
+ exports.APIClient = APIClient;
@@ -0,0 +1,128 @@
1
+ import { APIClient } from "../client";
2
+ import { ClientOptions } from "../types";
3
+ import { CreateCredentialsRequest, CreateCredentialsResponse, GetCredentialsResponse, ListCredentialsRequest, ListCredentialsResponse, UpdateCredentialsRequest, UpdateCredentialsResponse } from "./types";
4
+ /**
5
+ * @classdesc Use Routr Credentials, a capability of Routr SIP Proxy, to create, update, get
6
+ * and delete Credentials. The Credentials API requires of a running Routr deployment.
7
+ *
8
+ * @extends APIClient
9
+ * @example
10
+ *
11
+ * const SDK = require("@routr/sdk")
12
+ * const credentials = new SDK.Credentials()
13
+ *
14
+ * const request = {
15
+ * name: "Credentials for John Doe",
16
+ * username: "jdoe",
17
+ * password: "123456",
18
+ * extended: {
19
+ * "key": "value"
20
+ * }
21
+ * }
22
+ *
23
+ * credentials.createCredentials(request)
24
+ * .then(console.log)
25
+ * .catch(console.error) // an error occurred
26
+ */
27
+ export declare class Credentials extends APIClient {
28
+ /**
29
+ * Constructs a new Credentials API object.
30
+ *
31
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
32
+ * @see module:core:APIClient
33
+ */
34
+ constructor(options: ClientOptions);
35
+ /**
36
+ * Creates a new Credentials on Routr.
37
+ *
38
+ * @param {CreateCredentialsRequest} request - The request to create an Credentials
39
+ * @param {string} request.name - The friendly name of the Credentials
40
+ * @param {string} request.username - Username of the Credentials
41
+ * @param {string} request.password - Password of the Credentials
42
+ * @param {JsonObject} request.extended - Optional extended attributes
43
+ * @return {Promise<CreateCredentialsResponse>} The newly created Credentials
44
+ * @throws if request is null
45
+ * @example
46
+ *
47
+ * const request = {
48
+ * name: "Credentials for John Doe",
49
+ * username: "jdoe",
50
+ * password: "123456",
51
+ * extended: {
52
+ * "key": "value"
53
+ * }
54
+ * }
55
+ *
56
+ * credentials.createCredentials(request)
57
+ * .then(console.log)
58
+ * .catch(console.error) // an error occurred
59
+ */
60
+ createCredentials(request: CreateCredentialsRequest): Promise<CreateCredentialsResponse>;
61
+ /**
62
+ * Updates an already existing Credentials on Routr.
63
+ *
64
+ * @param {UpdateCredentialsRequest} request - Partial with the fields to update
65
+ * @param {string} request.name - The friendly name of the Credentials
66
+ * @param {string} request.username - Username of the Credentials
67
+ * @param {string} request.password - Password of the Credentials
68
+ * @param {JsonObject} request.extended - Optional extended attributes
69
+ * @return {Promise<UpdateCredentialsResponse>} The updated Credentials
70
+ * @example
71
+ *
72
+ * const request = {
73
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
74
+ * name: "John Doe's Credentials"
75
+ * }
76
+ *
77
+ * credentials.updateCredentials(request)
78
+ * .then(console.log)
79
+ * .catch(console.error) // an error occurred
80
+ */
81
+ updateCredentials(request: UpdateCredentialsRequest): Promise<UpdateCredentialsResponse>;
82
+ /**
83
+ * Gets an Credentials from Routr.
84
+ *
85
+ * @param {string} ref - The Credentials's reference
86
+ * @return {Promise<GetCredentialsResponse>} The Credentials
87
+ * @example
88
+ *
89
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
90
+ *
91
+ * credentials.getCredentials(ref)
92
+ * .then(console.log)
93
+ * .catch(console.error) // an error occurred
94
+ */
95
+ getCredentials(ref: string): Promise<GetCredentialsResponse>;
96
+ /**
97
+ * Deletes an Credentials from Routr.
98
+ *
99
+ * @param {string} ref - The Credentials's reference
100
+ * @return {Promise<void>}
101
+ * @example
102
+ *
103
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
104
+ *
105
+ * credentials.deleteCredentials(ref)
106
+ * .then(console.log)
107
+ * .catch(console.error) // an error occurred
108
+ */
109
+ deleteCredentials(ref: string): Promise<void>;
110
+ /**
111
+ * Lists all Credentials from Routr with pagination.
112
+ *
113
+ * @param {ListCredentialsRequest} request - The request to list Credentials
114
+ * @param {number} request.pageSize - The number of Credentials to return
115
+ * @param {string} request.pageToken - The page token to use for pagination
116
+ * @return {Promise<ListCredentialsResponse>} The list of Credentials in the current page
117
+ * @example
118
+ *
119
+ * const request = {
120
+ * pageSize: 10
121
+ * }
122
+ *
123
+ * credentials.listCredentials(request)
124
+ * .then(console.log)
125
+ * .catch(console.error) // an error occurred
126
+ */
127
+ listCredentials(request: ListCredentialsRequest): Promise<ListCredentialsResponse>;
128
+ }
@@ -0,0 +1,179 @@
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.Credentials = 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 Credentials, a capability of Routr SIP Proxy, to create, update, get
34
+ * and delete Credentials. The Credentials API requires of a running Routr deployment.
35
+ *
36
+ * @extends APIClient
37
+ * @example
38
+ *
39
+ * const SDK = require("@routr/sdk")
40
+ * const credentials = new SDK.Credentials()
41
+ *
42
+ * const request = {
43
+ * name: "Credentials for John Doe",
44
+ * username: "jdoe",
45
+ * password: "123456",
46
+ * extended: {
47
+ * "key": "value"
48
+ * }
49
+ * }
50
+ *
51
+ * credentials.createCredentials(request)
52
+ * .then(console.log)
53
+ * .catch(console.error) // an error occurred
54
+ */
55
+ class Credentials extends client_1.APIClient {
56
+ /**
57
+ * Constructs a new Credentials API object.
58
+ *
59
+ * @param {ClientOptions} options - Options to indicate the objects endpoint
60
+ * @see module:core:APIClient
61
+ */
62
+ constructor(options) {
63
+ super(options);
64
+ }
65
+ /**
66
+ * Creates a new Credentials on Routr.
67
+ *
68
+ * @param {CreateCredentialsRequest} request - The request to create an Credentials
69
+ * @param {string} request.name - The friendly name of the Credentials
70
+ * @param {string} request.username - Username of the Credentials
71
+ * @param {string} request.password - Password of the Credentials
72
+ * @param {JsonObject} request.extended - Optional extended attributes
73
+ * @return {Promise<CreateCredentialsResponse>} The newly created Credentials
74
+ * @throws if request is null
75
+ * @example
76
+ *
77
+ * const request = {
78
+ * name: "Credentials for John Doe",
79
+ * username: "jdoe",
80
+ * password: "123456",
81
+ * extended: {
82
+ * "key": "value"
83
+ * }
84
+ * }
85
+ *
86
+ * credentials.createCredentials(request)
87
+ * .then(console.log)
88
+ * .catch(console.error) // an error occurred
89
+ */
90
+ createCredentials(request) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return this.client.credentials.create(request);
93
+ });
94
+ }
95
+ /**
96
+ * Updates an already existing Credentials on Routr.
97
+ *
98
+ * @param {UpdateCredentialsRequest} request - Partial with the fields to update
99
+ * @param {string} request.name - The friendly name of the Credentials
100
+ * @param {string} request.username - Username of the Credentials
101
+ * @param {string} request.password - Password of the Credentials
102
+ * @param {JsonObject} request.extended - Optional extended attributes
103
+ * @return {Promise<UpdateCredentialsResponse>} The updated Credentials
104
+ * @example
105
+ *
106
+ * const request = {
107
+ * ref: "4671371b-ff5d-48b1-aabe-d3c5ca5317a3",
108
+ * name: "John Doe's Credentials"
109
+ * }
110
+ *
111
+ * credentials.updateCredentials(request)
112
+ * .then(console.log)
113
+ * .catch(console.error) // an error occurred
114
+ */
115
+ updateCredentials(request) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ return this.client.credentials.update(request);
118
+ });
119
+ }
120
+ /**
121
+ * Gets an Credentials from Routr.
122
+ *
123
+ * @param {string} ref - The Credentials's reference
124
+ * @return {Promise<GetCredentialsResponse>} The Credentials
125
+ * @example
126
+ *
127
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
128
+ *
129
+ * credentials.getCredentials(ref)
130
+ * .then(console.log)
131
+ * .catch(console.error) // an error occurred
132
+ */
133
+ getCredentials(ref) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ return this.client.credentials.get(ref);
136
+ });
137
+ }
138
+ /**
139
+ * Deletes an Credentials from Routr.
140
+ *
141
+ * @param {string} ref - The Credentials's reference
142
+ * @return {Promise<void>}
143
+ * @example
144
+ *
145
+ * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3"
146
+ *
147
+ * credentials.deleteCredentials(ref)
148
+ * .then(console.log)
149
+ * .catch(console.error) // an error occurred
150
+ */
151
+ deleteCredentials(ref) {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ return this.client.credentials.del(ref);
154
+ });
155
+ }
156
+ /**
157
+ * Lists all Credentials from Routr with pagination.
158
+ *
159
+ * @param {ListCredentialsRequest} request - The request to list Credentials
160
+ * @param {number} request.pageSize - The number of Credentials to return
161
+ * @param {string} request.pageToken - The page token to use for pagination
162
+ * @return {Promise<ListCredentialsResponse>} The list of Credentials in the current page
163
+ * @example
164
+ *
165
+ * const request = {
166
+ * pageSize: 10
167
+ * }
168
+ *
169
+ * credentials.listCredentials(request)
170
+ * .then(console.log)
171
+ * .catch(console.error) // an error occurred
172
+ */
173
+ listCredentials(request) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ return this.client.credentials.list(request);
176
+ });
177
+ }
178
+ }
179
+ exports.Credentials = Credentials;
@@ -0,0 +1,2 @@
1
+ export * from "./credentials";
2
+ export { Credentials as default } from "./credentials";
@@ -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("./credentials"), exports);
37
+ var credentials_1 = require("./credentials");
38
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return credentials_1.Credentials; } });