appwrite-cli 4.2.0 → 4.2.2

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.
@@ -9,1297 +9,1553 @@ const { Command } = require('commander');
9
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
10
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
11
11
  const { localConfig, globalConfig } = require("../config");
12
+ const { File } = require('undici');
13
+ const { ReadableStream } = require('stream/web');
14
+
15
+ /**
16
+ * @param {fs.ReadStream} readStream
17
+ * @returns {ReadableStream}
18
+ */
19
+ function convertReadStreamToReadableStream(readStream) {
20
+ return new ReadableStream({
21
+ start(controller) {
22
+ readStream.on("data", (chunk) => {
23
+ controller.enqueue(chunk);
24
+ });
25
+ readStream.on("end", () => {
26
+ controller.close();
27
+ });
28
+ readStream.on("error", (err) => {
29
+ controller.error(err);
30
+ });
31
+ },
32
+ cancel() {
33
+ readStream.destroy();
34
+ },
35
+ });
36
+ }
12
37
 
13
38
  const projects = new Command("projects").description(commandDescriptions['projects']).configureHelp({
14
39
  helpWidth: process.stdout.columns || 80
15
- })
16
-
40
+ })
41
+
42
+ /**
43
+ * @typedef {Object} ProjectsListRequestParams
44
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId
45
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} parseOutput
47
+ * @property {libClient | undefined} sdk
48
+ */
49
+
50
+ /**
51
+ * @param {ProjectsListRequestParams} params
52
+ */
17
53
  const projectsList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
18
- /* @param {string[]} queries */
19
- /* @param {string} search */
20
-
21
54
  let client = !sdk ? await sdkForConsole() : sdk;
22
55
  let apiPath = '/projects';
23
56
  let payload = {};
24
-
25
- /** Query Params */
26
57
  if (typeof queries !== 'undefined') {
27
58
  payload['queries'] = queries;
28
59
  }
29
60
  if (typeof search !== 'undefined') {
30
61
  payload['search'] = search;
31
62
  }
63
+
32
64
  let response = undefined;
65
+
33
66
  response = await client.call('get', apiPath, {
34
67
  'content-type': 'application/json',
35
68
  }, payload);
36
-
69
+
37
70
  if (parseOutput) {
38
71
  parse(response)
39
72
  success()
40
73
  }
74
+
41
75
  return response;
42
76
  }
43
77
 
78
+ /**
79
+ * @typedef {Object} ProjectsCreateRequestParams
80
+ * @property {string} projectId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars.
81
+ * @property {string} name Project name. Max length: 128 chars.
82
+ * @property {string} teamId Team unique ID.
83
+ * @property {string} region Project Region.
84
+ * @property {string} description Project description. Max length: 256 chars.
85
+ * @property {string} logo Project logo.
86
+ * @property {string} url Project URL.
87
+ * @property {string} legalName Project legal Name. Max length: 256 chars.
88
+ * @property {string} legalCountry Project legal Country. Max length: 256 chars.
89
+ * @property {string} legalState Project legal State. Max length: 256 chars.
90
+ * @property {string} legalCity Project legal City. Max length: 256 chars.
91
+ * @property {string} legalAddress Project legal Address. Max length: 256 chars.
92
+ * @property {string} legalTaxId Project legal Tax ID. Max length: 256 chars.
93
+ * @property {boolean} parseOutput
94
+ * @property {libClient | undefined} sdk
95
+ */
96
+
97
+ /**
98
+ * @param {ProjectsCreateRequestParams} params
99
+ */
44
100
  const projectsCreate = async ({ projectId, name, teamId, region, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId, parseOutput = true, sdk = undefined}) => {
45
- /* @param {string} projectId */
46
- /* @param {string} name */
47
- /* @param {string} teamId */
48
- /* @param {string} region */
49
- /* @param {string} description */
50
- /* @param {string} logo */
51
- /* @param {string} url */
52
- /* @param {string} legalName */
53
- /* @param {string} legalCountry */
54
- /* @param {string} legalState */
55
- /* @param {string} legalCity */
56
- /* @param {string} legalAddress */
57
- /* @param {string} legalTaxId */
58
-
59
101
  let client = !sdk ? await sdkForConsole() : sdk;
60
102
  let apiPath = '/projects';
61
103
  let payload = {};
62
-
63
- /** Body Params */
64
-
65
104
  if (typeof projectId !== 'undefined') {
66
105
  payload['projectId'] = projectId;
67
106
  }
68
-
69
-
70
107
  if (typeof name !== 'undefined') {
71
108
  payload['name'] = name;
72
109
  }
73
-
74
-
75
110
  if (typeof teamId !== 'undefined') {
76
111
  payload['teamId'] = teamId;
77
112
  }
78
-
79
-
80
113
  if (typeof region !== 'undefined') {
81
114
  payload['region'] = region;
82
115
  }
83
-
84
-
85
116
  if (typeof description !== 'undefined') {
86
117
  payload['description'] = description;
87
118
  }
88
-
89
-
90
119
  if (typeof logo !== 'undefined') {
91
120
  payload['logo'] = logo;
92
121
  }
93
-
94
-
95
122
  if (typeof url !== 'undefined') {
96
123
  payload['url'] = url;
97
124
  }
98
-
99
-
100
125
  if (typeof legalName !== 'undefined') {
101
126
  payload['legalName'] = legalName;
102
127
  }
103
-
104
-
105
128
  if (typeof legalCountry !== 'undefined') {
106
129
  payload['legalCountry'] = legalCountry;
107
130
  }
108
-
109
-
110
131
  if (typeof legalState !== 'undefined') {
111
132
  payload['legalState'] = legalState;
112
133
  }
113
-
114
-
115
134
  if (typeof legalCity !== 'undefined') {
116
135
  payload['legalCity'] = legalCity;
117
136
  }
118
-
119
-
120
137
  if (typeof legalAddress !== 'undefined') {
121
138
  payload['legalAddress'] = legalAddress;
122
139
  }
123
-
124
-
125
140
  if (typeof legalTaxId !== 'undefined') {
126
141
  payload['legalTaxId'] = legalTaxId;
127
142
  }
128
143
 
129
144
  let response = undefined;
145
+
130
146
  response = await client.call('post', apiPath, {
131
147
  'content-type': 'application/json',
132
148
  }, payload);
133
-
149
+
134
150
  if (parseOutput) {
135
151
  parse(response)
136
152
  success()
137
153
  }
154
+
138
155
  return response;
139
156
  }
140
157
 
