node-appwrite 7.0.3 → 8.0.0
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/.travis.yml +12 -3
- package/LICENSE +1 -1
- package/README.md +5 -5
- package/docs/examples/account/list-logs.md +20 -0
- package/docs/examples/account/list-sessions.md +20 -0
- 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/locale/list-continents.md +20 -0
- package/docs/examples/locale/list-countries-e-u.md +20 -0
- package/docs/examples/locale/list-countries-phones.md +20 -0
- package/docs/examples/locale/list-countries.md +20 -0
- package/docs/examples/locale/list-currencies.md +20 -0
- package/docs/examples/locale/list-languages.md +20 -0
- 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/teams/list-memberships.md +20 -0
- 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/docs/examples/users/list-logs.md +20 -0
- package/docs/examples/users/list-memberships.md +20 -0
- package/docs/examples/users/list-sessions.md +20 -0
- package/index.d.ts +736 -280
- 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 +34 -0
- package/lib/services/account.js +46 -45
- package/lib/services/avatars.js +22 -20
- package/lib/services/databases.js +385 -243
- package/lib/services/functions.js +219 -109
- package/lib/services/health.js +7 -1
- package/lib/services/locale.js +13 -7
- package/lib/services/storage.js +78 -129
- package/lib/services/teams.js +40 -74
- package/lib/services/users.js +487 -68
- 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,16 @@ 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
|
|
59
|
+
* @param {boolean} enabled
|
|
74
60
|
* @throws {AppwriteException}
|
|
75
61
|
* @returns {Promise}
|
|
76
62
|
*/
|
|
77
|
-
async create(functionId, name, execute, runtime,
|
|
63
|
+
async create(functionId, name, execute, runtime, events, schedule, timeout, enabled) {
|
|
64
|
+
let path = '/functions';
|
|
65
|
+
let payload = {};
|
|
78
66
|
if (typeof functionId === 'undefined') {
|
|
79
67
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
80
68
|
}
|
|
@@ -91,8 +79,6 @@ class Functions extends Service {
|
|
|
91
79
|
throw new AppwriteException('Missing required parameter: "runtime"');
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
let path = '/functions';
|
|
95
|
-
let payload = {};
|
|
96
82
|
|
|
97
83
|
if (typeof functionId !== 'undefined') {
|
|
98
84
|
payload['functionId'] = functionId;
|
|
@@ -110,10 +96,6 @@ class Functions extends Service {
|
|
|
110
96
|
payload['runtime'] = runtime;
|
|
111
97
|
}
|
|
112
98
|
|
|
113
|
-
if (typeof vars !== 'undefined') {
|
|
114
|
-
payload['vars'] = vars;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
99
|
if (typeof events !== 'undefined') {
|
|
118
100
|
payload['events'] = events;
|
|
119
101
|
}
|
|
@@ -126,6 +108,10 @@ class Functions extends Service {
|
|
|
126
108
|
payload['timeout'] = timeout;
|
|
127
109
|
}
|
|
128
110
|
|
|
111
|
+
if (typeof enabled !== 'undefined') {
|
|
112
|
+
payload['enabled'] = enabled;
|
|
113
|
+
}
|
|
114
|
+
|
|
129
115
|
return await this.client.call('post', path, {
|
|
130
116
|
'content-type': 'application/json',
|
|
131
117
|
}, payload);
|
|
@@ -158,12 +144,12 @@ class Functions extends Service {
|
|
|
158
144
|
* @returns {Promise}
|
|
159
145
|
*/
|
|
160
146
|
async get(functionId) {
|
|
147
|
+
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
148
|
+
let payload = {};
|
|
161
149
|
if (typeof functionId === 'undefined') {
|
|
162
150
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
163
151
|
}
|
|
164
152
|
|
|
165
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
166
|
-
let payload = {};
|
|
167
153
|
|
|
168
154
|
return await this.client.call('get', path, {
|
|
169
155
|
'content-type': 'application/json',
|
|
@@ -178,14 +164,16 @@ class Functions extends Service {
|
|
|
178
164
|
* @param {string} functionId
|
|
179
165
|
* @param {string} name
|
|
180
166
|
* @param {string[]} execute
|
|
181
|
-
* @param {object} vars
|
|
182
167
|
* @param {string[]} events
|
|
183
168
|
* @param {string} schedule
|
|
184
169
|
* @param {number} timeout
|
|
170
|
+
* @param {boolean} enabled
|
|
185
171
|
* @throws {AppwriteException}
|
|
186
172
|
* @returns {Promise}
|
|
187
173
|
*/
|
|
188
|
-
async update(functionId, name, execute,
|
|
174
|
+
async update(functionId, name, execute, events, schedule, timeout, enabled) {
|
|
175
|
+
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
176
|
+
let payload = {};
|
|
189
177
|
if (typeof functionId === 'undefined') {
|
|
190
178
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
191
179
|
}
|
|
@@ -198,8 +186,6 @@ class Functions extends Service {
|
|
|
198
186
|
throw new AppwriteException('Missing required parameter: "execute"');
|
|
199
187
|
}
|
|
200
188
|
|
|
201
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
202
|
-
let payload = {};
|
|
203
189
|
|
|
204
190
|
if (typeof name !== 'undefined') {
|
|
205
191
|
payload['name'] = name;
|
|
@@ -209,10 +195,6 @@ class Functions extends Service {
|
|
|
209
195
|
payload['execute'] = execute;
|
|
210
196
|
}
|
|
211
197
|
|
|
212
|
-
if (typeof vars !== 'undefined') {
|
|
213
|
-
payload['vars'] = vars;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
198
|
if (typeof events !== 'undefined') {
|
|
217
199
|
payload['events'] = events;
|
|
218
200
|
}
|
|
@@ -225,6 +207,10 @@ class Functions extends Service {
|
|
|
225
207
|
payload['timeout'] = timeout;
|
|
226
208
|
}
|
|
227
209
|
|
|
210
|
+
if (typeof enabled !== 'undefined') {
|
|
211
|
+
payload['enabled'] = enabled;
|
|
212
|
+
}
|
|
213
|
+
|
|
228
214
|
return await this.client.call('put', path, {
|
|
229
215
|
'content-type': 'application/json',
|
|
230
216
|
}, payload);
|
|
@@ -240,12 +226,12 @@ class Functions extends Service {
|
|
|
240
226
|
* @returns {Promise}
|
|
241
227
|
*/
|
|
242
228
|
async delete(functionId) {
|
|
229
|
+
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
230
|
+
let payload = {};
|
|
243
231
|
if (typeof functionId === 'undefined') {
|
|
244
232
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
245
233
|
}
|
|
246
234
|
|
|
247
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
248
|
-
let payload = {};
|
|
249
235
|
|
|
250
236
|
return await this.client.call('delete', path, {
|
|
251
237
|
'content-type': 'application/json',
|
|
@@ -259,45 +245,25 @@ class Functions extends Service {
|
|
|
259
245
|
* params to filter your results.
|
|
260
246
|
*
|
|
261
247
|
* @param {string} functionId
|
|
248
|
+
* @param {string[]} queries
|
|
262
249
|
* @param {string} search
|
|
263
|
-
* @param {number} limit
|
|
264
|
-
* @param {number} offset
|
|
265
|
-
* @param {string} cursor
|
|
266
|
-
* @param {string} cursorDirection
|
|
267
|
-
* @param {string} orderType
|
|
268
250
|
* @throws {AppwriteException}
|
|
269
251
|
* @returns {Promise}
|
|
270
252
|
*/
|
|
271
|
-
async listDeployments(functionId,
|
|
272
|
-
if (typeof functionId === 'undefined') {
|
|
273
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
274
|
-
}
|
|
275
|
-
|
|
253
|
+
async listDeployments(functionId, queries, search) {
|
|
276
254
|
let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
277
255
|
let payload = {};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
payload['search'] = search;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (typeof limit !== 'undefined') {
|
|
284
|
-
payload['limit'] = limit;
|
|
256
|
+
if (typeof functionId === 'undefined') {
|
|
257
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
285
258
|
}
|
|
286
259
|
|
|
287
|
-
if (typeof offset !== 'undefined') {
|
|
288
|
-
payload['offset'] = offset;
|
|
289
|
-
}
|
|
290
260
|
|
|
291
|
-
if (typeof
|
|
292
|
-
payload['
|
|
261
|
+
if (typeof queries !== 'undefined') {
|
|
262
|
+
payload['queries'] = queries;
|
|
293
263
|
}
|
|
294
264
|
|
|
295
|
-
if (typeof
|
|
296
|
-
payload['
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (typeof orderType !== 'undefined') {
|
|
300
|
-
payload['orderType'] = orderType;
|
|
265
|
+
if (typeof search !== 'undefined') {
|
|
266
|
+
payload['search'] = search;
|
|
301
267
|
}
|
|
302
268
|
|
|
303
269
|
return await this.client.call('get', path, {
|
|
@@ -327,6 +293,8 @@ class Functions extends Service {
|
|
|
327
293
|
* @returns {Promise}
|
|
328
294
|
*/
|
|
329
295
|
async createDeployment(functionId, entrypoint, code, activate, onProgress = () => {}) {
|
|
296
|
+
let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
297
|
+
let payload = {};
|
|
330
298
|
if (typeof functionId === 'undefined') {
|
|
331
299
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
332
300
|
}
|
|
@@ -343,8 +311,6 @@ class Functions extends Service {
|
|
|
343
311
|
throw new AppwriteException('Missing required parameter: "activate"');
|
|
344
312
|
}
|
|
345
313
|
|
|
346
|
-
let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
347
|
-
let payload = {};
|
|
348
314
|
|
|
349
315
|
if (typeof entrypoint !== 'undefined') {
|
|
350
316
|
payload['entrypoint'] = entrypoint;
|
|
@@ -469,6 +435,7 @@ class Functions extends Service {
|
|
|
469
435
|
|
|
470
436
|
code.stream.pipe(writeStream);
|
|
471
437
|
});
|
|
438
|
+
|
|
472
439
|
}
|
|
473
440
|
|
|
474
441
|
/**
|
|
@@ -482,6 +449,8 @@ class Functions extends Service {
|
|
|
482
449
|
* @returns {Promise}
|
|
483
450
|
*/
|
|
484
451
|
async getDeployment(functionId, deploymentId) {
|
|
452
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
453
|
+
let payload = {};
|
|
485
454
|
if (typeof functionId === 'undefined') {
|
|
486
455
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
487
456
|
}
|
|
@@ -490,8 +459,6 @@ class Functions extends Service {
|
|
|
490
459
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
491
460
|
}
|
|
492
461
|
|
|
493
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
494
|
-
let payload = {};
|
|
495
462
|
|
|
496
463
|
return await this.client.call('get', path, {
|
|
497
464
|
'content-type': 'application/json',
|
|
@@ -511,6 +478,8 @@ class Functions extends Service {
|
|
|
511
478
|
* @returns {Promise}
|
|
512
479
|
*/
|
|
513
480
|
async updateDeployment(functionId, deploymentId) {
|
|
481
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
482
|
+
let payload = {};
|
|
514
483
|
if (typeof functionId === 'undefined') {
|
|
515
484
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
516
485
|
}
|
|
@@ -519,8 +488,6 @@ class Functions extends Service {
|
|
|
519
488
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
520
489
|
}
|
|
521
490
|
|
|
522
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
523
|
-
let payload = {};
|
|
524
491
|
|
|
525
492
|
return await this.client.call('patch', path, {
|
|
526
493
|
'content-type': 'application/json',
|
|
@@ -538,6 +505,8 @@ class Functions extends Service {
|
|
|
538
505
|
* @returns {Promise}
|
|
539
506
|
*/
|
|
540
507
|
async deleteDeployment(functionId, deploymentId) {
|
|
508
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
509
|
+
let payload = {};
|
|
541
510
|
if (typeof functionId === 'undefined') {
|
|
542
511
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
543
512
|
}
|
|
@@ -546,8 +515,6 @@ class Functions extends Service {
|
|
|
546
515
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
547
516
|
}
|
|
548
517
|
|
|
549
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
550
|
-
let payload = {};
|
|
551
518
|
|
|
552
519
|
return await this.client.call('delete', path, {
|
|
553
520
|
'content-type': 'application/json',
|
|
@@ -564,6 +531,8 @@ class Functions extends Service {
|
|
|
564
531
|
* @returns {Promise}
|
|
565
532
|
*/
|
|
566
533
|
async retryBuild(functionId, deploymentId, buildId) {
|
|
534
|
+
let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
535
|
+
let payload = {};
|
|
567
536
|
if (typeof functionId === 'undefined') {
|
|
568
537
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
569
538
|
}
|
|
@@ -576,8 +545,6 @@ class Functions extends Service {
|
|
|
576
545
|
throw new AppwriteException('Missing required parameter: "buildId"');
|
|
577
546
|
}
|
|
578
547
|
|
|
579
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
580
|
-
let payload = {};
|
|
581
548
|
|
|
582
549
|
return await this.client.call('post', path, {
|
|
583
550
|
'content-type': 'application/json',
|
|
@@ -593,42 +560,27 @@ class Functions extends Service {
|
|
|
593
560
|
* different API modes](/docs/admin).
|
|
594
561
|
*
|
|
595
562
|
* @param {string} functionId
|
|
596
|
-
* @param {
|
|
597
|
-
* @param {number} offset
|
|
563
|
+
* @param {string[]} queries
|
|
598
564
|
* @param {string} search
|
|
599
|
-
* @param {string} cursor
|
|
600
|
-
* @param {string} cursorDirection
|
|
601
565
|
* @throws {AppwriteException}
|
|
602
566
|
* @returns {Promise}
|
|
603
567
|
*/
|
|
604
|
-
async listExecutions(functionId,
|
|
568
|
+
async listExecutions(functionId, queries, search) {
|
|
569
|
+
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
570
|
+
let payload = {};
|
|
605
571
|
if (typeof functionId === 'undefined') {
|
|
606
572
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
607
573
|
}
|
|
608
574
|
|
|
609
|
-
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
610
|
-
let payload = {};
|
|
611
575
|
|
|
612
|
-
if (typeof
|
|
613
|
-
payload['
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
if (typeof offset !== 'undefined') {
|
|
617
|
-
payload['offset'] = offset;
|
|
576
|
+
if (typeof queries !== 'undefined') {
|
|
577
|
+
payload['queries'] = queries;
|
|
618
578
|
}
|
|
619
579
|
|
|
620
580
|
if (typeof search !== 'undefined') {
|
|
621
581
|
payload['search'] = search;
|
|
622
582
|
}
|
|
623
583
|
|
|
624
|
-
if (typeof cursor !== 'undefined') {
|
|
625
|
-
payload['cursor'] = cursor;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
if (typeof cursorDirection !== 'undefined') {
|
|
629
|
-
payload['cursorDirection'] = cursorDirection;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
584
|
return await this.client.call('get', path, {
|
|
633
585
|
'content-type': 'application/json',
|
|
634
586
|
}, payload);
|
|
@@ -649,12 +601,12 @@ class Functions extends Service {
|
|
|
649
601
|
* @returns {Promise}
|
|
650
602
|
*/
|
|
651
603
|
async createExecution(functionId, data, async) {
|
|
604
|
+
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
605
|
+
let payload = {};
|
|
652
606
|
if (typeof functionId === 'undefined') {
|
|
653
607
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
654
608
|
}
|
|
655
609
|
|
|
656
|
-
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
657
|
-
let payload = {};
|
|
658
610
|
|
|
659
611
|
if (typeof data !== 'undefined') {
|
|
660
612
|
payload['data'] = data;
|
|
@@ -680,6 +632,8 @@ class Functions extends Service {
|
|
|
680
632
|
* @returns {Promise}
|
|
681
633
|
*/
|
|
682
634
|
async getExecution(functionId, executionId) {
|
|
635
|
+
let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
636
|
+
let payload = {};
|
|
683
637
|
if (typeof functionId === 'undefined') {
|
|
684
638
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
685
639
|
}
|
|
@@ -688,13 +642,169 @@ class Functions extends Service {
|
|
|
688
642
|
throw new AppwriteException('Missing required parameter: "executionId"');
|
|
689
643
|
}
|
|
690
644
|
|
|
691
|
-
|
|
645
|
+
|
|
646
|
+
return await this.client.call('get', path, {
|
|
647
|
+
'content-type': 'application/json',
|
|
648
|
+
}, payload);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* List Variables
|
|
653
|
+
*
|
|
654
|
+
* Get a list of all variables of a specific function.
|
|
655
|
+
*
|
|
656
|
+
* @param {string} functionId
|
|
657
|
+
* @throws {AppwriteException}
|
|
658
|
+
* @returns {Promise}
|
|
659
|
+
*/
|
|
660
|
+
async listVariables(functionId) {
|
|
661
|
+
let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
662
|
+
let payload = {};
|
|
663
|
+
if (typeof functionId === 'undefined') {
|
|
664
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
665
|
+
}
|
|
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);
|
|
692
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
|
*
|
|
@@ -39,7 +45,7 @@ class Locale extends Service {
|
|
|
39
45
|
* @throws {AppwriteException}
|
|
40
46
|
* @returns {Promise}
|
|
41
47
|
*/
|
|
42
|
-
async
|
|
48
|
+
async listContinents() {
|
|
43
49
|
let path = '/locale/continents';
|
|
44
50
|
let payload = {};
|
|
45
51
|
|
|
@@ -57,7 +63,7 @@ class Locale extends Service {
|
|
|
57
63
|
* @throws {AppwriteException}
|
|
58
64
|
* @returns {Promise}
|
|
59
65
|
*/
|
|
60
|
-
async
|
|
66
|
+
async listCountries() {
|
|
61
67
|
let path = '/locale/countries';
|
|
62
68
|
let payload = {};
|
|
63
69
|
|
|
@@ -75,7 +81,7 @@ class Locale extends Service {
|
|
|
75
81
|
* @throws {AppwriteException}
|
|
76
82
|
* @returns {Promise}
|
|
77
83
|
*/
|
|
78
|
-
async
|
|
84
|
+
async listCountriesEU() {
|
|
79
85
|
let path = '/locale/countries/eu';
|
|
80
86
|
let payload = {};
|
|
81
87
|
|
|
@@ -93,7 +99,7 @@ class Locale extends Service {
|
|
|
93
99
|
* @throws {AppwriteException}
|
|
94
100
|
* @returns {Promise}
|
|
95
101
|
*/
|
|
96
|
-
async
|
|
102
|
+
async listCountriesPhones() {
|
|
97
103
|
let path = '/locale/countries/phones';
|
|
98
104
|
let payload = {};
|
|
99
105
|
|
|
@@ -112,7 +118,7 @@ class Locale extends Service {
|
|
|
112
118
|
* @throws {AppwriteException}
|
|
113
119
|
* @returns {Promise}
|
|
114
120
|
*/
|
|
115
|
-
async
|
|
121
|
+
async listCurrencies() {
|
|
116
122
|
let path = '/locale/currencies';
|
|
117
123
|
let payload = {};
|
|
118
124
|
|
|
@@ -130,7 +136,7 @@ class Locale extends Service {
|
|
|
130
136
|
* @throws {AppwriteException}
|
|
131
137
|
* @returns {Promise}
|
|
132
138
|
*/
|
|
133
|
-
async
|
|
139
|
+
async listLanguages() {
|
|
134
140
|
let path = '/locale/languages';
|
|
135
141
|
let payload = {};
|
|
136
142
|
|
|
@@ -140,4 +146,4 @@ class Locale extends Service {
|
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
|
|
143
|
-
module.exports = Locale;
|
|
149
|
+
module.exports = Locale;
|