node-appwrite 7.0.0 → 8.0.0-RC1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/docs/examples/databases/create-boolean-attribute.md +2 -2
- package/docs/examples/databases/create-collection.md +2 -2
- package/docs/examples/databases/create-datetime-attribute.md +20 -0
- package/docs/examples/databases/create-document.md +2 -2
- package/docs/examples/databases/create-email-attribute.md +2 -2
- package/docs/examples/databases/create-enum-attribute.md +2 -2
- package/docs/examples/databases/create-float-attribute.md +2 -2
- package/docs/examples/databases/create-index.md +2 -2
- package/docs/examples/databases/create-integer-attribute.md +2 -2
- package/docs/examples/databases/create-ip-attribute.md +2 -2
- package/docs/examples/databases/create-string-attribute.md +2 -2
- package/docs/examples/databases/create-url-attribute.md +2 -2
- package/docs/examples/databases/create.md +2 -2
- package/docs/examples/databases/delete-attribute.md +2 -2
- package/docs/examples/databases/delete-collection.md +2 -2
- package/docs/examples/databases/delete-document.md +2 -2
- package/docs/examples/databases/delete-index.md +2 -2
- package/docs/examples/databases/delete.md +2 -2
- package/docs/examples/databases/get-attribute.md +2 -2
- package/docs/examples/databases/get-collection.md +2 -2
- package/docs/examples/databases/get-document.md +2 -2
- package/docs/examples/databases/get-index.md +2 -2
- package/docs/examples/databases/get.md +2 -2
- package/docs/examples/databases/list-attributes.md +2 -2
- package/docs/examples/databases/list-collections.md +2 -2
- package/docs/examples/databases/list-documents.md +2 -2
- package/docs/examples/databases/list-indexes.md +2 -2
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-collection.md +2 -2
- package/docs/examples/databases/update-document.md +2 -2
- package/docs/examples/databases/update.md +2 -2
- package/docs/examples/functions/create-deployment.md +1 -1
- package/docs/examples/functions/create-variable.md +20 -0
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/delete-variable.md +20 -0
- package/docs/examples/functions/get-variable.md +20 -0
- package/docs/examples/functions/list-variables.md +20 -0
- package/docs/examples/functions/update-variable.md +20 -0
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/users/create-argon2user.md +20 -0
- package/docs/examples/users/create-bcrypt-user.md +20 -0
- package/docs/examples/users/create-m-d5user.md +20 -0
- package/docs/examples/users/create-p-h-pass-user.md +20 -0
- package/docs/examples/users/create-s-h-a-user.md +20 -0
- package/docs/examples/users/create-scrypt-modified-user.md +20 -0
- package/docs/examples/users/create-scrypt-user.md +20 -0
- package/docs/examples/users/create.md +1 -1
- package/index.d.ts +703 -235
- package/index.js +6 -0
- package/lib/client.js +5 -2
- package/lib/id.js +12 -0
- package/lib/permission.js +24 -0
- package/lib/query.js +30 -12
- package/lib/role.js +25 -0
- package/lib/services/account.js +53 -52
- package/lib/services/avatars.js +22 -20
- package/lib/services/databases.js +385 -243
- package/lib/services/functions.js +220 -110
- package/lib/services/health.js +7 -1
- package/lib/services/locale.js +7 -1
- package/lib/services/storage.js +78 -129
- package/lib/services/teams.js +39 -73
- package/lib/services/users.js +482 -63
- package/package.json +1 -1
|
@@ -8,47 +8,33 @@ const fs = require('fs');
|
|
|
8
8
|
|
|
9
9
|
class Functions extends Service {
|
|
10
10
|
|
|
11
|
+
constructor(client)
|
|
12
|
+
{
|
|
13
|
+
super(client);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* List Functions
|
|
13
19
|
*
|
|
14
20
|
* Get a list of all the project's functions. You can use the query params to
|
|
15
21
|
* filter your results.
|
|
16
22
|
*
|
|
23
|
+
* @param {string[]} queries
|
|
17
24
|
* @param {string} search
|
|
18
|
-
* @param {number} limit
|
|
19
|
-
* @param {number} offset
|
|
20
|
-
* @param {string} cursor
|
|
21
|
-
* @param {string} cursorDirection
|
|
22
|
-
* @param {string} orderType
|
|
23
25
|
* @throws {AppwriteException}
|
|
24
26
|
* @returns {Promise}
|
|
25
27
|
*/
|
|
26
|
-
async list(
|
|
28
|
+
async list(queries, search) {
|
|
27
29
|
let path = '/functions';
|
|
28
30
|
let payload = {};
|
|
29
31
|
|
|
30
|
-
if (typeof
|
|
31
|
-
payload['
|
|
32
|
+
if (typeof queries !== 'undefined') {
|
|
33
|
+
payload['queries'] = queries;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
if (typeof
|
|
35
|
-
payload['
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (typeof offset !== 'undefined') {
|
|
39
|
-
payload['offset'] = offset;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (typeof cursor !== 'undefined') {
|
|
43
|
-
payload['cursor'] = cursor;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (typeof cursorDirection !== 'undefined') {
|
|
47
|
-
payload['cursorDirection'] = cursorDirection;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (typeof orderType !== 'undefined') {
|
|
51
|
-
payload['orderType'] = orderType;
|
|
36
|
+
if (typeof search !== 'undefined') {
|
|
37
|
+
payload['search'] = search;
|
|
52
38
|
}
|
|
53
39
|
|
|
54
40
|
return await this.client.call('get', path, {
|
|
@@ -67,14 +53,15 @@ class Functions extends Service {
|
|
|
67
53
|
* @param {string} name
|
|
68
54
|
* @param {string[]} execute
|
|
69
55
|
* @param {string} runtime
|
|
70
|
-
* @param {object} vars
|
|
71
56
|
* @param {string[]} events
|
|
72
57
|
* @param {string} schedule
|
|
73
58
|
* @param {number} timeout
|
|
74
59
|
* @throws {AppwriteException}
|
|
75
60
|
* @returns {Promise}
|
|
76
61
|
*/
|
|
77
|
-
async create(functionId, name, execute, runtime,
|
|
62
|
+
async create(functionId, name, execute, runtime, events, schedule, timeout) {
|
|
63
|
+
let path = '/functions';
|
|
64
|
+
let payload = {};
|
|
78
65
|
if (typeof functionId === 'undefined') {
|
|
79
66
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
80
67
|
}
|
|
@@ -91,8 +78,6 @@ class Functions extends Service {
|
|
|
91
78
|
throw new AppwriteException('Missing required parameter: "runtime"');
|
|
92
79
|
}
|
|
93
80
|
|
|
94
|
-
let path = '/functions';
|
|
95
|
-
let payload = {};
|
|
96
81
|
|
|
97
82
|
if (typeof functionId !== 'undefined') {
|
|
98
83
|
payload['functionId'] = functionId;
|
|
@@ -110,10 +95,6 @@ class Functions extends Service {
|
|
|
110
95
|
payload['runtime'] = runtime;
|
|
111
96
|
}
|
|
112
97
|
|
|
113
|
-
if (typeof vars !== 'undefined') {
|
|
114
|
-
payload['vars'] = vars;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
98
|
if (typeof events !== 'undefined') {
|
|
118
99
|
payload['events'] = events;
|
|
119
100
|
}
|
|
@@ -158,12 +139,12 @@ class Functions extends Service {
|
|
|
158
139
|
* @returns {Promise}
|
|
159
140
|
*/
|
|
160
141
|
async get(functionId) {
|
|
142
|
+
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
143
|
+
let payload = {};
|
|
161
144
|
if (typeof functionId === 'undefined') {
|
|
162
145
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
163
146
|
}
|
|
164
147
|
|
|
165
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
166
|
-
let payload = {};
|
|
167
148
|
|
|
168
149
|
return await this.client.call('get', path, {
|
|
169
150
|
'content-type': 'application/json',
|
|
@@ -178,14 +159,15 @@ class Functions extends Service {
|
|
|
178
159
|
* @param {string} functionId
|
|
179
160
|
* @param {string} name
|
|
180
161
|
* @param {string[]} execute
|
|
181
|
-
* @param {object} vars
|
|
182
162
|
* @param {string[]} events
|
|
183
163
|
* @param {string} schedule
|
|
184
164
|
* @param {number} timeout
|
|
185
165
|
* @throws {AppwriteException}
|
|
186
166
|
* @returns {Promise}
|
|
187
167
|
*/
|
|
188
|
-
async update(functionId, name, execute,
|
|
168
|
+
async update(functionId, name, execute, events, schedule, timeout) {
|
|
169
|
+
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
170
|
+
let payload = {};
|
|
189
171
|
if (typeof functionId === 'undefined') {
|
|
190
172
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
191
173
|
}
|
|
@@ -198,8 +180,6 @@ class Functions extends Service {
|
|
|
198
180
|
throw new AppwriteException('Missing required parameter: "execute"');
|
|
199
181
|
}
|
|
200
182
|
|
|
201
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
202
|
-
let payload = {};
|
|
203
183
|
|
|
204
184
|
if (typeof name !== 'undefined') {
|
|
205
185
|
payload['name'] = name;
|
|
@@ -209,10 +189,6 @@ class Functions extends Service {
|
|
|
209
189
|
payload['execute'] = execute;
|
|
210
190
|
}
|
|
211
191
|
|
|
212
|
-
if (typeof vars !== 'undefined') {
|
|
213
|
-
payload['vars'] = vars;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
192
|
if (typeof events !== 'undefined') {
|
|
217
193
|
payload['events'] = events;
|
|
218
194
|
}
|
|
@@ -240,12 +216,12 @@ class Functions extends Service {
|
|
|
240
216
|
* @returns {Promise}
|
|
241
217
|
*/
|
|
242
218
|
async delete(functionId) {
|
|
219
|
+
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
220
|
+
let payload = {};
|
|
243
221
|
if (typeof functionId === 'undefined') {
|
|
244
222
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
245
223
|
}
|
|
246
224
|
|
|
247
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
248
|
-
let payload = {};
|
|
249
225
|
|
|
250
226
|
return await this.client.call('delete', path, {
|
|
251
227
|
'content-type': 'application/json',
|
|
@@ -259,45 +235,25 @@ class Functions extends Service {
|
|
|
259
235
|
* params to filter your results.
|
|
260
236
|
*
|
|
261
237
|
* @param {string} functionId
|
|
238
|
+
* @param {string[]} queries
|
|
262
239
|
* @param {string} search
|
|
263
|
-
* @param {number} limit
|
|
264
|
-
* @param {number} offset
|
|
265
|
-
* @param {string} cursor
|
|
266
|
-
* @param {string} cursorDirection
|
|
267
|
-
* @param {string} orderType
|
|
268
240
|
* @throws {AppwriteException}
|
|
269
241
|
* @returns {Promise}
|
|
270
242
|
*/
|
|
271
|
-
async listDeployments(functionId,
|
|
272
|
-
if (typeof functionId === 'undefined') {
|
|
273
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
274
|
-
}
|
|
275
|
-
|
|
243
|
+
async listDeployments(functionId, queries, search) {
|
|
276
244
|
let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
277
245
|
let payload = {};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
payload['search'] = search;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (typeof limit !== 'undefined') {
|
|
284
|
-
payload['limit'] = limit;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (typeof offset !== 'undefined') {
|
|
288
|
-
payload['offset'] = offset;
|
|
246
|
+
if (typeof functionId === 'undefined') {
|
|
247
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
289
248
|
}
|
|
290
249
|
|
|
291
|
-
if (typeof cursor !== 'undefined') {
|
|
292
|
-
payload['cursor'] = cursor;
|
|
293
|
-
}
|
|
294
250
|
|
|
295
|
-
if (typeof
|
|
296
|
-
payload['
|
|
251
|
+
if (typeof queries !== 'undefined') {
|
|
252
|
+
payload['queries'] = queries;
|
|
297
253
|
}
|
|
298
254
|
|
|
299
|
-
if (typeof
|
|
300
|
-
payload['
|
|
255
|
+
if (typeof search !== 'undefined') {
|
|
256
|
+
payload['search'] = search;
|
|
301
257
|
}
|
|
302
258
|
|
|
303
259
|
return await this.client.call('get', path, {
|
|
@@ -327,6 +283,8 @@ class Functions extends Service {
|
|
|
327
283
|
* @returns {Promise}
|
|
328
284
|
*/
|
|
329
285
|
async createDeployment(functionId, entrypoint, code, activate, onProgress = () => {}) {
|
|
286
|
+
let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
287
|
+
let payload = {};
|
|
330
288
|
if (typeof functionId === 'undefined') {
|
|
331
289
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
332
290
|
}
|
|
@@ -343,8 +301,6 @@ class Functions extends Service {
|
|
|
343
301
|
throw new AppwriteException('Missing required parameter: "activate"');
|
|
344
302
|
}
|
|
345
303
|
|
|
346
|
-
let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
347
|
-
let payload = {};
|
|
348
304
|
|
|
349
305
|
if (typeof entrypoint !== 'undefined') {
|
|
350
306
|
payload['entrypoint'] = entrypoint;
|
|
@@ -393,7 +349,7 @@ class Functions extends Service {
|
|
|
393
349
|
}
|
|
394
350
|
|
|
395
351
|
const stream = Stream.Readable.from(currentChunk);
|
|
396
|
-
payload['code'] = { type: 'file', file: stream, filename:
|
|
352
|
+
payload['code'] = { type: 'file', file: stream, filename: code.filename };
|
|
397
353
|
|
|
398
354
|
response = await selfClient.call('post', path, headers, payload);
|
|
399
355
|
|
|
@@ -469,6 +425,7 @@ class Functions extends Service {
|
|
|
469
425
|
|
|
470
426
|
code.stream.pipe(writeStream);
|
|
471
427
|
});
|
|
428
|
+
|
|
472
429
|
}
|
|
473
430
|
|
|
474
431
|
/**
|
|
@@ -482,6 +439,8 @@ class Functions extends Service {
|
|
|
482
439
|
* @returns {Promise}
|
|
483
440
|
*/
|
|
484
441
|
async getDeployment(functionId, deploymentId) {
|
|
442
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
443
|
+
let payload = {};
|
|
485
444
|
if (typeof functionId === 'undefined') {
|
|
486
445
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
487
446
|
}
|
|
@@ -490,8 +449,6 @@ class Functions extends Service {
|
|
|
490
449
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
491
450
|
}
|
|
492
451
|
|
|
493
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
494
|
-
let payload = {};
|
|
495
452
|
|
|
496
453
|
return await this.client.call('get', path, {
|
|
497
454
|
'content-type': 'application/json',
|
|
@@ -511,6 +468,8 @@ class Functions extends Service {
|
|
|
511
468
|
* @returns {Promise}
|
|
512
469
|
*/
|
|
513
470
|
async updateDeployment(functionId, deploymentId) {
|
|
471
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
472
|
+
let payload = {};
|
|
514
473
|
if (typeof functionId === 'undefined') {
|
|
515
474
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
516
475
|
}
|
|
@@ -519,8 +478,6 @@ class Functions extends Service {
|
|
|
519
478
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
520
479
|
}
|
|
521
480
|
|
|
522
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
523
|
-
let payload = {};
|
|
524
481
|
|
|
525
482
|
return await this.client.call('patch', path, {
|
|
526
483
|
'content-type': 'application/json',
|
|
@@ -538,6 +495,8 @@ class Functions extends Service {
|
|
|
538
495
|
* @returns {Promise}
|
|
539
496
|
*/
|
|
540
497
|
async deleteDeployment(functionId, deploymentId) {
|
|
498
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
499
|
+
let payload = {};
|
|
541
500
|
if (typeof functionId === 'undefined') {
|
|
542
501
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
543
502
|
}
|
|
@@ -546,8 +505,6 @@ class Functions extends Service {
|
|
|
546
505
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
547
506
|
}
|
|
548
507
|
|
|
549
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
550
|
-
let payload = {};
|
|
551
508
|
|
|
552
509
|
return await this.client.call('delete', path, {
|
|
553
510
|
'content-type': 'application/json',
|
|
@@ -564,6 +521,8 @@ class Functions extends Service {
|
|
|
564
521
|
* @returns {Promise}
|
|
565
522
|
*/
|
|
566
523
|
async retryBuild(functionId, deploymentId, buildId) {
|
|
524
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
525
|
+
let payload = {};
|
|
567
526
|
if (typeof functionId === 'undefined') {
|
|
568
527
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
569
528
|
}
|
|
@@ -576,8 +535,6 @@ class Functions extends Service {
|
|
|
576
535
|
throw new AppwriteException('Missing required parameter: "buildId"');
|
|
577
536
|
}
|
|
578
537
|
|
|
579
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
580
|
-
let payload = {};
|
|
581
538
|
|
|
582
539
|
return await this.client.call('post', path, {
|
|
583
540
|
'content-type': 'application/json',
|
|
@@ -593,42 +550,27 @@ class Functions extends Service {
|
|
|
593
550
|
* different API modes](/docs/admin).
|
|
594
551
|
*
|
|
595
552
|
* @param {string} functionId
|
|
596
|
-
* @param {
|
|
597
|
-
* @param {number} offset
|
|
553
|
+
* @param {string[]} queries
|
|
598
554
|
* @param {string} search
|
|
599
|
-
* @param {string} cursor
|
|
600
|
-
* @param {string} cursorDirection
|
|
601
555
|
* @throws {AppwriteException}
|
|
602
556
|
* @returns {Promise}
|
|
603
557
|
*/
|
|
604
|
-
async listExecutions(functionId,
|
|
558
|
+
async listExecutions(functionId, queries, search) {
|
|
559
|
+
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
560
|
+
let payload = {};
|
|
605
561
|
if (typeof functionId === 'undefined') {
|
|
606
562
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
607
563
|
}
|
|
608
564
|
|
|
609
|
-
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
610
|
-
let payload = {};
|
|
611
|
-
|
|
612
|
-
if (typeof limit !== 'undefined') {
|
|
613
|
-
payload['limit'] = limit;
|
|
614
|
-
}
|
|
615
565
|
|
|
616
|
-
if (typeof
|
|
617
|
-
payload['
|
|
566
|
+
if (typeof queries !== 'undefined') {
|
|
567
|
+
payload['queries'] = queries;
|
|
618
568
|
}
|
|
619
569
|
|
|
620
570
|
if (typeof search !== 'undefined') {
|
|
621
571
|
payload['search'] = search;
|
|
622
572
|
}
|
|
623
573
|
|
|
624
|
-
if (typeof cursor !== 'undefined') {
|
|
625
|
-
payload['cursor'] = cursor;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
if (typeof cursorDirection !== 'undefined') {
|
|
629
|
-
payload['cursorDirection'] = cursorDirection;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
574
|
return await this.client.call('get', path, {
|
|
633
575
|
'content-type': 'application/json',
|
|
634
576
|
}, payload);
|
|
@@ -649,12 +591,12 @@ class Functions extends Service {
|
|
|
649
591
|
* @returns {Promise}
|
|
650
592
|
*/
|
|
651
593
|
async createExecution(functionId, data, async) {
|
|
594
|
+
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
595
|
+
let payload = {};
|
|
652
596
|
if (typeof functionId === 'undefined') {
|
|
653
597
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
654
598
|
}
|
|
655
599
|
|
|
656
|
-
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
657
|
-
let payload = {};
|
|
658
600
|
|
|
659
601
|
if (typeof data !== 'undefined') {
|
|
660
602
|
payload['data'] = data;
|
|
@@ -680,6 +622,8 @@ class Functions extends Service {
|
|
|
680
622
|
* @returns {Promise}
|
|
681
623
|
*/
|
|
682
624
|
async getExecution(functionId, executionId) {
|
|
625
|
+
let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
626
|
+
let payload = {};
|
|
683
627
|
if (typeof functionId === 'undefined') {
|
|
684
628
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
685
629
|
}
|
|
@@ -688,13 +632,179 @@ class Functions extends Service {
|
|
|
688
632
|
throw new AppwriteException('Missing required parameter: "executionId"');
|
|
689
633
|
}
|
|
690
634
|
|
|
691
|
-
|
|
635
|
+
|
|
636
|
+
return await this.client.call('get', path, {
|
|
637
|
+
'content-type': 'application/json',
|
|
638
|
+
}, payload);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* List Variables
|
|
643
|
+
*
|
|
644
|
+
* Get a list of all variables of a specific function.
|
|
645
|
+
*
|
|
646
|
+
* @param {string} functionId
|
|
647
|
+
* @param {string[]} queries
|
|
648
|
+
* @param {string} search
|
|
649
|
+
* @throws {AppwriteException}
|
|
650
|
+
* @returns {Promise}
|
|
651
|
+
*/
|
|
652
|
+
async listVariables(functionId, queries, search) {
|
|
653
|
+
let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
692
654
|
let payload = {};
|
|
655
|
+
if (typeof functionId === 'undefined') {
|
|
656
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
if (typeof queries !== 'undefined') {
|
|
661
|
+
payload['queries'] = queries;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
if (typeof search !== 'undefined') {
|
|
665
|
+
payload['search'] = search;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
return await this.client.call('get', path, {
|
|
669
|
+
'content-type': 'application/json',
|
|
670
|
+
}, payload);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Create Variable
|
|
675
|
+
*
|
|
676
|
+
* Create a new function variable. These variables can be accessed within
|
|
677
|
+
* function in the `env` object under the request variable.
|
|
678
|
+
*
|
|
679
|
+
* @param {string} functionId
|
|
680
|
+
* @param {string} key
|
|
681
|
+
* @param {string} value
|
|
682
|
+
* @throws {AppwriteException}
|
|
683
|
+
* @returns {Promise}
|
|
684
|
+
*/
|
|
685
|
+
async createVariable(functionId, key, value) {
|
|
686
|
+
let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
687
|
+
let payload = {};
|
|
688
|
+
if (typeof functionId === 'undefined') {
|
|
689
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
if (typeof key === 'undefined') {
|
|
693
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if (typeof value === 'undefined') {
|
|
697
|
+
throw new AppwriteException('Missing required parameter: "value"');
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
if (typeof key !== 'undefined') {
|
|
702
|
+
payload['key'] = key;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
if (typeof value !== 'undefined') {
|
|
706
|
+
payload['value'] = value;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return await this.client.call('post', path, {
|
|
710
|
+
'content-type': 'application/json',
|
|
711
|
+
}, payload);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Get Variable
|
|
716
|
+
*
|
|
717
|
+
* Get a variable by its unique ID.
|
|
718
|
+
*
|
|
719
|
+
* @param {string} functionId
|
|
720
|
+
* @param {string} variableId
|
|
721
|
+
* @throws {AppwriteException}
|
|
722
|
+
* @returns {Promise}
|
|
723
|
+
*/
|
|
724
|
+
async getVariable(functionId, variableId) {
|
|
725
|
+
let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
726
|
+
let payload = {};
|
|
727
|
+
if (typeof functionId === 'undefined') {
|
|
728
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
if (typeof variableId === 'undefined') {
|
|
732
|
+
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
733
|
+
}
|
|
734
|
+
|
|
693
735
|
|
|
694
736
|
return await this.client.call('get', path, {
|
|
695
737
|
'content-type': 'application/json',
|
|
696
738
|
}, payload);
|
|
697
739
|
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Update Variable
|
|
743
|
+
*
|
|
744
|
+
* Update variable by its unique ID.
|
|
745
|
+
*
|
|
746
|
+
* @param {string} functionId
|
|
747
|
+
* @param {string} variableId
|
|
748
|
+
* @param {string} key
|
|
749
|
+
* @param {string} value
|
|
750
|
+
* @throws {AppwriteException}
|
|
751
|
+
* @returns {Promise}
|
|
752
|
+
*/
|
|
753
|
+
async updateVariable(functionId, variableId, key, value) {
|
|
754
|
+
let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
755
|
+
let payload = {};
|
|
756
|
+
if (typeof functionId === 'undefined') {
|
|
757
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (typeof variableId === 'undefined') {
|
|
761
|
+
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
if (typeof key === 'undefined') {
|
|
765
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
if (typeof key !== 'undefined') {
|
|
770
|
+
payload['key'] = key;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
if (typeof value !== 'undefined') {
|
|
774
|
+
payload['value'] = value;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
return await this.client.call('put', path, {
|
|
778
|
+
'content-type': 'application/json',
|
|
779
|
+
}, payload);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Delete Variable
|
|
784
|
+
*
|
|
785
|
+
* Delete a variable by its unique ID.
|
|
786
|
+
*
|
|
787
|
+
* @param {string} functionId
|
|
788
|
+
* @param {string} variableId
|
|
789
|
+
* @throws {AppwriteException}
|
|
790
|
+
* @returns {Promise}
|
|
791
|
+
*/
|
|
792
|
+
async deleteVariable(functionId, variableId) {
|
|
793
|
+
let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
794
|
+
let payload = {};
|
|
795
|
+
if (typeof functionId === 'undefined') {
|
|
796
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
if (typeof variableId === 'undefined') {
|
|
800
|
+
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
return await this.client.call('delete', path, {
|
|
805
|
+
'content-type': 'application/json',
|
|
806
|
+
}, payload);
|
|
807
|
+
}
|
|
698
808
|
}
|
|
699
809
|
|
|
700
|
-
module.exports = Functions;
|
|
810
|
+
module.exports = Functions;
|
package/lib/services/health.js
CHANGED
|
@@ -8,6 +8,12 @@ const fs = require('fs');
|
|
|
8
8
|
|
|
9
9
|
class Health extends Service {
|
|
10
10
|
|
|
11
|
+
constructor(client)
|
|
12
|
+
{
|
|
13
|
+
super(client);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* Get HTTP
|
|
13
19
|
*
|
|
@@ -188,4 +194,4 @@ class Health extends Service {
|
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
|
|
191
|
-
module.exports = Health;
|
|
197
|
+
module.exports = Health;
|
package/lib/services/locale.js
CHANGED
|
@@ -8,6 +8,12 @@ const fs = require('fs');
|
|
|
8
8
|
|
|
9
9
|
class Locale extends Service {
|
|
10
10
|
|
|
11
|
+
constructor(client)
|
|
12
|
+
{
|
|
13
|
+
super(client);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* Get User Locale
|
|
13
19
|
*
|
|
@@ -140,4 +146,4 @@ class Locale extends Service {
|
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
|
|
143
|
-
module.exports = Locale;
|
|
149
|
+
module.exports = Locale;
|