141
- const projectsGet = async ({ projectId, parseOutput = true, sdk = undefined}) => {
142
- /* @param {string} projectId */
158
+ /**
159
+ * @typedef {Object} ProjectsGetRequestParams
160
+ * @property {string} projectId Project unique ID.
161
+ * @property {boolean} parseOutput
162
+ * @property {libClient | undefined} sdk
163
+ */
143
164
 
165
+ /**
166
+ * @param {ProjectsGetRequestParams} params
167
+ */
168
+ const projectsGet = async ({ projectId, parseOutput = true, sdk = undefined}) => {
144
169
  let client = !sdk ? await sdkForConsole() : sdk;
145
170
  let apiPath = '/projects/{projectId}'.replace('{projectId}', projectId);
146
171
  let payload = {};
172
+
147
173
  let response = undefined;
174
+
148
175
  response = await client.call('get', apiPath, {
149
176
  'content-type': 'application/json',
150
177
  }, payload);
151
-
178
+
152
179
  if (parseOutput) {
153
180
  parse(response)
154
181
  success()
155
182
  }
183
+
156
184
  return response;
157
185
  }
158
186
 
187
+ /**
188
+ * @typedef {Object} ProjectsUpdateRequestParams
189
+ * @property {string} projectId Project unique ID.
190
+ * @property {string} name Project name. Max length: 128 chars.
191
+ * @property {string} description Project description. Max length: 256 chars.
192
+ * @property {string} logo Project logo.
193
+ * @property {string} url Project URL.
194
+ * @property {string} legalName Project legal name. Max length: 256 chars.
195
+ * @property {string} legalCountry Project legal country. Max length: 256 chars.
196
+ * @property {string} legalState Project legal state. Max length: 256 chars.
197
+ * @property {string} legalCity Project legal city. Max length: 256 chars.
198
+ * @property {string} legalAddress Project legal address. Max length: 256 chars.
199
+ * @property {string} legalTaxId Project legal tax ID. Max length: 256 chars.
200
+ * @property {boolean} parseOutput
201
+ * @property {libClient | undefined} sdk
202
+ */
203
+
204
+ /**
205
+ * @param {ProjectsUpdateRequestParams} params
206
+ */
159
207
  const projectsUpdate = async ({ projectId, name, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId, parseOutput = true, sdk = undefined}) => {
160
- /* @param {string} projectId */
161
- /* @param {string} name */
162
- /* @param {string} description */
163
- /* @param {string} logo */
164
- /* @param {string} url */
165
- /* @param {string} legalName */
166
- /* @param {string} legalCountry */
167
- /* @param {string} legalState */
168
- /* @param {string} legalCity */
169
- /* @param {string} legalAddress */
170
- /* @param {string} legalTaxId */
171
-
172
208
  let client = !sdk ? await sdkForConsole() : sdk;
173
209
  let apiPath = '/projects/{projectId}'.replace('{projectId}', projectId);
174
210
  let payload = {};
175
-
176
- /** Body Params */
177
-
178
211
  if (typeof name !== 'undefined') {
179
212
  payload['name'] = name;
180
213
  }
181
-
182
-
183
214
  if (typeof description !== 'undefined') {
184
215
  payload['description'] = description;
185
216
  }
186
-
187
-
188
217
  if (typeof logo !== 'undefined') {
189
218
  payload['logo'] = logo;
190
219
  }
191
-
192
-
193
220
  if (typeof url !== 'undefined') {
194
221
  payload['url'] = url;
195
222
  }
196
-
197
-
198
223
  if (typeof legalName !== 'undefined') {
199
224
  payload['legalName'] = legalName;
200
225
  }
201
-
202
-
203
226
  if (typeof legalCountry !== 'undefined') {
204
227
  payload['legalCountry'] = legalCountry;
205
228
  }
206
-
207
-
208
229
  if (typeof legalState !== 'undefined') {
209
230
  payload['legalState'] = legalState;
210
231
  }
211
-
212
-
213
232
  if (typeof legalCity !== 'undefined') {
214
233
  payload['legalCity'] = legalCity;
215
234
  }
216
-
217
-
218
235
  if (typeof legalAddress !== 'undefined') {
219
236
  payload['legalAddress'] = legalAddress;
220
237
  }
221
-
222
-
223
238
  if (typeof legalTaxId !== 'undefined') {
224
239
  payload['legalTaxId'] = legalTaxId;
225
240
  }
226
241
 
227
242
  let response = undefined;
243
+
228
244
  response = await client.call('patch', apiPath, {
229
245
  'content-type': 'application/json',
230
246
  }, payload);
231
-
247
+
232
248
  if (parseOutput) {
233
249
  parse(response)
234
250
  success()
235
251
  }
252
+
236
253
  return response;
237
254
  }
238
255
 
239
- const projectsDelete = async ({ projectId, parseOutput = true, sdk = undefined}) => {
240
- /* @param {string} projectId */
256
+ /**
257
+ * @typedef {Object} ProjectsDeleteRequestParams
258
+ * @property {string} projectId Project unique ID.
259
+ * @property {boolean} parseOutput
260
+ * @property {libClient | undefined} sdk
261
+ */
241
262
 
263
+ /**
264
+ * @param {ProjectsDeleteRequestParams} params
265
+ */
266
+ const projectsDelete = async ({ projectId, parseOutput = true, sdk = undefined}) => {
242
267
  let client = !sdk ? await sdkForConsole() : sdk;
243
268
  let apiPath = '/projects/{projectId}'.replace('{projectId}', projectId);
244
269
  let payload = {};
270
+
245
271
  let response = undefined;
272
+
246
273
  response = await client.call('delete', apiPath, {
247
274
  'content-type': 'application/json',
248
275
  }, payload);
249
-
276
+
250
277
  if (parseOutput) {
251
278
  parse(response)
252
279
  success()
253
280
  }
281
+
254
282
  return response;
255
283
  }
256
284
 
285
+ /**
286
+ * @typedef {Object} ProjectsUpdateAuthDurationRequestParams
287
+ * @property {string} projectId Project unique ID.
288
+ * @property {number} duration Project session length in seconds. Max length: 31536000 seconds.
289
+ * @property {boolean} parseOutput
290
+ * @property {libClient | undefined} sdk
291
+ */
292
+
293
+ /**
294
+ * @param {ProjectsUpdateAuthDurationRequestParams} params
295
+ */
257
296
  const projectsUpdateAuthDuration = async ({ projectId, duration, parseOutput = true, sdk = undefined}) => {
258
- /* @param {string} projectId */
259
- /* @param {number} duration */
260
-
261
297
  let client = !sdk ? await sdkForConsole() : sdk;
262
298
  let apiPath = '/projects/{projectId}/auth/duration'.replace('{projectId}', projectId);
263
299
  let payload = {};
264
-
265
- /** Body Params */
266
-
267
300
  if (typeof duration !== 'undefined') {
268
301
  payload['duration'] = duration;
269
302
  }
270
303
 
271
304
  let response = undefined;
305
+
272
306
  response = await client.call('patch', apiPath, {
273
307
  'content-type': 'application/json',
274
308
  }, payload);
275
-
309
+
276
310
  if (parseOutput) {
277
311
  parse(response)
278
312
  success()
279
313
  }
314
+
280
315
  return response;
281
316
  }
282
317
 
318
+ /**
319
+ * @typedef {Object} ProjectsUpdateAuthLimitRequestParams
320
+ * @property {string} projectId Project unique ID.
321
+ * @property {number} limit Set the max number of users allowed in this project. Use 0 for unlimited.
322
+ * @property {boolean} parseOutput
323
+ * @property {libClient | undefined} sdk
324
+ */
325
+
326
+ /**
327
+ * @param {ProjectsUpdateAuthLimitRequestParams} params
328
+ */
283
329
  const projectsUpdateAuthLimit = async ({ projectId, limit, parseOutput = true, sdk = undefined}) => {
284
- /* @param {string} projectId */
285
- /* @param {number} limit */
286
-
287
330
  let client = !sdk ? await sdkForConsole() : sdk;
288
331
  let apiPath = '/projects/{projectId}/auth/limit'.replace('{projectId}', projectId);
289
332
  let payload = {};
290
-
291
- /** Body Params */
292
-
293
333
  if (typeof limit !== 'undefined') {
294
334
  payload['limit'] = limit;
295
335
  }
296
336
 
297
337
  let response = undefined;
338
+
298
339
  response = await client.call('patch', apiPath, {
299
340
  'content-type': 'application/json',
300
341
  }, payload);
301
-
342
+
302
343
  if (parseOutput) {
303
344
  parse(response)
304
345
  success()
305
346
  }
347
+
306
348
  return response;
307
349
  }
308
350
 
351
+ /**
352
+ * @typedef {Object} ProjectsUpdateAuthSessionsLimitRequestParams
353
+ * @property {string} projectId Project unique ID.
354
+ * @property {number} limit Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10
355
+ * @property {boolean} parseOutput
356
+ * @property {libClient | undefined} sdk
357
+ */
358
+
359
+ /**
360
+ * @param {ProjectsUpdateAuthSessionsLimitRequestParams} params
361
+ */
309
362
  const projectsUpdateAuthSessionsLimit = async ({ projectId, limit, parseOutput = true, sdk = undefined}) => {
310
- /* @param {string} projectId */
311
- /* @param {number} limit */
312
-
313
363
  let client = !sdk ? await sdkForConsole() : sdk;
314
364
  let apiPath = '/projects/{projectId}/auth/max-sessions'.replace('{projectId}', projectId);
315
365
  let payload = {};
316
-
317
- /** Body Params */
318
-
319
366
  if (typeof limit !== 'undefined') {
320
367
  payload['limit'] = limit;
321
368
  }
322
369
 
323
370
  let response = undefined;
371
+
324
372
  response = await client.call('patch', apiPath, {
325
373
  'content-type': 'application/json',
326
374
  }, payload);
327
-
375
+
328
376
  if (parseOutput) {
329
377
  parse(response)
330
378
  success()
331
379
  }
380
+
332
381
  return response;
333
382
  }
334
383
 
384
+ /**
385
+ * @typedef {Object} ProjectsUpdateAuthPasswordDictionaryRequestParams
386
+ * @property {string} projectId Project unique ID.
387
+ * @property {boolean} enabled Set whether or not to enable checking user's password against most commonly used passwords. Default is false.
388
+ * @property {boolean} parseOutput
389
+ * @property {libClient | undefined} sdk
390
+ */
391
+
392
+ /**
393
+ * @param {ProjectsUpdateAuthPasswordDictionaryRequestParams} params
394
+ */
335
395
  const projectsUpdateAuthPasswordDictionary = async ({ projectId, enabled, parseOutput = true, sdk = undefined}) => {
336
- /* @param {string} projectId */
337
- /* @param {boolean} enabled */
338
-
339
396
  let client = !sdk ? await sdkForConsole() : sdk;
340
397
  let apiPath = '/projects/{projectId}/auth/password-dictionary'.replace('{projectId}', projectId);
341
398
  let payload = {};
342
-
343
- /** Body Params */
344
-
345
399
  if (typeof enabled !== 'undefined') {
346
400
  payload['enabled'] = enabled;
347
401
  }
348
402
 
349
403
  let response = undefined;
404
+
350
405
  response = await client.call('patch', apiPath, {
351
406
  'content-type': 'application/json',
352
407
  }, payload);
353
-
408
+
354
409
  if (parseOutput) {
355
410
  parse(response)
356
411
  success()
357
412
  }
413
+
358
414
  return response;
359
415
  }
360
416
 
417
+ /**
418
+ * @typedef {Object} ProjectsUpdateAuthPasswordHistoryRequestParams
419
+ * @property {string} projectId Project unique ID.
420
+ * @property {number} limit Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0
421
+ * @property {boolean} parseOutput
422
+ * @property {libClient | undefined} sdk
423
+ */
424
+
425
+ /**
426
+ * @param {ProjectsUpdateAuthPasswordHistoryRequestParams} params
427
+ */
361
428
  const projectsUpdateAuthPasswordHistory = async ({ projectId, limit, parseOutput = true, sdk = undefined}) => {
362
- /* @param {string} projectId */
363
- /* @param {number} limit */
364
-
365
429
  let client = !sdk ? await sdkForConsole() : sdk;
366
430
  let apiPath = '/projects/{projectId}/auth/password-history'.replace('{projectId}', projectId);
367
431
  let payload = {};
368
-
369
- /** Body Params */
370
-
371
432
  if (typeof limit !== 'undefined') {
372
433
  payload['limit'] = limit;
373
434
  }
374
435
 
375
436
  let response = undefined;
437
+
376
438
  response = await client.call('patch', apiPath, {
377
439
  'content-type': 'application/json',
378
440
  }, payload);
379
-
441
+
380
442
  if (parseOutput) {
381
443
  parse(response)
382
444
  success()
383
445
  }
446
+
384
447
  return response;
385
448
  }
386
449
 
450
+ /**
451
+ * @typedef {Object} ProjectsUpdatePersonalDataCheckRequestParams
452
+ * @property {string} projectId Project unique ID.
453
+ * @property {boolean} enabled Set whether or not to check a password for similarity with personal data. Default is false.
454
+ * @property {boolean} parseOutput
455
+ * @property {libClient | undefined} sdk
456
+ */
457
+
458
+ /**
459
+ * @param {ProjectsUpdatePersonalDataCheckRequestParams} params
460
+ */
387
461
  const projectsUpdatePersonalDataCheck = async ({ projectId, enabled, parseOutput = true, sdk = undefined}) => {
388
- /* @param {string} projectId */
389
- /* @param {boolean} enabled */
390
-
391
462
  let client = !sdk ? await sdkForConsole() : sdk;
392
463
  let apiPath = '/projects/{projectId}/auth/personal-data'.replace('{projectId}', projectId);
393
464
  let payload = {};
394
-
395
- /** Body Params */
396
-
397
465
  if (typeof enabled !== 'undefined') {
398
466
  payload['enabled'] = enabled;
399
467
  }
400
468
 
401
469
  let response = undefined;
470
+
402
471
  response = await client.call('patch', apiPath, {
403
472
  'content-type': 'application/json',
404
473
  }, payload);
405
-
474
+
406
475
  if (parseOutput) {
407
476
  parse(response)
408
477
  success()
409
478
  }
479
+
410
480
  return response;
411
481
  }
412
482
 
483
+ /**
484
+ * @typedef {Object} ProjectsUpdateAuthStatusRequestParams
485
+ * @property {string} projectId Project unique ID.
486
+ * @property {string} method Auth Method. Possible values: email-password,magic-url,anonymous,invites,jwt,phone
487
+ * @property {boolean} status Set the status of this auth method.
488
+ * @property {boolean} parseOutput
489
+ * @property {libClient | undefined} sdk
490
+ */
491
+
492
+ /**
493
+ * @param {ProjectsUpdateAuthStatusRequestParams} params
494
+ */
413
495
  const projectsUpdateAuthStatus = async ({ projectId, method, status, parseOutput = true, sdk = undefined}) => {
414
- /* @param {string} projectId */
415
- /* @param {string} method */
416
- /* @param {boolean} status */
417
-
418
496
  let client = !sdk ? await sdkForConsole() : sdk;
419
497
  let apiPath = '/projects/{projectId}/auth/{method}'.replace('{projectId}', projectId).replace('{method}', method);
420
498
  let payload = {};
421
-
422
- /** Body Params */
423
-
424
499
  if (typeof status !== 'undefined') {
425
500
  payload['status'] = status;
426
501
  }
427
502
 
428
503
  let response = undefined;
504
+
429
505
  response = await client.call('patch', apiPath, {
430
506
  'content-type': 'application/json',
431
507
  }, payload);
432
-
508
+
433
509
  if (parseOutput) {
434
510
  parse(response)
435
511
  success()
436
512
  }
513
+
437
514
  return response;
438
515
  }
439
516
 
440
- const projectsListKeys = async ({ projectId, parseOutput = true, sdk = undefined}) => {
441
- /* @param {string} projectId */
517
+ /**
518
+ * @typedef {Object} ProjectsListKeysRequestParams
519
+ * @property {string} projectId Project unique ID.
520
+ * @property {boolean} parseOutput
521
+ * @property {libClient | undefined} sdk
522
+ */
442
523
 
524
+ /**
525
+ * @param {ProjectsListKeysRequestParams} params
526
+ */
527
+ const projectsListKeys = async ({ projectId, parseOutput = true, sdk = undefined}) => {
443
528
  let client = !sdk ? await sdkForConsole() : sdk;
444
529
  let apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
445
530
  let payload = {};
531
+
446
532
  let response = undefined;
533
+
447
534
  response = await client.call('get', apiPath, {
448
535
  'content-type': 'application/json',
449
536
  }, payload);
450
-
537
+
451
538
  if (parseOutput) {
452
539
  parse(response)
453
540
  success()
454
541
  }
542
+
455
543
  return response;
456
544
  }
457
545
 
546
+ /**
547
+ * @typedef {Object} ProjectsCreateKeyRequestParams
548
+ * @property {string} projectId Project unique ID.
549
+ * @property {string} name Key name. Max length: 128 chars.
550
+ * @property {string[]} scopes Key scopes list. Maximum of 100 scopes are allowed.
551
+ * @property {string} expire Expiration time in ISO 8601 format. Use null for unlimited expiration.
552
+ * @property {boolean} parseOutput
553
+ * @property {libClient | undefined} sdk
554
+ */
555
+
556
+ /**
557
+ * @param {ProjectsCreateKeyRequestParams} params
558
+ */
458
559
  const projectsCreateKey = async ({ projectId, name, scopes, expire, parseOutput = true, sdk = undefined}) => {
459
- /* @param {string} projectId */
460
- /* @param {string} name */
461
- /* @param {string[]} scopes */
462
- /* @param {string} expire */
463
-
464
560
  let client = !sdk ? await sdkForConsole() : sdk;
465
561
  let apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
466
562
  let payload = {};
467
-
468
- /** Body Params */
469
-
470
563
  if (typeof name !== 'undefined') {
471
564
  payload['name'] = name;
472
565
  }
473
-
474
566
  scopes = scopes === true ? [] : scopes;
475
-
476
567
  if (typeof scopes !== 'undefined') {
477
568
  payload['scopes'] = scopes;
478
569
  }
479
-
480
-
481
570
  if (typeof expire !== 'undefined') {
482
571
  payload['expire'] = expire;
483
572
  }
484
573
 
485
574
  let response = undefined;
575
+
486
576
  response = await client.call('post', apiPath, {
487
577
  'content-type': 'application/json',
488
578
  }, payload);
489
-
579
+
490
580
  if (parseOutput) {
491
581
  parse(response)
492
582
  success()
493
583
  }
584
+
494
585
  return response;
495
586
  }
496
587
 
588
+ /**
589
+ * @typedef {Object} ProjectsGetKeyRequestParams
590
+ * @property {string} projectId Project unique ID.
591
+ * @property {string} keyId Key unique ID.
592
+ * @property {boolean} parseOutput
593
+ * @property {libClient | undefined} sdk
594
+ */
595
+
596
+ /**
597
+ * @param {ProjectsGetKeyRequestParams} params
598
+ */
497
599
  const projectsGetKey = async ({ projectId, keyId, parseOutput = true, sdk = undefined}) => {
498
- /* @param {string} projectId */
499
- /* @param {string} keyId */
500
-
501
600
  let client = !sdk ? await sdkForConsole() : sdk;
502
601
  let apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
503
602
  let payload = {};
603
+
504
604
  let response = undefined;
605
+
505
606
  response = await client.call('get', apiPath, {
506
607
  'content-type': 'application/json',
507
608
  }, payload);
508
-
609
+
509
610
  if (parseOutput) {
510
611
  parse(response)
511
612
  success()
512
613
  }
614
+
513
615
  return response;
514
616
  }
515
617
 
618
+ /**
619
+ * @typedef {Object} ProjectsUpdateKeyRequestParams
620
+ * @property {string} projectId Project unique ID.
621
+ * @property {string} keyId Key unique ID.
622
+ * @property {string} name Key name. Max length: 128 chars.
623
+ * @property {string[]} scopes Key scopes list. Maximum of 100 events are allowed.
624
+ * @property {string} expire Expiration time in ISO 8601 format. Use null for unlimited expiration.
625
+ * @property {boolean} parseOutput
626
+ * @property {libClient | undefined} sdk
627
+ */
628
+
629
+ /**
630
+ * @param {ProjectsUpdateKeyRequestParams} params
631
+ */
516
632
  const projectsUpdateKey = async ({ projectId, keyId, name, scopes, expire, parseOutput = true, sdk = undefined}) => {
517
- /* @param {string} projectId */
518
- /* @param {string} keyId */
519
- /* @param {string} name */
520
- /* @param {string[]} scopes */
521
- /* @param {string} expire */
522
-
523
633
  let client = !sdk ? await sdkForConsole() : sdk;
524
634
  let apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
525
635
  let payload = {};
526
-
527
- /** Body Params */
528
-
529
636
  if (typeof name !== 'undefined') {
530
637
  payload['name'] = name;
531
638
  }
532
-
533
639
  scopes = scopes === true ? [] : scopes;
534
-
535
640
  if (typeof scopes !== 'undefined') {
536
641
  payload['scopes'] = scopes;
537
642
  }
538
-
539
-
540
643
  if (typeof expire !== 'undefined') {
541
644
  payload['expire'] = expire;
542
645
  }
543
646
 
544
647
  let response = undefined;
648
+
545
649
  response = await client.call('put', apiPath, {
546
650
  'content-type': 'application/json',
547
651
  }, payload);
548
-
652
+
549
653
  if (parseOutput) {
550
654
  parse(response)
551
655
  success()
552
656
  }
657
+
553
658
  return response;
554
659
  }
555
660
 
661
+ /**
662
+ * @typedef {Object} ProjectsDeleteKeyRequestParams
663
+ * @property {string} projectId Project unique ID.
664
+ * @property {string} keyId Key unique ID.
665
+ * @property {boolean} parseOutput
666
+ * @property {libClient | undefined} sdk
667
+ */
668
+
669
+ /**
670
+ * @param {ProjectsDeleteKeyRequestParams} params
671
+ */
556
672
  const projectsDeleteKey = async ({ projectId, keyId, parseOutput = true, sdk = undefined}) => {
557
- /* @param {string} projectId */
558
- /* @param {string} keyId */
559
-
560
673
  let client = !sdk ? await sdkForConsole() : sdk;
561
674
  let apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
562
675
  let payload = {};
676
+
563
677
  let response = undefined;
678
+
564
679
  response = await client.call('delete', apiPath, {
565
680
  'content-type': 'application/json',
566
681
  }, payload);
567
-
682
+
568
683
  if (parseOutput) {
569
684
  parse(response)
570
685
  success()
571
686
  }
687
+
572
688
  return response;
573
689
  }
574
690
 
691
+ /**
692
+ * @typedef {Object} ProjectsUpdateOAuth2RequestParams
693
+ * @property {string} projectId Project unique ID.
694
+ * @property {string} provider Provider Name
695
+ * @property {string} appId Provider app ID. Max length: 256 chars.
696
+ * @property {string} secret Provider secret key. Max length: 512 chars.
697
+ * @property {boolean} enabled Provider status. Set to 'false' to disable new session creation.
698
+ * @property {boolean} parseOutput
699
+ * @property {libClient | undefined} sdk
700
+ */
701
+
702
+ /**
703
+ * @param {ProjectsUpdateOAuth2RequestParams} params
704
+ */
575
705
  const projectsUpdateOAuth2 = async ({ projectId, provider, appId, secret, enabled, parseOutput = true, sdk = undefined}) => {
576
- /* @param {string} projectId */
577
- /* @param {string} provider */
578
- /* @param {string} appId */
579
- /* @param {string} secret */
580
- /* @param {boolean} enabled */
581
-
582
706
  let client = !sdk ? await sdkForConsole() : sdk;
583
707
  let apiPath = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId);
584
708
  let payload = {};
585
-
586
- /** Body Params */
587
-
588
709
  if (typeof provider !== 'undefined') {
589
710
  payload['provider'] = provider;
590
711
  }
591
-
592
-
593
712
  if (typeof appId !== 'undefined') {
594
713
  payload['appId'] = appId;
595
714
  }
596
-
597
-
598
715
  if (typeof secret !== 'undefined') {
599
716
  payload['secret'] = secret;
600
717
  }
601
-
602
-
603
718
  if (typeof enabled !== 'undefined') {
604
719
  payload['enabled'] = enabled;
605
720
  }
606
721
 
607
722
  let response = undefined;
723
+
608
724
  response = await client.call('patch', apiPath, {
609
725
  'content-type': 'application/json',
610
726
  }, payload);
611
-
727
+
612
728
  if (parseOutput) {
613
729
  parse(response)
614
730
  success()
615
731
  }
732
+
616
733
  return response;
617
734
  }
618
735
 
619
- const projectsListPlatforms = async ({ projectId, parseOutput = true, sdk = undefined}) => {
620
- /* @param {string} projectId */
736
+ /**
737
+ * @typedef {Object} ProjectsListPlatformsRequestParams
738
+ * @property {string} projectId Project unique ID.
739
+ * @property {boolean} parseOutput
740
+ * @property {libClient | undefined} sdk
741
+ */
621
742
 
743
+ /**
744
+ * @param {ProjectsListPlatformsRequestParams} params
745
+ */
746
+ const projectsListPlatforms = async ({ projectId, parseOutput = true, sdk = undefined}) => {
622
747
  let client = !sdk ? await sdkForConsole() : sdk;
623
748
  let apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId);
624
749
  let payload = {};
750
+
625
751
  let response = undefined;
752
+
626
753
  response = await client.call('get', apiPath, {
627
754
  'content-type': 'application/json',
628
755
  }, payload);
629
-
756
+
630
757
  if (parseOutput) {
631
758
  parse(response)
632
759
  success()
633
760
  }
761
+
634
762
  return response;
635
763
  }
636
764
 
765
+ /**
766
+ * @typedef {Object} ProjectsCreatePlatformRequestParams
767
+ * @property {string} projectId Project unique ID.
768
+ * @property {string} type Platform type.
769
+ * @property {string} name Platform name. Max length: 128 chars.
770
+ * @property {string} key Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.
771
+ * @property {string} store App store or Google Play store ID. Max length: 256 chars.
772
+ * @property {string} hostname Platform client hostname. Max length: 256 chars.
773
+ * @property {boolean} parseOutput
774
+ * @property {libClient | undefined} sdk
775
+ */
776
+
777
+ /**
778
+ * @param {ProjectsCreatePlatformRequestParams} params
779
+ */
637
780
  const projectsCreatePlatform = async ({ projectId, type, name, key, store, hostname, parseOutput = true, sdk = undefined}) => {
638
- /* @param {string} projectId */
639
- /* @param {string} type */
640
- /* @param {string} name */
641
- /* @param {string} key */
642
- /* @param {string} store */
643
- /* @param {string} hostname */
644
-
645
781
  let client = !sdk ? await sdkForConsole() : sdk;
646
782
  let apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId);
647
783
  let payload = {};
648
-
649
- /** Body Params */
650
-
651
784
  if (typeof type !== 'undefined') {
652
785
  payload['type'] = type;
653
786
  }
654
-
655
-
656
787
  if (typeof name !== 'undefined') {
657
788
  payload['name'] = name;
658
789
  }
659
-
660
-
661
790
  if (typeof key !== 'undefined') {
662
791
  payload['key'] = key;
663
792
  }
664
-
665
-
666
793
  if (typeof store !== 'undefined') {
667
794
  payload['store'] = store;
668
795
  }
669
-
670
-
671
796
  if (typeof hostname !== 'undefined') {
672
797
  payload['hostname'] = hostname;
673
798
  }
674
799
 
675
800
  let response = undefined;
801
+
676
802
  response = await client.call('post', apiPath, {
677
803
  'content-type': 'application/json',
678
804
  }, payload);
679
-
805
+
680
806
  if (parseOutput) {
681
807
  parse(response)
682
808
  success()
683
809
  }
810
+
684
811
  return response;
685
812
  }
686
813
 
814
+ /**
815
+ * @typedef {Object} ProjectsGetPlatformRequestParams
816
+ * @property {string} projectId Project unique ID.
817
+ * @property {string} platformId Platform unique ID.
818
+ * @property {boolean} parseOutput
819
+ * @property {libClient | undefined} sdk
820
+ */
821
+
822
+ /**
823
+ * @param {ProjectsGetPlatformRequestParams} params
824
+ */
687
825
  const projectsGetPlatform = async ({ projectId, platformId, parseOutput = true, sdk = undefined}) => {
688
- /* @param {string} projectId */
689
- /* @param {string} platformId */
690
-
691
826
  let client = !sdk ? await sdkForConsole() : sdk;
692
827
  let apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
693
828
  let payload = {};
829
+
694
830
  let response = undefined;
831
+
695
832
  response = await client.call('get', apiPath, {
696
833
  'content-type': 'application/json',
697
834
  }, payload);
698
-
835
+
699
836
  if (parseOutput) {
700
837
  parse(response)
701
838
  success()
702
839
  }
840
+
703
841
  return response;
704
842
  }
705
843
 
844
+ /**
845
+ * @typedef {Object} ProjectsUpdatePlatformRequestParams
846
+ * @property {string} projectId Project unique ID.
847
+ * @property {string} platformId Platform unique ID.
848
+ * @property {string} name Platform name. Max length: 128 chars.
849
+ * @property {string} key Package name for android or bundle ID for iOS. Max length: 256 chars.
850
+ * @property {string} store App store or Google Play store ID. Max length: 256 chars.
851
+ * @property {string} hostname Platform client URL. Max length: 256 chars.
852
+ * @property {boolean} parseOutput
853
+ * @property {libClient | undefined} sdk
854
+ */
855
+
856
+ /**
857
+ * @param {ProjectsUpdatePlatformRequestParams} params
858
+ */
706
859
  const projectsUpdatePlatform = async ({ projectId, platformId, name, key, store, hostname, parseOutput = true, sdk = undefined}) => {
707
- /* @param {string} projectId */
708
- /* @param {string} platformId */
709
- /* @param {string} name */
710
- /* @param {string} key */
711
- /* @param {string} store */
712
- /* @param {string} hostname */
713
-
714
860
  let client = !sdk ? await sdkForConsole() : sdk;
715
861
  let apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
716
862
  let payload = {};
717
-
718
- /** Body Params */
719
-
720
863
  if (typeof name !== 'undefined') {
721
864
  payload['name'] = name;
722
865
  }
723
-
724
-
725
866
  if (typeof key !== 'undefined') {
726
867
  payload['key'] = key;
727
868
  }
728
-
729
-
730
869
  if (typeof store !== 'undefined') {
731
870
  payload['store'] = store;
732
871
  }
733
-
734
-
735
872
  if (typeof hostname !== 'undefined') {
736
873
  payload['hostname'] = hostname;
737
874
  }
738
875
 
739
876
  let response = undefined;
877
+
740
878
  response = await client.call('put', apiPath, {
741
879
  'content-type': 'application/json',
742
880
  }, payload);
743
-
881
+
744
882
  if (parseOutput) {
745
883
  parse(response)
746
884
  success()
747
885
  }
886
+
748
887
  return response;
749
888
  }
750
889
 
890
+ /**
891
+ * @typedef {Object} ProjectsDeletePlatformRequestParams
892
+ * @property {string} projectId Project unique ID.
893
+ * @property {string} platformId Platform unique ID.
894
+ * @property {boolean} parseOutput
895
+ * @property {libClient | undefined} sdk
896
+ */
897
+
898
+ /**
899
+ * @param {ProjectsDeletePlatformRequestParams} params
900
+ */
751
901
  const projectsDeletePlatform = async ({ projectId, platformId, parseOutput = true, sdk = undefined}) => {
752
- /* @param {string} projectId */
753
- /* @param {string} platformId */
754
-
755
902
  let client = !sdk ? await sdkForConsole() : sdk;
756
903
  let apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
757
904
  let payload = {};
905
+
758
906
  let response = undefined;
907
+
759
908
  response = await client.call('delete', apiPath, {
760
909
  'content-type': 'application/json',
761
910
  }, payload);
762
-
911
+
763
912
  if (parseOutput) {
764
913
  parse(response)
765
914
  success()
766
915
  }
916
+
767
917
  return response;
768
918
  }
769
919
 
920
+ /**
921
+ * @typedef {Object} ProjectsUpdateServiceStatusRequestParams
922
+ * @property {string} projectId Project unique ID.
923
+ * @property {string} service Service name.
924
+ * @property {boolean} status Service status.
925
+ * @property {boolean} parseOutput
926
+ * @property {libClient | undefined} sdk
927
+ */
928
+
929
+ /**
930
+ * @param {ProjectsUpdateServiceStatusRequestParams} params
931
+ */
770
932
  const projectsUpdateServiceStatus = async ({ projectId, service, status, parseOutput = true, sdk = undefined}) => {
771
- /* @param {string} projectId */
772
- /* @param {string} service */
773
- /* @param {boolean} status */
774
-
775
933
  let client = !sdk ? await sdkForConsole() : sdk;
776
934
  let apiPath = '/projects/{projectId}/service'.replace('{projectId}', projectId);
777
935
  let payload = {};
778
-
779
- /** Body Params */
780
-
781
936
  if (typeof service !== 'undefined') {
782
937
  payload['service'] = service;
783
938
  }
784
-
785
-
786
939
  if (typeof status !== 'undefined') {
787
940
  payload['status'] = status;
788
941
  }
789
942
 
790
943
  let response = undefined;
944
+
791
945
  response = await client.call('patch', apiPath, {
792
946
  'content-type': 'application/json',
793
947
  }, payload);
794
-
948
+
795
949
  if (parseOutput) {
796
950
  parse(response)
797
951
  success()
798
952
  }
953
+
799
954
  return response;
800
955
  }
801
956
 
957
+ /**
958
+ * @typedef {Object} ProjectsUpdateServiceStatusAllRequestParams
959
+ * @property {string} projectId Project unique ID.
960
+ * @property {boolean} status Service status.
961
+ * @property {boolean} parseOutput
962
+ * @property {libClient | undefined} sdk
963
+ */
964
+
965
+ /**
966
+ * @param {ProjectsUpdateServiceStatusAllRequestParams} params
967
+ */
802
968
  const projectsUpdateServiceStatusAll = async ({ projectId, status, parseOutput = true, sdk = undefined}) => {
803
- /* @param {string} projectId */
804
- /* @param {boolean} status */
805
-
806
969
  let client = !sdk ? await sdkForConsole() : sdk;
807
970
  let apiPath = '/projects/{projectId}/service/all'.replace('{projectId}', projectId);
808
971
  let payload = {};
809
-
810
- /** Body Params */
811
-
812
972
  if (typeof status !== 'undefined') {
813
973
  payload['status'] = status;
814
974
  }
815
975
 
816
976
  let response = undefined;
977
+
817
978
  response = await client.call('patch', apiPath, {
818
979
  'content-type': 'application/json',
819
980
  }, payload);
820
-
981
+
821
982
  if (parseOutput) {
822
983
  parse(response)
823
984
  success()
824
985
  }
986
+
825
987
  return response;
826
988
  }
827
989
 
990
+ /**
991
+ * @typedef {Object} ProjectsUpdateSmtpConfigurationRequestParams
992
+ * @property {string} projectId Project unique ID.
993
+ * @property {boolean} enabled Enable custom SMTP service
994
+ * @property {string} senderName Name of the email sender
995
+ * @property {string} senderEmail Email of the sender
996
+ * @property {string} replyTo Reply to email
997
+ * @property {string} host SMTP server host name
998
+ * @property {number} port SMTP server port
999
+ * @property {string} username SMTP server username
1000
+ * @property {string} password SMTP server password
1001
+ * @property {string} secure Does SMTP server use secure connection
1002
+ * @property {boolean} parseOutput
1003
+ * @property {libClient | undefined} sdk
1004
+ */
1005
+
1006
+ /**
1007
+ * @param {ProjectsUpdateSmtpConfigurationRequestParams} params
1008
+ */
828
1009
  const projectsUpdateSmtpConfiguration = async ({ projectId, enabled, senderName, senderEmail, replyTo, host, port, username, password, secure, parseOutput = true, sdk = undefined}) => {
829
- /* @param {string} projectId */
830
- /* @param {boolean} enabled */
831
- /* @param {string} senderName */
832
- /* @param {string} senderEmail */
833
- /* @param {string} replyTo */
834
- /* @param {string} host */
835
- /* @param {number} port */
836
- /* @param {string} username */
837
- /* @param {string} password */
838
- /* @param {string} secure */
839
-
840
1010
  let client = !sdk ? await sdkForConsole() : sdk;
841
1011
  let apiPath = '/projects/{projectId}/smtp'.replace('{projectId}', projectId);
842
1012
  let payload = {};
843
-
844
- /** Body Params */
845
-
846
1013
  if (typeof enabled !== 'undefined') {
847
1014
  payload['enabled'] = enabled;
848
1015
  }
849
-
850
-
851
1016
  if (typeof senderName !== 'undefined') {
852
1017
  payload['senderName'] = senderName;
853
1018
  }
854
-
855
-
856
1019
  if (typeof senderEmail !== 'undefined') {
857
1020
  payload['senderEmail'] = senderEmail;
858
1021
  }
859
-
860
-
861
1022
  if (typeof replyTo !== 'undefined') {
862
1023
  payload['replyTo'] = replyTo;
863
1024
  }
864
-
865
-
866
1025
  if (typeof host !== 'undefined') {
867
1026
  payload['host'] = host;
868
1027
  }
869
-
870
-
871
1028
  if (typeof port !== 'undefined') {
872
1029
  payload['port'] = port;
873
1030
  }
874
-
875
-
876
1031
  if (typeof username !== 'undefined') {
877
1032
  payload['username'] = username;
878
1033
  }
879
-
880
-
881
1034
  if (typeof password !== 'undefined') {
882
1035
  payload['password'] = password;
883
1036
  }
884
-
885
-
886
1037
  if (typeof secure !== 'undefined') {
887
1038
  payload['secure'] = secure;
888
1039
  }
889
1040
 
890
1041
  let response = undefined;
1042
+
891
1043
  response = await client.call('patch', apiPath, {
892
1044
  'content-type': 'application/json',
893
1045
  }, payload);
894
-
1046
+
895
1047
  if (parseOutput) {
896
1048
  parse(response)
897
1049
  success()
898
1050
  }
1051
+
899
1052
  return response;
900
1053
  }
901
1054
 
1055
+ /**
1056
+ * @typedef {Object} ProjectsUpdateTeamRequestParams
1057
+ * @property {string} projectId Project unique ID.
1058
+ * @property {string} teamId Team ID of the team to transfer project to.
1059
+ * @property {boolean} parseOutput
1060
+ * @property {libClient | undefined} sdk
1061
+ */
1062
+
1063
+ /**
1064
+ * @param {ProjectsUpdateTeamRequestParams} params
1065
+ */
902
1066
  const projectsUpdateTeam = async ({ projectId, teamId, parseOutput = true, sdk = undefined}) => {
903
- /* @param {string} projectId */
904
- /* @param {string} teamId */
905
-
906
1067
  let client = !sdk ? await sdkForConsole() : sdk;
907
1068
  let apiPath = '/projects/{projectId}/team'.replace('{projectId}', projectId);
908
1069
  let payload = {};
909
-
910
- /** Body Params */
911
-
912
1070
  if (typeof teamId !== 'undefined') {
913
1071
  payload['teamId'] = teamId;
914
1072
  }
915
1073
 
916
1074
  let response = undefined;
1075
+
917
1076
  response = await client.call('patch', apiPath, {
918
1077
  'content-type': 'application/json',
919
1078
  }, payload);
920
-
1079
+
921
1080
  if (parseOutput) {
922
1081
  parse(response)
923
1082
  success()
924
1083
  }
1084
+
925
1085
  return response;
926
1086
  }
927
1087
 
1088
+ /**
1089
+ * @typedef {Object} ProjectsGetEmailTemplateRequestParams
1090
+ * @property {string} projectId Project unique ID.
1091
+ * @property {string} type Template type
1092
+ * @property {string} locale Template locale
1093
+ * @property {boolean} parseOutput
1094
+ * @property {libClient | undefined} sdk
1095
+ */
1096
+
1097
+ /**
1098
+ * @param {ProjectsGetEmailTemplateRequestParams} params
1099
+ */
928
1100
  const projectsGetEmailTemplate = async ({ projectId, type, locale, parseOutput = true, sdk = undefined}) => {
929
- /* @param {string} projectId */
930
- /* @param {string} type */
931
- /* @param {string} locale */
932
-
933
1101
  let client = !sdk ? await sdkForConsole() : sdk;
934
1102
  let apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
935
1103
  let payload = {};
1104
+
936
1105
  let response = undefined;
1106
+
937
1107
  response = await client.call('get', apiPath, {
938
1108
  'content-type': 'application/json',
939
1109
  }, payload);
940
-
1110
+
941
1111
  if (parseOutput) {
942
1112
  parse(response)
943
1113
  success()
944
1114
  }
1115
+
945
1116
  return response;
946
1117
  }
947
1118
 
1119
+ /**
1120
+ * @typedef {Object} ProjectsUpdateEmailTemplateRequestParams
1121
+ * @property {string} projectId Project unique ID.
1122
+ * @property {string} type Template type
1123
+ * @property {string} locale Template locale
1124
+ * @property {string} subject Email Subject
1125
+ * @property {string} message Template message
1126
+ * @property {string} senderName Name of the email sender
1127
+ * @property {string} senderEmail Email of the sender
1128
+ * @property {string} replyTo Reply to email
1129
+ * @property {boolean} parseOutput
1130
+ * @property {libClient | undefined} sdk
1131
+ */
1132
+
1133
+ /**
1134
+ * @param {ProjectsUpdateEmailTemplateRequestParams} params
1135
+ */
948
1136
  const projectsUpdateEmailTemplate = async ({ projectId, type, locale, subject, message, senderName, senderEmail, replyTo, parseOutput = true, sdk = undefined}) => {
949
- /* @param {string} projectId */
950
- /* @param {string} type */
951
- /* @param {string} locale */
952
- /* @param {string} subject */
953
- /* @param {string} message */
954
- /* @param {string} senderName */
955
- /* @param {string} senderEmail */
956
- /* @param {string} replyTo */
957
-
958
1137
  let client = !sdk ? await sdkForConsole() : sdk;
959
1138
  let apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
960
1139
  let payload = {};
961
-
962
- /** Body Params */
963
-
964
1140
  if (typeof subject !== 'undefined') {
965
1141
  payload['subject'] = subject;
966
1142
  }
967
-
968
-
969
1143
  if (typeof message !== 'undefined') {
970
1144
  payload['message'] = message;
971
1145
  }
972
-
973
-
974
1146
  if (typeof senderName !== 'undefined') {
975
1147
  payload['senderName'] = senderName;
976
1148
  }
977
-
978
-
979
1149
  if (typeof senderEmail !== 'undefined') {
980
1150
  payload['senderEmail'] = senderEmail;
981
1151
  }
982
-
983
-
984
1152
  if (typeof replyTo !== 'undefined') {
985
1153
  payload['replyTo'] = replyTo;
986
1154
  }
987
1155
 
988
1156
  let response = undefined;
1157
+
989
1158
  response = await client.call('patch', apiPath, {
990
1159
  'content-type': 'application/json',
991
1160
  }, payload);
992
-
1161
+
993
1162
  if (parseOutput) {
994
1163
  parse(response)
995
1164
  success()
996
1165
  }
1166
+
997
1167
  return response;
998
1168
  }
999
1169
 
1170
+ /**
1171
+ * @typedef {Object} ProjectsDeleteEmailTemplateRequestParams
1172
+ * @property {string} projectId Project unique ID.
1173
+ * @property {string} type Template type
1174
+ * @property {string} locale Template locale
1175
+ * @property {boolean} parseOutput
1176
+ * @property {libClient | undefined} sdk
1177
+ */
1178
+
1179
+ /**
1180
+ * @param {ProjectsDeleteEmailTemplateRequestParams} params
1181
+ */
1000
1182
  const projectsDeleteEmailTemplate = async ({ projectId, type, locale, parseOutput = true, sdk = undefined}) => {
1001
- /* @param {string} projectId */
1002
- /* @param {string} type */
1003
- /* @param {string} locale */
1004
-
1005
1183
  let client = !sdk ? await sdkForConsole() : sdk;
1006
1184
  let apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
1007
1185
  let payload = {};
1186
+
1008
1187
  let response = undefined;
1188
+
1009
1189
  response = await client.call('delete', apiPath, {
1010
1190
  'content-type': 'application/json',
1011
1191
  }, payload);
1012
-
1192
+
1013
1193
  if (parseOutput) {
1014
1194
  parse(response)
1015
1195
  success()
1016
1196
  }
1197
+
1017
1198
  return response;
1018
1199
  }
1019
1200
 
1201
+ /**
1202
+ * @typedef {Object} ProjectsGetSmsTemplateRequestParams
1203
+ * @property {string} projectId Project unique ID.
1204
+ * @property {string} type Template type
1205
+ * @property {string} locale Template locale
1206
+ * @property {boolean} parseOutput
1207
+ * @property {libClient | undefined} sdk
1208
+ */
1209
+
1210
+ /**
1211
+ * @param {ProjectsGetSmsTemplateRequestParams} params
1212
+ */
1020
1213
  const projectsGetSmsTemplate = async ({ projectId, type, locale, parseOutput = true, sdk = undefined}) => {
1021
- /* @param {string} projectId */
1022
- /* @param {string} type */
1023
- /* @param {string} locale */
1024
-
1025
1214
  let client = !sdk ? await sdkForConsole() : sdk;
1026
1215
  let apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
1027
1216
  let payload = {};
1217
+
1028
1218
  let response = undefined;
1219
+
1029
1220
  response = await client.call('get', apiPath, {
1030
1221
  'content-type': 'application/json',
1031
1222
  }, payload);
1032
-
1223
+
1033
1224
  if (parseOutput) {
1034
1225
  parse(response)
1035
1226
  success()
1036
1227
  }
1228
+
1037
1229
  return response;
1038
1230
  }
1039
1231
 
1232
+ /**
1233
+ * @typedef {Object} ProjectsUpdateSmsTemplateRequestParams
1234
+ * @property {string} projectId Project unique ID.
1235
+ * @property {string} type Template type
1236
+ * @property {string} locale Template locale
1237
+ * @property {string} message Template message
1238
+ * @property {boolean} parseOutput
1239
+ * @property {libClient | undefined} sdk
1240
+ */
1241
+
1242
+ /**
1243
+ * @param {ProjectsUpdateSmsTemplateRequestParams} params
1244
+ */
1040
1245
  const projectsUpdateSmsTemplate = async ({ projectId, type, locale, message, parseOutput = true, sdk = undefined}) => {
1041
- /* @param {string} projectId */
1042
- /* @param {string} type */
1043
- /* @param {string} locale */
1044
- /* @param {string} message */
1045
-
1046
1246
  let client = !sdk ? await sdkForConsole() : sdk;
1047
1247
  let apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
1048
1248
  let payload = {};
1049
-
1050
- /** Body Params */
1051
-
1052
1249
  if (typeof message !== 'undefined') {
1053
1250
  payload['message'] = message;
1054
1251
  }
1055
1252
 
1056
1253
  let response = undefined;
1254
+
1057
1255
  response = await client.call('patch', apiPath, {
1058
1256
  'content-type': 'application/json',
1059
1257
  }, payload);
1060
-
1258
+
1061
1259
  if (parseOutput) {
1062
1260
  parse(response)
1063
1261
  success()
1064
1262
  }
1263
+
1065
1264
  return response;
1066
1265
  }
1067
1266
 
1267
+ /**
1268
+ * @typedef {Object} ProjectsDeleteSmsTemplateRequestParams
1269
+ * @property {string} projectId Project unique ID.
1270
+ * @property {string} type Template type
1271
+ * @property {string} locale Template locale
1272
+ * @property {boolean} parseOutput
1273
+ * @property {libClient | undefined} sdk
1274
+ */
1275
+
1276
+ /**
1277
+ * @param {ProjectsDeleteSmsTemplateRequestParams} params
1278
+ */
1068
1279
  const projectsDeleteSmsTemplate = async ({ projectId, type, locale, parseOutput = true, sdk = undefined}) => {
1069
- /* @param {string} projectId */
1070
- /* @param {string} type */
1071
- /* @param {string} locale */
1072
-
1073
1280
  let client = !sdk ? await sdkForConsole() : sdk;
1074
1281
  let apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale);
1075
1282
  let payload = {};
1283
+
1076
1284
  let response = undefined;
1285
+
1077
1286
  response = await client.call('delete', apiPath, {
1078
1287
  'content-type': 'application/json',
1079
1288
  }, payload);
1080
-
1289
+
1081
1290
  if (parseOutput) {
1082
1291
  parse(response)
1083
1292
  success()
1084
1293
  }
1294
+
1085
1295
  return response;
1086
1296
  }
