@fonoster/sdk 0.6.4 → 0.6.6

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 (61) hide show
  1. package/README.md +519 -454
  2. package/dist/node/Acls.d.ts +43 -44
  3. package/dist/node/Acls.js +62 -49
  4. package/dist/node/Agents.d.ts +44 -45
  5. package/dist/node/Agents.js +47 -46
  6. package/dist/node/ApiKeys.d.ts +29 -29
  7. package/dist/node/ApiKeys.js +29 -29
  8. package/dist/node/Applications.d.ts +39 -39
  9. package/dist/node/Applications.js +52 -40
  10. package/dist/node/Calls.d.ts +28 -29
  11. package/dist/node/Calls.js +32 -27
  12. package/dist/node/Credentials.d.ts +39 -39
  13. package/dist/node/Credentials.js +39 -39
  14. package/dist/node/Domains.d.ts +37 -37
  15. package/dist/node/Domains.js +37 -37
  16. package/dist/node/Numbers.d.ts +40 -40
  17. package/dist/node/Numbers.js +40 -40
  18. package/dist/node/Secrets.d.ts +37 -37
  19. package/dist/node/Secrets.js +37 -37
  20. package/dist/node/Trunks.d.ts +58 -52
  21. package/dist/node/Trunks.js +104 -70
  22. package/dist/node/Users.d.ts +34 -34
  23. package/dist/node/Users.js +34 -34
  24. package/dist/node/Workspaces.d.ts +55 -54
  25. package/dist/node/Workspaces.js +61 -54
  26. package/dist/node/client/jsonToObject.js +1 -1
  27. package/dist/node/client/makeRpcRequest.js +1 -1
  28. package/dist/node/client/objectToJson.d.ts +1 -1
  29. package/dist/node/client/objectToJson.js +12 -2
  30. package/dist/node/client/types/IdentityClient.d.ts +2 -2
  31. package/dist/node/client/utils.js +6 -3
  32. package/dist/node/generated/node/agents_grpc_pb.js +0 -2
  33. package/dist/node/generated/node/agents_pb.js +444 -24
  34. package/dist/node/generated/node/applications_pb.js +6 -6
  35. package/dist/node/generated/node/credentials_pb.js +11 -41
  36. package/dist/node/generated/node/domains_pb.js +30 -30
  37. package/dist/node/generated/node/identity_grpc_pb.js +14 -14
  38. package/dist/node/generated/node/identity_pb.js +37 -37
  39. package/dist/node/generated/node/numbers_grpc_pb.js +0 -1
  40. package/dist/node/generated/node/numbers_pb.js +191 -11
  41. package/dist/node/generated/node/trunks_grpc_pb.js +0 -2
  42. package/dist/node/generated/node/trunks_pb.js +526 -31
  43. package/dist/node/generated/web/IdentityServiceClientPb.ts +5 -5
  44. package/dist/node/generated/web/agents_pb.d.ts +62 -10
  45. package/dist/node/generated/web/agents_pb.js +444 -24
  46. package/dist/node/generated/web/applications_pb.js +6 -6
  47. package/dist/node/generated/web/credentials_pb.d.ts +0 -4
  48. package/dist/node/generated/web/credentials_pb.js +11 -41
  49. package/dist/node/generated/web/domains_pb.js +30 -30
  50. package/dist/node/generated/web/identity_pb.d.ts +13 -13
  51. package/dist/node/generated/web/identity_pb.js +37 -37
  52. package/dist/node/generated/web/numbers_pb.d.ts +26 -4
  53. package/dist/node/generated/web/numbers_pb.js +191 -11
  54. package/dist/node/generated/web/trunks_pb.d.ts +71 -11
  55. package/dist/node/generated/web/trunks_pb.js +526 -31
  56. package/dist/node/tsconfig.node.tsbuildinfo +1 -1
  57. package/dist/node/utils.d.ts +4 -3
  58. package/dist/node/utils.js +36 -0
  59. package/dist/web/fonoster.min.js +1 -1
  60. package/dist/web/index.esm.js +1 -1
  61. package/package.json +5 -4
