@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
@@ -10,11 +10,11 @@ import { FonosterClient } from "./client/types";
10
10
  * const SDK = require("@fonoster/sdk");
11
11
  *
12
12
  * async function main(request) {
13
- * const apiKey = "your-api-key";
14
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
13
+ * const API_KEY = "your-api-key";
14
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
15
15
  *
16
- * try {
17
- * const client = SDK.Client({ accessKeyId });
16
+ * try {
17
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
18
18
  * await client.loginWithApiKey(apiKey);
19
19
  *
20
20
  * const trunks = new SDK.Trunks(client);
@@ -63,27 +63,27 @@ declare class Trunks {
63
63
  * @param {boolean} request.uris[].enabled - Optional enabled of the Trunk
64
64
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Trunk
65
65
  * @example
66
+ * const trunks = new SDK.Trunks(client); // Existing client object
66
67
  *
67
68
  * const request = {
68
- * name: "My Trunk",
69
- * inboundUri: "sip.company.fonoster.io"
70
- * sendRegister: true
71
- * uris: [{
72
- * host: "sip.company.fonoster.io",
73
- * port: 5060,
74
- * transport: "UDP",
75
- * user: "user",
76
- * weight: 0,
77
- * priority: 0,
78
- * enabled: true
79
- * }]
69
+ * name: "My Trunk",
70
+ * inboundUri: "sip.company.fonoster.io"
71
+ * sendRegister: true
72
+ * uris: [{
73
+ * host: "sip.company.fonoster.io",
74
+ * port: 5060,
75
+ * transport: "UDP",
76
+ * user: "user",
77
+ * weight: 0,
78
+ * priority: 0,
79
+ * enabled: true
80
+ * }]
80
81
  * };
81
82
  *
82
- * const trunks = new SDK.Trunks(client); // Existing client object
83
- *
84
- * trunks.createTrunk(request)
85
- * .then(console.log) // successful response
86
- * .catch(console.error); // an error occurred
83
+ * trunks
84
+ * .createTrunk(request)
85
+ * .then(console.log) // successful response
86
+ * .catch(console.error); // an error occurred
87
87
  */
88
88
  createTrunk(request: CreateTrunkRequest): Promise<BaseApiObject>;
89
89
  /**
@@ -92,14 +92,14 @@ declare class Trunks {
92
92
  * @param {string} ref - The reference of the Trunk to retrieve
93
93
  * @return {Promise<Acl>} - The response object that contains the Trunk
94
94
  * @example
95
- *
96
- * const ref = "00000000-0000-0000-0000-000000000000"
97
- *
98
95
  * const trunks = new SDK.Trunks(client); // Existing client object
99
96
  *
100
- * trunks.getTrunk(ref)
101
- * .then(console.log) // successful response
102
- * .catch(console.error); // an error occurred
97
+ * const ref = "00000000-0000-0000-0000-000000000000";
98
+ *
99
+ * trunks
100
+ * .getTrunk(ref)
101
+ * .then(console.log) // successful response
102
+ * .catch(console.error); // an error occurred
103
103
  */
104
104
  getTrunk(ref: string): Promise<unknown>;
105
105
  /**
@@ -122,21 +122,27 @@ declare class Trunks {
122
122
  * @param {boolean} request.uris[].enabled - Optional enabled of the Trunk
123
123
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Trunk
124
124
  * @example
125
+ * const trunks = new SDK.Trunks(client); // Existing client object
125
126
  *
126
127
  * const request = {
127
- * ref: "00000000-0000-0000-0000-000000000000",
128
- * name: "My Trunk",
129
- * sendRegister: true
130
- * uris: [{
131
- * host: "sip.company.fonoster.io",
132
- * port: 5060,
133
- * transport: "UDP",
134
- * user: "user",
135
- * weight: 0,
136
- * priority: 0,
137
- * enabled: true
138
- * }]
128
+ * ref: "00000000-0000-0000-0000-000000000000",
129
+ * name: "My Trunk",
130
+ * sendRegister: true
131
+ * uris: [{
132
+ * host: "sip.company.fonoster.io",
133
+ * port: 5060,
134
+ * transport: "UDP",
135
+ * user: "user",
136
+ * weight: 0,
137
+ * priority: 0,
138
+ * enabled: true
139
+ * }]
139
140
  * };
141
+ *
142
+ * trunks
143
+ * .updateTrunk(request)
144
+ * .then(console.log) // successful response
145
+ * .catch(console.error); // an error occurred
140
146
  */
141
147
  updateTrunk(request: UpdateTrunkRequest): Promise<BaseApiObject>;
142
148
  /**
@@ -147,17 +153,17 @@ declare class Trunks {
147
153
  * @param {string} request.pageToken - The token to retrieve the next page of Trunks
148
154
  * @return {Promise<ListTrunksResponse>} - The response object that contains the list of Trunks
149
155
  * @example
156
+ * const trunks = new SDK.Trunks(client); // Existing client object
150
157
  *
151
158
  * const request = {
152
- * pageSize: 10,
153
- * pageToken: "00000000-0000-0000-0000-000000000000"
159
+ * pageSize: 10,
160
+ * pageToken: "00000000-0000-0000-0000-000000000000"
154
161
  * };
155
162
  *
156
- * const trunks = new SDK.Trunks(client); // Existing client object
157
- *
158
- * trunks.listTrunks(request)
159
- * .then(console.log) // successful response
160
- * .catch(console.error); // an error occurred
163
+ * trunks
164
+ * .listTrunks(request)
165
+ * .then(console.log) // successful response
166
+ * .catch(console.error); // an error occurred
161
167
  */
162
168
  listTrunks(request: ListTrunksRequest): Promise<ListTrunksResponse>;
163
169
  /**
@@ -167,14 +173,14 @@ declare class Trunks {
167
173
  * @param {string} ref - The reference of the Trunk to delete
168
174
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Trunk
169
175
  * @example
170
- *
171
- * const ref = "00000000-0000-0000-0000-000000000000"
172
- *
173
176
  * const trunks = new SDK.Trunks(client); // Existing client object
174
177
  *
175
- * trunks.deleteTrunk(ref)
176
- * .then(console.log) // successful response
177
- * .catch(console.error); // an error occurred
178
+ * const ref = "00000000-0000-0000-0000-000000000000";
179
+ *
180
+ * trunks
181
+ * .deleteTrunk(ref)
182
+ * .then(console.log) // successful response
183
+ * .catch(console.error); // an error occurred
178
184
  */
179
185
  deleteTrunk(ref: string): Promise<BaseApiObject>;
180
186
  }
@@ -13,11 +13,11 @@ const trunks_pb_1 = require("./generated/node/trunks_pb");
13
13
  * const SDK = require("@fonoster/sdk");
14
14
  *
15
15
  * async function main(request) {
16
- * const apiKey = "your-api-key";
17
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
16
+ * const API_KEY = "your-api-key";
17
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
18
18
  *
19
- * try {
20
- * const client = SDK.Client({ accessKeyId });
19
+ * try {
20
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
21
21
  * await client.loginWithApiKey(apiKey);
22
22
  *
23
23
  * const trunks = new SDK.Trunks(client);
@@ -68,27 +68,27 @@ class Trunks {
68
68
  * @param {boolean} request.uris[].enabled - Optional enabled of the Trunk
69
69
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Trunk
70
70
  * @example
71
+ * const trunks = new SDK.Trunks(client); // Existing client object
71
72
  *
72
73
  * const request = {
73
- * name: "My Trunk",
74
- * inboundUri: "sip.company.fonoster.io"
75
- * sendRegister: true
76
- * uris: [{
77
- * host: "sip.company.fonoster.io",
78
- * port: 5060,
79
- * transport: "UDP",
80
- * user: "user",
81
- * weight: 0,
82
- * priority: 0,
83
- * enabled: true
84
- * }]
74
+ * name: "My Trunk",
75
+ * inboundUri: "sip.company.fonoster.io"
76
+ * sendRegister: true
77
+ * uris: [{
78
+ * host: "sip.company.fonoster.io",
79
+ * port: 5060,
80
+ * transport: "UDP",
81
+ * user: "user",
82
+ * weight: 0,
83
+ * priority: 0,
84
+ * enabled: true
85
+ * }]
85
86
  * };
86
87
  *
87
- * const trunks = new SDK.Trunks(client); // Existing client object
88
- *
89
- * trunks.createTrunk(request)
90
- * .then(console.log) // successful response
91
- * .catch(console.error); // an error occurred
88
+ * trunks
89
+ * .createTrunk(request)
90
+ * .then(console.log) // successful response
91
+ * .catch(console.error); // an error occurred
92
92
  */
93
93
  async createTrunk(request) {
94
94
  const client = this.client.getTrunksClient();
@@ -96,13 +96,20 @@ class Trunks {
96
96
  createTrunkRequest.setName(request.name);
97
97
  createTrunkRequest.setInboundUri(request.inboundUri);
98
98
  createTrunkRequest.setSendRegister(request.sendRegister);
99
- // createAclRequest.setAccessControlListRef(?);
100
- // createAclRequest.setInboundCredentialsRef(?);
101
- // createAclRequest.setOutboundCredentialsRef(?);
102
- // request.uris.forEach(uri => {
103
- // const uri = new CreateTrunkRequestPB.Uris();
104
- // createTrunkRequest.addUris(uri);
105
- // }
99
+ createTrunkRequest.setAccessControlListRef(request.accessControlListRef);
100
+ createTrunkRequest.setInboundCredentialsRef(request.inboundCredentialsRef);
101
+ createTrunkRequest.setOutboundCredentialsRef(request.outboundCredentialsRef);
102
+ request.uris?.forEach((uri) => {
103
+ const current = new trunks_pb_1.TrunkURI();
104
+ current.setHost(uri.host);
105
+ current.setPort(uri.port);
106
+ current.setTransport(uri.transport);
107
+ current.setUser(uri.user);
108
+ current.setWeight(uri.weight);
109
+ current.setPriority(uri.priority);
110
+ current.setEnabled(uri.enabled);
111
+ createTrunkRequest.addUris(current);
112
+ });
106
113
  return new Promise((resolve, reject) => {
107
114
  client.createTrunk(createTrunkRequest, this.client.getMetadata(), (err, response) => {
108
115
  if (err) {
@@ -119,14 +126,14 @@ class Trunks {
119
126
  * @param {string} ref - The reference of the Trunk to retrieve
120
127
  * @return {Promise<Acl>} - The response object that contains the Trunk
121
128
  * @example
122
- *
123
- * const ref = "00000000-0000-0000-0000-000000000000"
124
- *
125
129
  * const trunks = new SDK.Trunks(client); // Existing client object
126
130
  *
127
- * trunks.getTrunk(ref)
128
- * .then(console.log) // successful response
129
- * .catch(console.error); // an error occurred
131
+ * const ref = "00000000-0000-0000-0000-000000000000";
132
+ *
133
+ * trunks
134
+ * .getTrunk(ref)
135
+ * .then(console.log) // successful response
136
+ * .catch(console.error); // an error occurred
130
137
  */
131
138
  async getTrunk(ref) {
132
139
  const client = this.client.getTrunksClient();
@@ -138,7 +145,16 @@ class Trunks {
138
145
  reject(err);
139
146
  return;
140
147
  }
141
- resolve(response.toObject());
148
+ const obj = response.toObject();
149
+ const outObj = {
150
+ ...obj,
151
+ uris: obj.urisList,
152
+ createdAt: new Date(obj.createdAt * 1000),
153
+ updatedAt: new Date(obj.updatedAt * 1000)
154
+ };
155
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
156
+ const { urisList, ...rest } = outObj;
157
+ resolve(rest);
142
158
  });
143
159
  });
144
160
  }
@@ -162,21 +178,27 @@ class Trunks {
162
178
  * @param {boolean} request.uris[].enabled - Optional enabled of the Trunk
163
179
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Trunk
164
180
  * @example
181
+ * const trunks = new SDK.Trunks(client); // Existing client object
165
182
  *
166
183
  * const request = {
167
- * ref: "00000000-0000-0000-0000-000000000000",
168
- * name: "My Trunk",
169
- * sendRegister: true
170
- * uris: [{
171
- * host: "sip.company.fonoster.io",
172
- * port: 5060,
173
- * transport: "UDP",
174
- * user: "user",
175
- * weight: 0,
176
- * priority: 0,
177
- * enabled: true
178
- * }]
184
+ * ref: "00000000-0000-0000-0000-000000000000",
185
+ * name: "My Trunk",
186
+ * sendRegister: true
187
+ * uris: [{
188
+ * host: "sip.company.fonoster.io",
189
+ * port: 5060,
190
+ * transport: "UDP",
191
+ * user: "user",
192
+ * weight: 0,
193
+ * priority: 0,
194
+ * enabled: true
195
+ * }]
179
196
  * };
197
+ *
198
+ * trunks
199
+ * .updateTrunk(request)
200
+ * .then(console.log) // successful response
201
+ * .catch(console.error); // an error occurred
180
202
  */
181
203
  async updateTrunk(request) {
182
204
  const client = this.client.getTrunksClient();
@@ -184,13 +206,20 @@ class Trunks {
184
206
  updateTrunkRequest.setRef(request.ref);
185
207
  updateTrunkRequest.setName(request.name);
186
208
  updateTrunkRequest.setSendRegister(request.sendRegister);
187
- // updateAclRequest.setAccessControlListRef(?);
188
- // updateAclRequest.setInboundCredentialsRef(?);
189
- // updateAclRequest.setOutboundCredentialsRef(?);
190
- // request.uris.forEach(uri => {
191
- // const uri = new UpdateTrunkRequestPB.Uris();
192
- // updateTrunkRequest.addUris(uri);
193
- // }
209
+ updateTrunkRequest.setAccessControlListRef(request.accessControlListRef);
210
+ updateTrunkRequest.setInboundCredentialsRef(request.inboundCredentialsRef);
211
+ updateTrunkRequest.setOutboundCredentialsRef(request.outboundCredentialsRef);
212
+ request.uris?.forEach((uri) => {
213
+ const current = new trunks_pb_1.TrunkURI();
214
+ current.setHost(uri.host);
215
+ current.setPort(uri.port);
216
+ current.setTransport(uri.transport);
217
+ current.setUser(uri.user);
218
+ current.setWeight(uri.weight);
219
+ current.setPriority(uri.priority);
220
+ current.setEnabled(uri.enabled);
221
+ updateTrunkRequest.addUris(current);
222
+ });
194
223
  return new Promise((resolve, reject) => {
195
224
  client.updateTrunk(updateTrunkRequest, this.client.getMetadata(), (err, response) => {
196
225
  if (err) {
@@ -209,17 +238,17 @@ class Trunks {
209
238
  * @param {string} request.pageToken - The token to retrieve the next page of Trunks
210
239
  * @return {Promise<ListTrunksResponse>} - The response object that contains the list of Trunks
211
240
  * @example
241
+ * const trunks = new SDK.Trunks(client); // Existing client object
212
242
  *
213
243
  * const request = {
214
- * pageSize: 10,
215
- * pageToken: "00000000-0000-0000-0000-000000000000"
244
+ * pageSize: 10,
245
+ * pageToken: "00000000-0000-0000-0000-000000000000"
216
246
  * };
217
247
  *
218
- * const trunks = new SDK.Trunks(client); // Existing client object
219
- *
220
- * trunks.listTrunks(request)
221
- * .then(console.log) // successful response
222
- * .catch(console.error); // an error occurred
248
+ * trunks
249
+ * .listTrunks(request)
250
+ * .then(console.log) // successful response
251
+ * .catch(console.error); // an error occurred
223
252
  */
224
253
  async listTrunks(request) {
225
254
  const client = this.client.getTrunksClient();
@@ -234,12 +263,17 @@ class Trunks {
234
263
  }
235
264
  const items = response.getItemsList().map((item) => {
236
265
  const obj = item.toObject();
237
- return {
238
- ...obj
266
+ const outObj = {
267
+ ...obj,
268
+ uris: obj.urisList,
269
+ createdAt: new Date(obj.createdAt * 1000),
270
+ updatedAt: new Date(obj.updatedAt * 1000)
239
271
  };
272
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
273
+ const { urisList, ...rest } = outObj;
274
+ return rest;
240
275
  });
241
276
  resolve({
242
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
277
  items: items,
244
278
  nextPageToken: response.getNextPageToken()
245
279
  });
@@ -253,14 +287,14 @@ class Trunks {
253
287
  * @param {string} ref - The reference of the Trunk to delete
254
288
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Trunk
255
289
  * @example
256
- *
257
- * const ref = "00000000-0000-0000-0000-000000000000"
258
- *
259
290
  * const trunks = new SDK.Trunks(client); // Existing client object
260
291
  *
261
- * trunks.deleteTrunk(ref)
262
- * .then(console.log) // successful response
263
- * .catch(console.error); // an error occurred
292
+ * const ref = "00000000-0000-0000-0000-000000000000";
293
+ *
294
+ * trunks
295
+ * .deleteTrunk(ref)
296
+ * .then(console.log) // successful response
297
+ * .catch(console.error); // an error occurred
264
298
  */
265
299
  async deleteTrunk(ref) {
266
300
  const applicationsClient = this.client.getTrunksClient();
@@ -10,11 +10,11 @@ import { FonosterClient } from "./client/types";
10
10
  * const SDK = require("@fonoster/sdk");
11
11
  *
12
12
  * async function main(request) {
13
- * const apiKey = "your-api-key";
14
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
13
+ * const API_KEY = "your-api-key";
14
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
15
15
  *
16
- * try {
17
- * const client = SDK.Client({ accessKeyId });
16
+ * try {
17
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
18
18
  * await client.loginWithApiKey(apiKey);
19
19
  *
20
20
  * const users = new SDK.Users(client);
@@ -55,19 +55,19 @@ declare class Users {
55
55
  * @param {string} request.avatar - The avatar of the User
56
56
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created User
57
57
  * @example
58
+ * const users = new SDK.Users(client); // Existing client object
58
59
  *
59
60
  * const request = {
60
- * name: "John Doe",
61
- * email: "john.doe@example.com",
62
- * password: "password",
63
- * avatar: "https://example.com/avatar.jpg"
61
+ * name: "John Doe",
62
+ * email: "john.doe@example.com",
63
+ * password: "password",
64
+ * avatar: "https://example.com/avatar.jpg"
64
65
  * };
65
66
  *
66
- * const users = new SDK.Users(client); // Existing client object
67
- *
68
- * users.createUser(request)
69
- * .then(console.log) // successful response
70
- * .catch(console.error); // an error occurred
67
+ * users
68
+ * .createUser(request)
69
+ * .then(console.log) // successful response
70
+ * .catch(console.error); // an error occurred
71
71
  */
72
72
  createUser(request: CreateUserRequest): Promise<BaseApiObject>;
73
73
  /**
@@ -76,14 +76,14 @@ declare class Users {
76
76
  * @param {string} ref - The reference of the User to retrieve
77
77
  * @return {Promise<Acl>} - The response object that contains the User
78
78
  * @example
79
- *
80
- * const ref = "00000000-0000-0000-0000-000000000000"
81
- *
82
79
  * const users = new SDK.Users(client); // Existing client object
83
80
  *
84
- * users.getUser(ref)
85
- * .then(console.log) // successful response
86
- * .catch(console.error); // an error occurred
81
+ * const ref = "00000000-0000-0000-0000-000000000000";
82
+ *
83
+ * users
84
+ * .getUser(ref)
85
+ * .then(console.log) // successful response
86
+ * .catch(console.error); // an error occurred
87
87
  */
88
88
  getUser(ref: string): Promise<User>;
89
89
  /**
@@ -96,19 +96,19 @@ declare class Users {
96
96
  * @param {string} request.avatar - The avatar of the User
97
97
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated User
98
98
  * @example
99
+ * const users = new SDK.Users(client); // Existing client object
99
100
  *
100
101
  * const request = {
101
- * ref: "00000000-0000-0000-0000-000000000000",
102
- * name: "John Doe",
103
- * password: "password",
104
- * avatar: "https://example.com/avatar.jpg"
102
+ * ref: "00000000-0000-0000-0000-000000000000",
103
+ * name: "John Doe",
104
+ * password: "password",
105
+ * avatar: "https://example.com/avatar.jpg"
105
106
  * };
106
107
  *
107
- * const users = new SDK.Users(client); // Existing client object
108
- *
109
- * users.updateUser(request)
110
- * .then(console.log) // successful response
111
- * .catch(console.error); // an error occurred
108
+ * users
109
+ * .updateUser(request)
110
+ * .then(console.log) // successful response
111
+ * .catch(console.error); // an error occurred
112
112
  */
113
113
  updateUser(request: UpdateUserRequest): Promise<BaseApiObject>;
114
114
  /**
@@ -118,14 +118,14 @@ declare class Users {
118
118
  * @param {string} ref - The reference of the User to delete
119
119
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted User
120
120
  * @example
121
- *
122
- * const ref = "00000000-0000-0000-0000-000000000000"
123
- *
124
121
  * const users = new SDK.Users(client); // Existing client object
125
122
  *
126
- * users.deleteUser(ref)
127
- * .then(console.log) // successful response
128
- * .catch(console.error); // an error occurred
123
+ * const ref = "00000000-0000-0000-0000-000000000000";
124
+ *
125
+ * users
126
+ * .deleteUser(ref)
127
+ * .then(console.log) // successful response
128
+ * .catch(console.error); // an error occurred
129
129
  */
130
130
  deleteUser(ref: string): Promise<BaseApiObject>;
131
131
  }
@@ -13,11 +13,11 @@ const identity_pb_1 = require("./generated/node/identity_pb");
13
13
  * const SDK = require("@fonoster/sdk");
14
14
  *
15
15
  * async function main(request) {
16
- * const apiKey = "your-api-key";
17
- * const accessKeyId = "00000000-0000-0000-0000-000000000000";
16
+ * const API_KEY = "your-api-key";
17
+ * const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
18
18
  *
19
- * try {
20
- * const client = SDK.Client({ accessKeyId });
19
+ * try {
20
+ * const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
21
21
  * await client.loginWithApiKey(apiKey);
22
22
  *
23
23
  * const users = new SDK.Users(client);
@@ -60,19 +60,19 @@ class Users {
60
60
  * @param {string} request.avatar - The avatar of the User
61
61
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created User
62
62
  * @example
63
+ * const users = new SDK.Users(client); // Existing client object
63
64
  *
64
65
  * const request = {
65
- * name: "John Doe",
66
- * email: "john.doe@example.com",
67
- * password: "password",
68
- * avatar: "https://example.com/avatar.jpg"
66
+ * name: "John Doe",
67
+ * email: "john.doe@example.com",
68
+ * password: "password",
69
+ * avatar: "https://example.com/avatar.jpg"
69
70
  * };
70
71
  *
71
- * const users = new SDK.Users(client); // Existing client object
72
- *
73
- * users.createUser(request)
74
- * .then(console.log) // successful response
75
- * .catch(console.error); // an error occurred
72
+ * users
73
+ * .createUser(request)
74
+ * .then(console.log) // successful response
75
+ * .catch(console.error); // an error occurred
76
76
  */
77
77
  async createUser(request) {
78
78
  const client = this.client.getIdentityClient();
@@ -89,14 +89,14 @@ class Users {
89
89
  * @param {string} ref - The reference of the User to retrieve
90
90
  * @return {Promise<Acl>} - The response object that contains the User
91
91
  * @example
92
- *
93
- * const ref = "00000000-0000-0000-0000-000000000000"
94
- *
95
92
  * const users = new SDK.Users(client); // Existing client object
96
93
  *
97
- * users.getUser(ref)
98
- * .then(console.log) // successful response
99
- * .catch(console.error); // an error occurred
94
+ * const ref = "00000000-0000-0000-0000-000000000000";
95
+ *
96
+ * users
97
+ * .getUser(ref)
98
+ * .then(console.log) // successful response
99
+ * .catch(console.error); // an error occurred
100
100
  */
101
101
  async getUser(ref) {
102
102
  const client = this.client.getIdentityClient();
@@ -117,19 +117,19 @@ class Users {
117
117
  * @param {string} request.avatar - The avatar of the User
118
118
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated User
119
119
  * @example
120
+ * const users = new SDK.Users(client); // Existing client object
120
121
  *
121
122
  * const request = {
122
- * ref: "00000000-0000-0000-0000-000000000000",
123
- * name: "John Doe",
124
- * password: "password",
125
- * avatar: "https://example.com/avatar.jpg"
123
+ * ref: "00000000-0000-0000-0000-000000000000",
124
+ * name: "John Doe",
125
+ * password: "password",
126
+ * avatar: "https://example.com/avatar.jpg"
126
127
  * };
127
128
  *
128
- * const users = new SDK.Users(client); // Existing client object
129
- *
130
- * users.updateUser(request)
131
- * .then(console.log) // successful response
132
- * .catch(console.error); // an error occurred
129
+ * users
130
+ * .updateUser(request)
131
+ * .then(console.log) // successful response
132
+ * .catch(console.error); // an error occurred
133
133
  */
134
134
  async updateUser(request) {
135
135
  const client = this.client.getIdentityClient();
@@ -147,14 +147,14 @@ class Users {
147
147
  * @param {string} ref - The reference of the User to delete
148
148
  * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted User
149
149
  * @example
150
- *
151
- * const ref = "00000000-0000-0000-0000-000000000000"
152
- *
153
150
  * const users = new SDK.Users(client); // Existing client object
154
151
  *
155
- * users.deleteUser(ref)
156
- * .then(console.log) // successful response
157
- * .catch(console.error); // an error occurred
152
+ * const ref = "00000000-0000-0000-0000-000000000000";
153
+ *
154
+ * users
155
+ * .deleteUser(ref)
156
+ * .then(console.log) // successful response
157
+ * .catch(console.error); // an error occurred
158
158
  */
159
159
  async deleteUser(ref) {
160
160
  const client = this.client.getIdentityClient();