1087
1297
 
1298
+ /**
1299
+ * @typedef {Object} ProjectsGetUsageRequestParams
1300
+ * @property {string} projectId Project unique ID.
1301
+ * @property {string} range Date range.
1302
+ * @property {boolean} parseOutput
1303
+ * @property {libClient | undefined} sdk
1304
+ */
1305
+
1306
+ /**
1307
+ * @param {ProjectsGetUsageRequestParams} params
1308
+ */
1088
1309
  const projectsGetUsage = async ({ projectId, range, parseOutput = true, sdk = undefined}) => {
1089
- /* @param {string} projectId */
1090
- /* @param {string} range */
1091
-
1092
1310
  let client = !sdk ? await sdkForConsole() : sdk;
1093
1311
  let apiPath = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
1094
1312
  let payload = {};
1095
-
1096
- /** Query Params */
1097
1313
  if (typeof range !== 'undefined') {
1098
1314
  payload['range'] = range;
1099
1315
  }
1316
+
1100
1317
  let response = undefined;
1318
+
1101
1319
  response = await client.call('get', apiPath, {
1102
1320
  'content-type': 'application/json',
1103
1321
  }, payload);
1104
-
1322
+
1105
1323
  if (parseOutput) {
1106
1324
  parse(response)
1107
1325
  success()
1108
1326
  }
1327
+
1109
1328
  return response;
1110
1329
  }