@@ -1,4 +1,4 @@
1
- import { Acl, BaseApiObject, CreateAclRequest, ListAclsRequest, ListAclsResponse, UpdateAclRequest } from "@fonoster/types";
1
+ import { BaseApiObject, CreateAclRequest, ListAclsRequest, ListAclsResponse, UpdateAclRequest } from "@fonoster/types";
2
2
  import { FonosterClient } from "./client/types";
3
3
  /**
4
4
  * @classdesc Fonoster Acls, part of the Fonoster SIP Proxy subsystem,
@@ -6,16 +6,15 @@ import { FonosterClient } from "./client/types";
6
6
  * Note that an active Fonoster deployment is required.
7
7
  *
8
8
  * @example
9
- *
10
9
  * const SDK = require("@fonoster/sdk");
11
10
  *
12
11
  * async function main(request) {
13
- * const apiKey = "your-api-key";
14
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
12
+ * const API_KEY = "your-api-key";
13
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
15
14
  *
16
- * try {
17
- * const client = SDK.Client({ accessKeyId });
18
- * await client.loginWithApiKey(apiKey);
15
+ * try {
16
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
17
+ * await client.loginWithApiKey(API_KEY);
19
18
  *
20
19
  * const acls = new SDK.Acls(client);
21
20
  * const response = await acls.createAcl(request);
@@ -53,18 +52,18 @@ declare class Acls {
53
52
  * @param {string[]} request.deny - The list of IPs to deny
54
53
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Acl
55
54
  * @example
55
+ * const acls = new SDK.Acls(client); // Existing client object
56
56
  *
57
57
  * const request = {
58
- * name: "My ACL",
59
- * allow: ["47.132.130.31"], // Allow only this IP
60
- * deny: ["0.0.0.0/0"] // Deny all other IPs
58
+ * name: "My ACL",
59
+ * allow: ["47.132.130.31"], // Allow only this IP
60
+ * deny: ["0.0.0.0/0"] // Deny all other IPs
61
61
  * };
62
62
  *
63
- * const acls = new SDK.Acls(client); // Existing client object
64
- *
65
- * acls.createAcl(request)
66
- * .then(console.log) // successful response
67
- * .catch(console.error); // an error occurred
63
+ * acls
64
+ * .createAcl(request)
65
+ * .then(console.log) // successful response
66
+ * .catch(console.error); // an error occurred
68
67
  */
69
68
  createAcl(request: CreateAclRequest): Promise<BaseApiObject>;
70
69
  /**
@@ -73,16 +72,16 @@ declare class Acls {
73
72
  * @param {string} ref - The reference of the Acl to retrieve
74
73
  * @return {Promise<Acl>} - The response object that contains the Acl information
75
74
  * @example
76
- *
77
- * const ref = "00000000-0000-0000-0000-000000000000"
78
- *
79
75
  * const acls = new SDK.Acls(client); // Existing client object
80
76
  *
81
- * acls.getAcl(ref)
82
- * .then(console.log) // successful response
83
- * .catch(console.error); // an error occurred
77
+ * const ref = "00000000-0000-0000-0000-000000000000";
78
+ *
79
+ * acls
80
+ * .getAcl(ref)
81
+ * .then(console.log) // successful response
82
+ * .catch(console.error); // an error occurred
84
83
  */
85
- getAcl(ref: string): Promise<Acl>;
84
+ getAcl(ref: string): Promise<unknown>;
86
85
  /**
87
86
  * Updates an existing Acl in the Workspace.
88
87
  *
@@ -93,19 +92,19 @@ declare class Acls {
93
92
  * @param {string[]} request.deny - The list of IPs to deny
94
93
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Acl
95
94
  * @example
95
+ * const acls = new SDK.Acls(client); // Existing client object
96
96
  *
97
97
  * const request = {
98
- * ref: "00000000-0000-0000-0000-000000000000",
99
- * name: "My ACL",
100
- * allow: ["47.132.130.31"] // Allow only this IP
101
- * deny: ["0.0.0.0/0"] // Deny all other IPs
98
+ * ref: "00000000-0000-0000-0000-000000000000",
99
+ * name: "My ACL",
100
+ * allow: ["47.132.130.31"] // Allow only this IP
101
+ * deny: ["0.0.0.0/0"] // Deny all other IPs
102
102
  * };
103
103
  *
104
- * const acls = new SDK.Acls(client); // Existing client object
105
- *
106
- * acl.updateAcl(request)
107
- * .then(console.log) // successful response
108
- * .catch(console.error); // an error occurred
104
+ * acls
105
+ * .updateAcl(request)
106
+ * .then(console.log) // successful response
107
+ * .catch(console.error); // an error occurred
109
108
  */
110
109
  updateAcl(request: UpdateAclRequest): Promise<BaseApiObject>;
111
110
  /**
@@ -116,17 +115,17 @@ declare class Acls {
116
115
  * @param {string} request.pageToken - The token to retrieve the next page of Acls
117
116
  * @return {Promise<ListAclsResponse>} - The response object that contains the list of Acls
118
117
  * @example
118
+ * const acls = new SDK.Acls(client); // Existing client object
119
119
  *
120
120
  * const request = {
121
- * pageSize: 10,
122
- * pageToken: "00000000-0000-0000-0000-000000000000"
121
+ * pageSize: 10,
122
+ * pageToken: "00000000-0000-0000-0000-000000000000"
123
123
  * };
124
124
  *
125
- * const acls = new SDK.Acls(client); // Existing client object
126
- *
127
- * acls.listAcls(request)
128
- * .then(console.log) // successful response
129
- * .catch(console.error); // an error occurred
125
+ * acls
126
+ * .listAcls(request)
127
+ * .then(console.log) // successful response
128
+ * .catch(console.error); // an error occurred
130
129
  */
131
130
  listAcls(request: ListAclsRequest): Promise<ListAclsResponse>;
132
131
  /**
@@ -136,14 +135,14 @@ declare class Acls {
136
135
  * @param {string} ref - The reference of the Acl to delete
137
136
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Acl
138
137
  * @example
139
- *
140
- * const ref = "00000000-0000-0000-0000-000000000000"
141
- *
142
138
  * const acls = new SDK.Acls(client); // Existing client object
143
139
  *
144
- * acls.deleteAcl(ref)
145
- * .then(console.log) // successful response
146
- * .catch(console.error); // an error occurred
140
+ * const ref = "00000000-0000-0000-0000-000000000000";
141
+ *
142
+ * acls
143
+ * .deleteAcl(ref)
144
+ * .then(console.log) // successful response
145
+ * .catch(console.error); // an error occurred
147
146
  */
148
147
  deleteAcl(ref: string): Promise<BaseApiObject>;
149
148
  }
package/dist/node/Acls.js CHANGED
@@ -9,16 +9,15 @@ const acls_pb_1 = require("./generated/node/acls_pb");
9
9
  * Note that an active Fonoster deployment is required.
10
10
  *
11
11
  * @example
12
- *
13
12
  * const SDK = require("@fonoster/sdk");
14
13
  *