1111
1330
 
1112
- const projectsListWebhooks = async ({ projectId, parseOutput = true, sdk = undefined}) => {
1113
- /* @param {string} projectId */
1331
+ /**
1332
+ * @typedef {Object} ProjectsListWebhooksRequestParams
1333
+ * @property {string} projectId Project unique ID.
1334
+ * @property {boolean} parseOutput
1335
+ * @property {libClient | undefined} sdk
1336
+ */
1114
1337
 
1338
+ /**
1339
+ * @param {ProjectsListWebhooksRequestParams} params
1340
+ */
1341
+ const projectsListWebhooks = async ({ projectId, parseOutput = true, sdk = undefined}) => {
1115
1342
  let client = !sdk ? await sdkForConsole() : sdk;
1116
1343
  let apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId);
1117
1344
  let payload = {};
1345
+
1118
1346
  let response = undefined;
1347
+
1119
1348
  response = await client.call('get', apiPath, {
1120
1349
  'content-type': 'application/json',
1121
1350
  }, payload);
1122
-
1351
+
1123
1352
  if (parseOutput) {
1124
1353
  parse(response)
1125
1354
  success()
1126
1355
  }
1356
+
1127
1357
  return response;
1128
1358
  }
1129
1359
 
1360
+ /**
1361
+ * @typedef {Object} ProjectsCreateWebhookRequestParams
1362
+ * @property {string} projectId Project unique ID.
1363
+ * @property {string} name Webhook name. Max length: 128 chars.
1364
+ * @property {string[]} events Events list. Maximum of 100 events are allowed.
1365
+ * @property {string} url Webhook URL.
1366
+ * @property {boolean} security Certificate verification, false for disabled or true for enabled.
1367
+ * @property {string} httpUser Webhook HTTP user. Max length: 256 chars.
1368
+ * @property {string} httpPass Webhook HTTP password. Max length: 256 chars.
1369
+ * @property {boolean} parseOutput
1370
+ * @property {libClient | undefined} sdk
1371
+ */
1372
+
1373
+ /**
1374
+ * @param {ProjectsCreateWebhookRequestParams} params
1375
+ */
1130
1376
  const projectsCreateWebhook = async ({ projectId, name, events, url, security, httpUser, httpPass, parseOutput = true, sdk = undefined}) => {
1131
- /* @param {string} projectId */
1132
- /* @param {string} name */
1133
- /* @param {string[]} events */
1134
- /* @param {string} url */
1135
- /* @param {boolean} security */
1136
- /* @param {string} httpUser */
1137
- /* @param {string} httpPass */
1138
-
1139
1377
  let client = !sdk ? await sdkForConsole() : sdk;
1140
1378
  let apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId);
1141
1379
  let payload = {};
1142
-
1143
- /** Body Params */
1144
-
1145
1380
  if (typeof name !== 'undefined') {
1146
1381
  payload['name'] = name;
1147
1382
  }
1148
-
1149
1383
  events = events === true ? [] : events;
1150
-
1151
1384
  if (typeof events !== 'undefined') {
1152
1385
  payload['events'] = events;
1153
1386
  }
1154
-
1155
-
1156
1387
  if (typeof url !== 'undefined') {
1157
1388
  payload['url'] = url;
1158
1389
  }
1159
-
1160
-
1161
1390
  if (typeof security !== 'undefined') {
1162
1391
  payload['security'] = security;
1163
1392
  }
1164
-
1165
-
1166
1393
  if (typeof httpUser !== 'undefined') {
1167
1394
  payload['httpUser'] = httpUser;
1168
1395
  }
1169
-
1170
-
1171
1396
  if (typeof httpPass !== 'undefined') {
1172
1397
  payload['httpPass'] = httpPass;
1173
1398
  }
1174
1399
 
1175
1400
  let response = undefined;
1401
+
1176
1402
  response = await client.call('post', apiPath, {
1177
1403
  'content-type': 'application/json',
1178
1404
  }, payload);
1179
-
1405
+
1180
1406
  if (parseOutput) {
1181
1407
  parse(response)
1182
1408
  success()
1183
1409
  }