15
14
  * async function main(request) {
16
- * const apiKey = "your-api-key";
17
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
15
+ * const API_KEY = "your-api-key";
16
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
18
17
  *
19
- * try {
20
- * const client = SDK.Client({ accessKeyId });
21
- * await client.loginWithApiKey(apiKey);
18
+ * try {
19
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
20
+ * await client.loginWithApiKey(API_KEY);
22
21
  *
23
22
  * const acls = new SDK.Acls(client);
24
23
  * const response = await acls.createAcl(request);
@@ -58,18 +57,18 @@ class Acls {
58
57
  * @param {string[]} request.deny - The list of IPs to deny
59
58
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Acl
60
59
  * @example
60
+ * const acls = new SDK.Acls(client); // Existing client object
61
61
  *
62
62
  * const request = {
63
- * name: "My ACL",
64
- * allow: ["47.132.130.31"], // Allow only this IP
65
- * deny: ["0.0.0.0/0"] // Deny all other IPs
63
+ * name: "My ACL",
64
+ * allow: ["47.132.130.31"], // Allow only this IP
65
+ * deny: ["0.0.0.0/0"] // Deny all other IPs
66
66
  * };
67
67
  *
68
- * const acls = new SDK.Acls(client); // Existing client object
69
- *
70
- * acls.createAcl(request)
71
- * .then(console.log) // successful response
72
- * .catch(console.error); // an error occurred
68
+ * acls
69
+ * .createAcl(request)
70
+ * .then(console.log) // successful response
71
+ * .catch(console.error); // an error occurred
73
72
  */
74
73
  async createAcl(request) {
75
74
  const client = this.client.getAclsClient();
@@ -93,22 +92,34 @@ class Acls {
93
92
  * @param {string} ref - The reference of the Acl to retrieve
94
93
  * @return {Promise<Acl>} - The response object that contains the Acl information
95
94
  * @example
96
- *
97
- * const ref = "00000000-0000-0000-0000-000000000000"
98
- *
99
95
  * const acls = new SDK.Acls(client); // Existing client object
100
96
  *
101
- * acls.getAcl(ref)
102
- * .then(console.log) // successful response
103
- * .catch(console.error); // an error occurred
97
+ * const ref = "00000000-0000-0000-0000-000000000000";
98
+ *
99
+ * acls
100
+ * .getAcl(ref)
101
+ * .then(console.log) // successful response
102
+ * .catch(console.error); // an error occurred
104
103
  */
105
104
  async getAcl(ref) {
105
+ const updateAclRequest = new acls_pb_1.GetAclRequest();
106
+ updateAclRequest.setRef(ref);
106
107
  const client = this.client.getAclsClient();
107
- return await (0, makeRpcRequest_1.makeRpcRequest)({
108
- method: client.getAcl.bind(client),
109
- requestPBObjectConstructor: acls_pb_1.GetAclRequest,
110
- metadata: this.client.getMetadata(),
111
- request: { ref }
108
+ return new Promise((resolve, reject) => {
109
+ client.getAcl(updateAclRequest, this.client.getMetadata(), (err, response) => {
110
+ if (err) {
111
+ reject(err);
112
+ return;
113
+ }
114
+ const obj = response.toObject();
115
+ resolve({
116
+ ...obj,
117
+ allow: obj.allowList,
118
+ deny: obj.denyList,
119
+ createdAt: new Date(obj.createdAt * 1000),
120
+ updatedAt: new Date(obj.updatedAt * 1000)
121
+ });
122
+ });
112
123
  });
113
124
  }
114
125
  /**
@@ -121,19 +132,19 @@ class Acls {
121
132
  * @param {string[]} request.deny - The list of IPs to deny
122
133
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Acl
123
134
  * @example
135
+ * const acls = new SDK.Acls(client); // Existing client object
124
136
  *
125
137
  * const request = {
126
- * ref: "00000000-0000-0000-0000-000000000000",
127
- * name: "My ACL",
128
- * allow: ["47.132.130.31"] // Allow only this IP
129
- * deny: ["0.0.0.0/0"] // Deny all other IPs
138
+ * ref: "00000000-0000-0000-0000-000000000000",
139
+ * name: "My ACL",
140
+ * allow: ["47.132.130.31"] // Allow only this IP
141
+ * deny: ["0.0.0.0/0"] // Deny all other IPs
130
142
  * };
131
143
  *
132
- * const acls = new SDK.Acls(client); // Existing client object
133
- *
134
- * acl.updateAcl(request)
135
- * .then(console.log) // successful response
136
- * .catch(console.error); // an error occurred
144
+ * acls
145
+ * .updateAcl(request)
146
+ * .then(console.log) // successful response
147
+ * .catch(console.error); // an error occurred
137
148
  */
138
149
  async updateAcl(request) {
139
150
  const client = this.client.getAclsClient();
@@ -160,17 +171,17 @@ class Acls {
160
171
  * @param {string} request.pageToken - The token to retrieve the next page of Acls
161
172
  * @return {Promise<ListAclsResponse>} - The response object that contains the list of Acls
162
173
  * @example
174
+ * const acls = new SDK.Acls(client); // Existing client object
163
175
  *
164
176
  * const request = {
165
- * pageSize: 10,
166
- * pageToken: "00000000-0000-0000-0000-000000000000"
177
+ * pageSize: 10,
178
+ * pageToken: "00000000-0000-0000-0000-000000000000"
167
179
  * };
168
180
  *
169
- * const acls = new SDK.Acls(client); // Existing client object
170
- *
171
- * acls.listAcls(request)
172
- * .then(console.log) // successful response
173
- * .catch(console.error); // an error occurred
181
+ * acls
182
+ * .listAcls(request)
183
+ * .then(console.log) // successful response
184
+ * .catch(console.error); // an error occurred
174
185
  */
175
186
  async listAcls(request) {
176
187
  const client = this.client.getAclsClient();
@@ -188,11 +199,13 @@ class Acls {
188
199
  return {
189
200
  ...obj,
190
201
  allow: obj.allowList,
191
- deny: obj.denyList
202
+ deny: obj.denyList,
203
+ createdAt: new Date(obj.createdAt * 1000),
204
+ updatedAt: new Date(obj.updatedAt * 1000)
192
205
  };
193
206
  });
194
207
  resolve({
195
- items,
208
+ items: items,
196
209
  nextPageToken: response.getNextPageToken()
197
210
  });
198
211
  });
@@ -205,14 +218,14 @@ class Acls {
205
218
  * @param {string} ref - The reference of the Acl to delete
206
219
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Acl
207
220
  * @example
208
- *
209
- * const ref = "00000000-0000-0000-0000-000000000000"
210
- *
211
221
  * const acls = new SDK.Acls(client); // Existing client object
212
222
  *
213
- * acls.deleteAcl(ref)
214
- * .then(console.log) // successful response
215
- * .catch(console.error); // an error occurred
223
+ * const ref = "00000000-0000-0000-0000-000000000000";
224
+ *
225
+ * acls
226
+ * .deleteAcl(ref)
227
+ * .then(console.log) // successful response
228
+ * .catch(console.error); // an error occurred
216
229
  */
217
230
  async deleteAcl(ref) {
218
231
  const client = this.client.getAclsClient();
@@ -6,16 +6,15 @@ import { FonosterClient } from "./client/types";
6
6
  * Note that an active Fonoster deployment is required.
7
7
  *
8
8
  * @example
9
- *
10
9
  * const SDK = require("@fonoster/sdk");
11
10
  *
12
11
  * async function main(request) {
13
- * const apiKey = "your-api-key";
14
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
12
+ * const API_KEY = "your-api-key";
13
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
15
14
  *
16
- * try {
17
- * const client = SDK.Client({ accessKeyId });
18
- * await client.loginWithApiKey(apiKey);
15
+ * try {
16
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
17
+ * await client.loginWithApiKey(API_KEY);
19
18
  *
20
19
  * const agents = new SDK.Agents(client);
21
20
  * const response = await agents.createAgent(request);
@@ -59,21 +58,21 @@ declare class Agents {
59
58
  * @param {string} request.domainRef - The reference of the Domain to associate the Agent
60
59
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Agent
61
60
  * @example
61
+ * const agents = new SDK.Agents(client); // Existing client object
62
62
  *
63
63
  * const request = {
64
- * name: "John Doe",
65
- * username: "1001",
66
- * privacy: "PRIVATE",
67
- * enabled: true,
68
- * maxContacts: 3
69
- * domainRef: "00000000-0000-0000-0000-000000000000"
64
+ * name: "John Doe",
65
+ * username: "1001",
66
+ * privacy: "PRIVATE",
67
+ * enabled: true,
68
+ * maxContacts: 3
69
+ * domainRef: "00000000-0000-0000-0000-000000000000"
70
70
  * };
71
71
  *
72
- * const agents = new SDK.Agents(client); // Existing client object
73
- *
74
- * agents.createAgent(request)
75
- * .then(console.log) // successful response
76
- * .catch(console.error); // an error occurred
72
+ * agents
73
+ * .createAgent(request)
74
+ * .then(console.log) // successful response
75
+ * .catch(console.error); // an error occurred
77
76
  */
78
77
  createAgent(request: CreateAgentRequest): Promise<BaseApiObject>;
79
78
  /**
@@ -82,14 +81,14 @@ declare class Agents {
82
81
  * @param {string} ref - The reference of the Agent to retrieve
83
82
  * @return {Promise<Acl>} - The response object that contains the Agent information
84
83
  * @example
85
- *
86
- * const ref = "00000000-0000-0000-0000-000000000000"
87
- *
88
84
  * const agents = new SDK.Agents(client); // Existing client object
89
85
  *
90
- * agents.getAgent(ref)
91
- * .then(console.log) // successful response
92
- * .catch(console.error); // an error occurred
86
+ * const ref = "00000000-0000-0000-0000-000000000000";
87
+ *
88
+ * agents
89
+ * .getAgent(ref)
90
+ * .then(console.log) // successful response
91
+ * .catch(console.error); // an error occurred
93
92
  */
94
93
  getAgent(ref: string): Promise<Agent>;
95
94
  /**
@@ -104,21 +103,21 @@ declare class Agents {
104
103
  * @param {string} request.domainRef - The reference of the Domain to associate the Agent
105
104
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Agent
106
105
  * @example
106
+ * const agents = new SDK.Agents(client); // Existing client object
107
107
  *
108
108
  * const request = {
109
- * ref: "00000000-0000-0000-0000-000000000000",
110
- * name: "John Doe",
111
- * privacy: "PRIVATE",
112
- * enabled: true,
113
- * maxContacts: 3
114
- * domainRef: "00000000-0000-0000-0000-000000000000"
109
+ * ref: "00000000-0000-0000-0000-000000000000",
110
+ * name: "John Doe",
111
+ * privacy: "PRIVATE",
112
+ * enabled: true,
113
+ * maxContacts: 3
114
+ * domainRef: "00000000-0000-0000-0000-000000000000"
115
115
  * };
116
116
  *
117
- * const agents = new SDK.Agents(client); // Existing client object
118
- *
119
- * agents.updateAgent(request)
120
- * .then(console.log) // successful response
121
- * .catch(console.error); // an error occurred
117
+ * agents
118
+ * .updateAgent(request)
119
+ * .then(console.log) // successful response
120
+ * .catch(console.error); // an error occurred
122
121
  */
123
122
  updateAgent(request: UpdateAgentRequest): Promise<BaseApiObject>;
124
123
  /**
@@ -129,17 +128,17 @@ declare class Agents {
129
128
  * @param {string} request.pageToken - The token to retrieve the next page of Agents
130
129
  * @return {Promise<ListAgentsResponse>} - The response object that contains the list of Agents
131
130
  * @example
131
+ * const agents = new SDK.Agents(client); // Existing client object
132
132
  *
133
133
  * const request = {
134
134
  * pageSize: 10,
135
135
  * pageToken: "00000000-0000-0000-0000-000000000000"
136
136
  * };
137
137
  *
138
- * const agents = new SDK.Agents(client); // Existing client object
139
- *
140
- * agents.listAgents(request)
141
- * .then(console.log) // successful response
142
- * .catch(console.error); // an error occurred
138
+ * agents
139
+ * .listAgents(request)
140
+ * .then(console.log) // successful response
141
+ * .catch(console.error); // an error occurred
143
142
  */
144
143
  listAgents(request: ListAgentsRequest): Promise<ListAgentsResponse>;
145
144
  /**
@@ -149,14 +148,14 @@ declare class Agents {
149
148
  * @param {string} ref - The reference of the Agent to delete
150
149
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Agent
151
150
  * @example
152
- *
153
- * const ref = "00000000-0000-0000-0000-000000000000"
154
- *
155
151
  * const agents = new SDK.Agents(client); // Existing client object
156
152
  *
157
- * agents.deleteAgent(ref)
158
- * .then(console.log) // successful response
159
- * .catch(console.error); // an error occurred
153
+ * const ref = "00000000-0000-0000-0000-000000000000";
154
+ *
155
+ * agents
156
+ * .deleteAgent(ref)
157
+ * .then(console.log) // successful response
158
+ * .catch(console.error); // an error occurred
160
159
  */
161
160
  deleteAgent(ref: string): Promise<BaseApiObject>;
162
161
  }
@@ -9,16 +9,15 @@ const agents_pb_1 = require("./generated/node/agents_pb");
9
9
  * Note that an active Fonoster deployment is required.
10
10
  *
11
11
  * @example
12
- *
13
12
  * const SDK = require("@fonoster/sdk");
14
13
  *
15
14
  * async function main(request) {
16
- * const apiKey = "your-api-key";
17
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
15
+ * const API_KEY = "your-api-key";
16
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
18
17
  *
19
- * try {
20
- * const client = SDK.Client({ accessKeyId });
21
- * await client.loginWithApiKey(apiKey);
18
+ * try {
19
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
20
+ * await client.loginWithApiKey(API_KEY);
22
21
  *
23
22
  * const agents = new SDK.Agents(client);
24
23
  * const response = await agents.createAgent(request);
@@ -64,21 +63,21 @@ class Agents {
64
63
  * @param {string} request.domainRef - The reference of the Domain to associate the Agent
65
64
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Agent
66
65
  * @example
66
+ * const agents = new SDK.Agents(client); // Existing client object
67
67
  *
68
68
  * const request = {
69
- * name: "John Doe",
70
- * username: "1001",
71
- * privacy: "PRIVATE",
72
- * enabled: true,
73
- * maxContacts: 3
74
- * domainRef: "00000000-0000-0000-0000-000000000000"
69
+ * name: "John Doe",
70
+ * username: "1001",
71
+ * privacy: "PRIVATE",
72
+ * enabled: true,
73
+ * maxContacts: 3
74
+ * domainRef: "00000000-0000-0000-0000-000000000000"
75
75
  * };
76
76
  *
77
- * const agents = new SDK.Agents(client); // Existing client object
78
- *
79
- * agents.createAgent(request)
80
- * .then(console.log) // successful response
81
- * .catch(console.error); // an error occurred
77
+ * agents
78
+ * .createAgent(request)
79
+ * .then(console.log) // successful response
80
+ * .catch(console.error); // an error occurred
82
81
  */
83
82
  async createAgent(request) {
84
83
  const client = this.client.getAgentsClient();
@@ -96,14 +95,14 @@ class Agents {
96
95
  * @param {string} ref - The reference of the Agent to retrieve
97
96
  * @return {Promise<Acl>} - The response object that contains the Agent information
98
97
  * @example
99
- *
100
- * const ref = "00000000-0000-0000-0000-000000000000"
101
- *
102
98
  * const agents = new SDK.Agents(client); // Existing client object
103
99
  *
104
- * agents.getAgent(ref)
105
- * .then(console.log) // successful response
106
- * .catch(console.error); // an error occurred
100
+ * const ref = "00000000-0000-0000-0000-000000000000";
101
+ *
102
+ * agents
103
+ * .getAgent(ref)
104
+ * .then(console.log) // successful response
105
+ * .catch(console.error); // an error occurred
107
106
  */
108
107
  async getAgent(ref) {
109
108
  const client = this.client.getAgentsClient();
@@ -111,7 +110,8 @@ class Agents {
111
110
  method: client.getAgent.bind(client),
112
111
  requestPBObjectConstructor: agents_pb_1.GetAgentRequest,
113
112
  metadata: this.client.getMetadata(),
114
- request: { ref }
113
+ request: { ref },
114
+ enumMapping: [["privacy", agents_pb_1.Privacy]]
115
115
  });
116
116
  }
117
117
  /**
@@ -126,21 +126,21 @@ class Agents {
126
126
  * @param {string} request.domainRef - The reference of the Domain to associate the Agent
127
127
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Agent
128
128
  * @example
129
+ * const agents = new SDK.Agents(client); // Existing client object
129
130
  *
130
131
  * const request = {
131
- * ref: "00000000-0000-0000-0000-000000000000",
132
- * name: "John Doe",
133
- * privacy: "PRIVATE",
134
- * enabled: true,
135
- * maxContacts: 3
136
- * domainRef: "00000000-0000-0000-0000-000000000000"
132
+ * ref: "00000000-0000-0000-0000-000000000000",
133
+ * name: "John Doe",
134
+ * privacy: "PRIVATE",
135
+ * enabled: true,
136
+ * maxContacts: 3
137
+ * domainRef: "00000000-0000-0000-0000-000000000000"
137
138
  * };
138
139
  *
139
- * const agents = new SDK.Agents(client); // Existing client object
140
- *
141
- * agents.updateAgent(request)
142
- * .then(console.log) // successful response
143
- * .catch(console.error); // an error occurred
140
+ * agents
141
+ * .updateAgent(request)
142
+ * .then(console.log) // successful response
143
+ * .catch(console.error); // an error occurred
144
144
  */
145
145
  async updateAgent(request) {
146
146
  const client = this.client.getAgentsClient();
@@ -160,17 +160,17 @@ class Agents {
160
160
  * @param {string} request.pageToken - The token to retrieve the next page of Agents
161
161
  * @return {Promise<ListAgentsResponse>} - The response object that contains the list of Agents
162
162
  * @example
163
+ * const agents = new SDK.Agents(client); // Existing client object
163
164
  *
164
165
  * const request = {
165
166
  * pageSize: 10,
166
167
  * pageToken: "00000000-0000-0000-0000-000000000000"
167
168
  * };
168
169
  *
169
- * const agents = new SDK.Agents(client); // Existing client object
170
- *
171
- * agents.listAgents(request)
172
- * .then(console.log) // successful response
173
- * .catch(console.error); // an error occurred
170
+ * agents
171
+ * .listAgents(request)
172
+ * .then(console.log) // successful response
173
+ * .catch(console.error); // an error occurred
174
174
  */
175
175
  async listAgents(request) {
176
176
  const client = this.client.getAgentsClient();
@@ -179,6 +179,7 @@ class Agents {
179
179
  requestPBObjectConstructor: agents_pb_1.ListAgentsRequest,
180
180
  metadata: this.client.getMetadata(),
181
181
  request,
182
+ enumMapping: [["privacy", agents_pb_1.Privacy]],
182
183
  repeatableObjectMapping: [["itemsList", agents_pb_1.Agent]]
183
184
  });
184
185
  }
@@ -189,14 +190,14 @@ class Agents {
189
190
  * @param {string} ref - The reference of the Agent to delete
190
191
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Agent
191
192
  * @example
192
- *
193
- * const ref = "00000000-0000-0000-0000-000000000000"
194
- *
195
193
  * const agents = new SDK.Agents(client); // Existing client object
196
194
  *
197
- * agents.deleteAgent(ref)
198
- * .then(console.log) // successful response
199
- * .catch(console.error); // an error occurred
195
+ * const ref = "00000000-0000-0000-0000-000000000000";
196
+ *
197
+ * agents
198
+ * .deleteAgent(ref)
199
+ * .then(console.log) // successful response
200
+ * .catch(console.error); // an error occurred
200
201
  */
201
202
  async deleteAgent(ref) {
202
203
  const applicationsClient = this.client.getAgentsClient();