1410
+
1184
1411
  return response;
1185
1412
  }
1186
1413
 
1414
+ /**
1415
+ * @typedef {Object} ProjectsGetWebhookRequestParams
1416
+ * @property {string} projectId Project unique ID.
1417
+ * @property {string} webhookId Webhook unique ID.
1418
+ * @property {boolean} parseOutput
1419
+ * @property {libClient | undefined} sdk
1420
+ */
1421
+
1422
+ /**
1423
+ * @param {ProjectsGetWebhookRequestParams} params
1424
+ */
1187
1425
  const projectsGetWebhook = async ({ projectId, webhookId, parseOutput = true, sdk = undefined}) => {
1188
- /* @param {string} projectId */
1189
- /* @param {string} webhookId */
1190
-
1191
1426
  let client = !sdk ? await sdkForConsole() : sdk;
1192
1427
  let apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
1193
1428
  let payload = {};
1429
+
1194
1430
  let response = undefined;
1431
+
1195
1432
  response = await client.call('get', apiPath, {
1196
1433
  'content-type': 'application/json',
1197
1434
  }, payload);
1198
-
1435
+
1199
1436
  if (parseOutput) {
1200
1437
  parse(response)
1201
1438
  success()
1202
1439
  }
1440
+
1203
1441
  return response;
1204
1442
  }
1205
1443
 
1444
+ /**
1445
+ * @typedef {Object} ProjectsUpdateWebhookRequestParams
1446
+ * @property {string} projectId Project unique ID.
1447
+ * @property {string} webhookId Webhook unique ID.
1448
+ * @property {string} name Webhook name. Max length: 128 chars.
1449
+ * @property {string[]} events Events list. Maximum of 100 events are allowed.
1450
+ * @property {string} url Webhook URL.
1451
+ * @property {boolean} security Certificate verification, false for disabled or true for enabled.
1452
+ * @property {string} httpUser Webhook HTTP user. Max length: 256 chars.
1453
+ * @property {string} httpPass Webhook HTTP password. Max length: 256 chars.
1454
+ * @property {boolean} parseOutput
1455
+ * @property {libClient | undefined} sdk
1456
+ */
1457
+
1458
+ /**
1459
+ * @param {ProjectsUpdateWebhookRequestParams} params
1460
+ */
1206
1461
  const projectsUpdateWebhook = async ({ projectId, webhookId, name, events, url, security, httpUser, httpPass, parseOutput = true, sdk = undefined}) => {
1207
- /* @param {string} projectId */
1208
- /* @param {string} webhookId */
1209
- /* @param {string} name */
1210
- /* @param {string[]} events */
1211
- /* @param {string} url */
1212
- /* @param {boolean} security */
1213
- /* @param {string} httpUser */
1214
- /* @param {string} httpPass */
1215
-
1216
1462
  let client = !sdk ? await sdkForConsole() : sdk;
1217
1463
  let apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
1218
1464
  let payload = {};
1219
-
1220
- /** Body Params */
1221
-
1222
1465
  if (typeof name !== 'undefined') {
1223
1466
  payload['name'] = name;
1224
1467
  }
1225
-
1226
1468
  events = events === true ? [] : events;
1227
-
1228
1469
  if (typeof events !== 'undefined') {
1229
1470
  payload['events'] = events;
1230
1471
  }
1231
-
1232
-
1233
1472
  if (typeof url !== 'undefined') {
1234
1473
  payload['url'] = url;
1235
1474
  }
1236
-
1237
-
1238
1475
  if (typeof security !== 'undefined') {
1239
1476
  payload['security'] = security;
1240
1477
  }
1241
-
1242
-
1243
1478
  if (typeof httpUser !== 'undefined') {
1244
1479
  payload['httpUser'] = httpUser;
1245
1480
  }
1246
-
1247
-
1248
1481
  if (typeof httpPass !== 'undefined') {
1249
1482
  payload['httpPass'] = httpPass;
1250
1483
  }
1251
1484
 
1252
1485
  let response = undefined;
1486
+
1253
1487
  response = await client.call('put', apiPath, {
1254
1488
  'content-type': 'application/json',
1255
1489
  }, payload);
1256
-
1490
+
1257
1491
  if (parseOutput) {
1258
1492
  parse(response)
1259
1493
  success()
1260
1494
  }
1495
+
1261
1496
  return response;
1262
1497
  }
1263
1498
 
1499
+ /**
1500
+ * @typedef {Object} ProjectsDeleteWebhookRequestParams
1501
+ * @property {string} projectId Project unique ID.
1502
+ * @property {string} webhookId Webhook unique ID.
1503
+ * @property {boolean} parseOutput
1504
+ * @property {libClient | undefined} sdk
1505
+ */
1506
+
1507
+ /**
1508
+ * @param {ProjectsDeleteWebhookRequestParams} params
1509
+ */
1264
1510
  const projectsDeleteWebhook = async ({ projectId, webhookId, parseOutput = true, sdk = undefined}) => {
1265
- /* @param {string} projectId */
1266
- /* @param {string} webhookId */
1267
-
1268
1511
  let client = !sdk ? await sdkForConsole() : sdk;
1269
1512
  let apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
1270
1513
  let payload = {};
1514
+
1271
1515
  let response = undefined;
1516
+
1272
1517
  response = await client.call('delete', apiPath, {
1273
1518
  'content-type': 'application/json',
1274
1519
  }, payload);
1275
-
1520
+
1276
1521
  if (parseOutput) {
1277
1522
  parse(response)
1278
1523
  success()
1279
1524
  }
1525
+
1280
1526
  return response;
1281
1527
  }
1282
1528
 
1529
+ /**
1530
+ * @typedef {Object} ProjectsUpdateWebhookSignatureRequestParams
1531
+ * @property {string} projectId Project unique ID.
1532
+ * @property {string} webhookId Webhook unique ID.
1533
+ * @property {boolean} parseOutput
1534
+ * @property {libClient | undefined} sdk
1535
+ */
1536
+
1537
+ /**
1538
+ * @param {ProjectsUpdateWebhookSignatureRequestParams} params
1539
+ */
1283
1540
  const projectsUpdateWebhookSignature = async ({ projectId, webhookId, parseOutput = true, sdk = undefined}) => {
1284
- /* @param {string} projectId */
1285
- /* @param {string} webhookId */
1286
-
1287
1541
  let client = !sdk ? await sdkForConsole() : sdk;
1288
1542
  let apiPath = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
1289
1543
  let payload = {};
1544
+
1290
1545
  let response = undefined;
1546
+
1291
1547
  response = await client.call('patch', apiPath, {
1292
1548
  'content-type': 'application/json',
1293
1549
  }, payload);
1294
-
1550
+
1295
1551
  if (parseOutput) {
1296
1552
  parse(response)
1297
1553
  success()
1298
1554
  }
1555
+
1299
1556
  return response;
1300
1557
  }
1301
1558
 
1302
-
1303
1559
  projects
1304
1560
  .command(`list`)
1305
1561
  .description(``)
@@ -1644,7 +1900,6 @@ projects
1644
1900
  .requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`)
1645
1901
  .action(actionRunner(projectsUpdateWebhookSignature))
1646
1902
 
1647
-
1648
1903
  module.exports = {
1649
1904
  projects,
1650
1905
  projectsList,
@@ -1687,4 +1942,4 @@ module.exports = {
1687
1942
  projectsUpdateWebhook,
1688
1943
  projectsDeleteWebhook,
1689
1944
  projectsUpdateWebhookSignature
1690
- };
1945
+ };