@appwrite.io/console 0.3.0 → 0.4.1
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/.github/workflows/publish.yml +2 -2
- package/README.md +3 -3
- package/dist/cjs/sdk.js +1354 -1197
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1354 -1197
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +1354 -1197
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/{projects/get-usage.md → health/get-queue-builds.md} +3 -3
- package/docs/examples/{account/create-with-invite-code.md → health/get-queue-databases.md} +3 -3
- package/docs/examples/health/get-queue-deletes.md +18 -0
- package/docs/examples/health/get-queue-mails.md +18 -0
- package/docs/examples/health/get-queue-messaging.md +18 -0
- package/docs/examples/health/get-queue-migrations.md +18 -0
- package/docs/examples/project/get-usage.md +1 -1
- package/docs/examples/teams/create-membership.md +1 -1
- package/package.json +3 -2
- package/src/client.ts +1 -1
- package/src/models.ts +147 -279
- package/src/query.ts +1 -1
- package/src/role.ts +72 -6
- package/src/services/account.ts +154 -204
- package/src/services/assistant.ts +3 -3
- package/src/services/avatars.ts +32 -31
- package/src/services/console.ts +4 -4
- package/src/services/databases.ts +195 -195
- package/src/services/functions.ts +117 -126
- package/src/services/graphql.ts +8 -8
- package/src/services/health.ts +219 -50
- package/src/services/locale.ts +31 -31
- package/src/services/migrations.ts +48 -48
- package/src/services/project.ts +40 -22
- package/src/services/projects.ts +143 -170
- package/src/services/proxy.ts +15 -15
- package/src/services/storage.ts +74 -84
- package/src/services/teams.ts +62 -66
- package/src/services/users.ts +132 -135
- package/src/services/vcs.ts +27 -27
- package/types/models.d.ts +147 -279
- package/types/role.d.ts +62 -0
- package/types/services/account.d.ts +61 -70
- package/types/services/avatars.d.ts +11 -10
- package/types/services/console.d.ts +1 -1
- package/types/services/databases.d.ts +51 -51
- package/types/services/functions.d.ts +32 -27
- package/types/services/graphql.d.ts +2 -2
- package/types/services/health.d.ts +85 -14
- package/types/services/locale.d.ts +7 -7
- package/types/services/project.d.ts +4 -2
- package/types/services/projects.d.ts +26 -36
- package/types/services/storage.d.ts +13 -13
- package/types/services/teams.d.ts +20 -20
- package/types/services/users.d.ts +45 -44
|
@@ -11,7 +11,7 @@ export class Functions extends Service {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* List
|
|
14
|
+
* List functions
|
|
15
15
|
*
|
|
16
16
|
* Get a list of all the project's functions. You can use the query params to
|
|
17
17
|
* filter your results.
|
|
@@ -22,8 +22,8 @@ export class Functions extends Service {
|
|
|
22
22
|
* @returns {Promise}
|
|
23
23
|
*/
|
|
24
24
|
async list(queries?: string[], search?: string): Promise<Models.FunctionList> {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const apiPath = '/functions';
|
|
26
|
+
const payload: Payload = {};
|
|
27
27
|
|
|
28
28
|
if (typeof queries !== 'undefined') {
|
|
29
29
|
payload['queries'] = queries;
|
|
@@ -33,18 +33,19 @@ export class Functions extends Service {
|
|
|
33
33
|
payload['search'] = search;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const uri = new URL(this.client.config.endpoint +
|
|
36
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
37
37
|
return await this.client.call('get', uri, {
|
|
38
38
|
'content-type': 'application/json',
|
|
39
39
|
}, payload);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Create
|
|
43
|
+
* Create function
|
|
44
44
|
*
|
|
45
45
|
* Create a new function. You can pass a list of
|
|
46
|
-
* [permissions](/docs/permissions) to allow different
|
|
47
|
-
* with access to execute the function using the client
|
|
46
|
+
* [permissions](https://appwrite.io/docs/permissions) to allow different
|
|
47
|
+
* project users or team with access to execute the function using the client
|
|
48
|
+
* API.
|
|
48
49
|
*
|
|
49
50
|
* @param {string} functionId
|
|
50
51
|
* @param {string} name
|
|
@@ -82,8 +83,8 @@ export class Functions extends Service {
|
|
|
82
83
|
throw new AppwriteException('Missing required parameter: "runtime"');
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
const apiPath = '/functions';
|
|
87
|
+
const payload: Payload = {};
|
|
87
88
|
|
|
88
89
|
if (typeof functionId !== 'undefined') {
|
|
89
90
|
payload['functionId'] = functionId;
|
|
@@ -165,7 +166,7 @@ export class Functions extends Service {
|
|
|
165
166
|
payload['templateBranch'] = templateBranch;
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
const uri = new URL(this.client.config.endpoint +
|
|
169
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
169
170
|
return await this.client.call('post', uri, {
|
|
170
171
|
'content-type': 'application/json',
|
|
171
172
|
}, payload);
|
|
@@ -180,17 +181,17 @@ export class Functions extends Service {
|
|
|
180
181
|
* @returns {Promise}
|
|
181
182
|
*/
|
|
182
183
|
async listRuntimes(): Promise<Models.RuntimeList> {
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
const apiPath = '/functions/runtimes';
|
|
185
|
+
const payload: Payload = {};
|
|
185
186
|
|
|
186
|
-
const uri = new URL(this.client.config.endpoint +
|
|
187
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
187
188
|
return await this.client.call('get', uri, {
|
|
188
189
|
'content-type': 'application/json',
|
|
189
190
|
}, payload);
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
/**
|
|
193
|
-
* Get
|
|
194
|
+
* Get functions usage
|
|
194
195
|
*
|
|
195
196
|
*
|
|
196
197
|
* @param {string} range
|
|
@@ -198,21 +199,21 @@ export class Functions extends Service {
|
|
|
198
199
|
* @returns {Promise}
|
|
199
200
|
*/
|
|
200
201
|
async getUsage(range?: string): Promise<Models.UsageFunctions> {
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
const apiPath = '/functions/usage';
|
|
203
|
+
const payload: Payload = {};
|
|
203
204
|
|
|
204
205
|
if (typeof range !== 'undefined') {
|
|
205
206
|
payload['range'] = range;
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
const uri = new URL(this.client.config.endpoint +
|
|
209
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
209
210
|
return await this.client.call('get', uri, {
|
|
210
211
|
'content-type': 'application/json',
|
|
211
212
|
}, payload);
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
/**
|
|
215
|
-
* Get
|
|
216
|
+
* Get function
|
|
216
217
|
*
|
|
217
218
|
* Get a function by its unique ID.
|
|
218
219
|
*
|
|
@@ -225,17 +226,17 @@ export class Functions extends Service {
|
|
|
225
226
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
226
227
|
}
|
|
227
228
|
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
230
|
+
const payload: Payload = {};
|
|
230
231
|
|
|
231
|
-
const uri = new URL(this.client.config.endpoint +
|
|
232
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
232
233
|
return await this.client.call('get', uri, {
|
|
233
234
|
'content-type': 'application/json',
|
|
234
235
|
}, payload);
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
/**
|
|
238
|
-
* Update
|
|
239
|
+
* Update function
|
|
239
240
|
*
|
|
240
241
|
* Update function by its unique ID.
|
|
241
242
|
*
|
|
@@ -258,7 +259,7 @@ export class Functions extends Service {
|
|
|
258
259
|
* @throws {AppwriteException}
|
|
259
260
|
* @returns {Promise}
|
|
260
261
|
*/
|
|
261
|
-
async update(functionId: string, name: string, runtime
|
|
262
|
+
async update(functionId: string, name: string, runtime?: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string): Promise<Models.Function> {
|
|
262
263
|
if (typeof functionId === 'undefined') {
|
|
263
264
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
264
265
|
}
|
|
@@ -267,12 +268,8 @@ export class Functions extends Service {
|
|
|
267
268
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
268
269
|
}
|
|
269
270
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
275
|
-
let payload: Payload = {};
|
|
271
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
272
|
+
const payload: Payload = {};
|
|
276
273
|
|
|
277
274
|
if (typeof name !== 'undefined') {
|
|
278
275
|
payload['name'] = name;
|
|
@@ -334,14 +331,14 @@ export class Functions extends Service {
|
|
|
334
331
|
payload['providerRootDirectory'] = providerRootDirectory;
|
|
335
332
|
}
|
|
336
333
|
|
|
337
|
-
const uri = new URL(this.client.config.endpoint +
|
|
334
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
338
335
|
return await this.client.call('put', uri, {
|
|
339
336
|
'content-type': 'application/json',
|
|
340
337
|
}, payload);
|
|
341
338
|
}
|
|
342
339
|
|
|
343
340
|
/**
|
|
344
|
-
* Delete
|
|
341
|
+
* Delete function
|
|
345
342
|
*
|
|
346
343
|
* Delete a function by its unique ID.
|
|
347
344
|
*
|
|
@@ -354,17 +351,17 @@ export class Functions extends Service {
|
|
|
354
351
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
355
352
|
}
|
|
356
353
|
|
|
357
|
-
|
|
358
|
-
|
|
354
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
355
|
+
const payload: Payload = {};
|
|
359
356
|
|
|
360
|
-
const uri = new URL(this.client.config.endpoint +
|
|
357
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
361
358
|
return await this.client.call('delete', uri, {
|
|
362
359
|
'content-type': 'application/json',
|
|
363
360
|
}, payload);
|
|
364
361
|
}
|
|
365
362
|
|
|
366
363
|
/**
|
|
367
|
-
* List
|
|
364
|
+
* List deployments
|
|
368
365
|
*
|
|
369
366
|
* Get a list of all the project's code deployments. You can use the query
|
|
370
367
|
* params to filter your results.
|
|
@@ -380,8 +377,8 @@ export class Functions extends Service {
|
|
|
380
377
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
381
378
|
}
|
|
382
379
|
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
381
|
+
const payload: Payload = {};
|
|
385
382
|
|
|
386
383
|
if (typeof queries !== 'undefined') {
|
|
387
384
|
payload['queries'] = queries;
|
|
@@ -391,14 +388,14 @@ export class Functions extends Service {
|
|
|
391
388
|
payload['search'] = search;
|
|
392
389
|
}
|
|
393
390
|
|
|
394
|
-
const uri = new URL(this.client.config.endpoint +
|
|
391
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
395
392
|
return await this.client.call('get', uri, {
|
|
396
393
|
'content-type': 'application/json',
|
|
397
394
|
}, payload);
|
|
398
395
|
}
|
|
399
396
|
|
|
400
397
|
/**
|
|
401
|
-
* Create
|
|
398
|
+
* Create deployment
|
|
402
399
|
*
|
|
403
400
|
* Create a new function code deployment. Use this endpoint to upload a new
|
|
404
401
|
* version of your code function. To execute your newly uploaded code, you'll
|
|
@@ -407,7 +404,7 @@ export class Functions extends Service {
|
|
|
407
404
|
* This endpoint accepts a tar.gz file compressed with your code. Make sure to
|
|
408
405
|
* include any dependencies your code has within the compressed file. You can
|
|
409
406
|
* learn more about code packaging in the [Appwrite Cloud Functions
|
|
410
|
-
* tutorial](/docs/functions).
|
|
407
|
+
* tutorial](https://appwrite.io/docs/functions).
|
|
411
408
|
*
|
|
412
409
|
* Use the "command" param to set the entrypoint used to execute your code.
|
|
413
410
|
*
|
|
@@ -432,8 +429,8 @@ export class Functions extends Service {
|
|
|
432
429
|
throw new AppwriteException('Missing required parameter: "activate"');
|
|
433
430
|
}
|
|
434
431
|
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
433
|
+
const payload: Payload = {};
|
|
437
434
|
|
|
438
435
|
if (typeof entrypoint !== 'undefined') {
|
|
439
436
|
payload['entrypoint'] = entrypoint;
|
|
@@ -451,7 +448,7 @@ export class Functions extends Service {
|
|
|
451
448
|
payload['activate'] = activate;
|
|
452
449
|
}
|
|
453
450
|
|
|
454
|
-
const uri = new URL(this.client.config.endpoint +
|
|
451
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
455
452
|
|
|
456
453
|
if(!(code instanceof File)) {
|
|
457
454
|
throw new AppwriteException('Parameter "code" has to be a File.');
|
|
@@ -461,55 +458,45 @@ export class Functions extends Service {
|
|
|
461
458
|
|
|
462
459
|
if (size <= Service.CHUNK_SIZE) {
|
|
463
460
|
return await this.client.call('post', uri, {
|
|
464
|
-
|
|
465
461
|
'content-type': 'multipart/form-data',
|
|
466
462
|
}, payload);
|
|
467
463
|
}
|
|
468
|
-
let id = undefined;
|
|
469
|
-
let response = undefined;
|
|
470
464
|
|
|
471
|
-
const
|
|
465
|
+
const apiHeaders: { [header: string]: string } = {
|
|
472
466
|
'content-type': 'multipart/form-data',
|
|
473
467
|
}
|
|
474
468
|
|
|
475
|
-
let
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
for (counter; counter < totalCounters; counter++) {
|
|
479
|
-
const start = (counter * Service.CHUNK_SIZE);
|
|
480
|
-
const end = Math.min((((counter * Service.CHUNK_SIZE) + Service.CHUNK_SIZE) - 1), size);
|
|
469
|
+
let offset = 0;
|
|
470
|
+
let response = undefined;
|
|
481
471
|
|
|
482
|
-
|
|
472
|
+
while (offset < size) {
|
|
473
|
+
let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
|
|
483
474
|
|
|
484
|
-
|
|
485
|
-
|
|
475
|
+
apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
|
|
476
|
+
if (response && response.$id) {
|
|
477
|
+
apiHeaders['x-appwrite-id'] = response.$id;
|
|
486
478
|
}
|
|
487
479
|
|
|
488
|
-
const
|
|
489
|
-
payload['code'] = new File([
|
|
490
|
-
|
|
491
|
-
response = await this.client.call('post', uri, headers, payload);
|
|
492
|
-
|
|
493
|
-
if (!id) {
|
|
494
|
-
id = response['$id'];
|
|
495
|
-
}
|
|
480
|
+
const chunk = code.slice(offset, end + 1);
|
|
481
|
+
payload['code'] = new File([chunk], code.name);
|
|
482
|
+
response = await this.client.call('post', uri, apiHeaders, payload);
|
|
496
483
|
|
|
497
484
|
if (onProgress) {
|
|
498
485
|
onProgress({
|
|
499
486
|
$id: response.$id,
|
|
500
|
-
progress:
|
|
501
|
-
sizeUploaded:
|
|
487
|
+
progress: (offset / size) * 100,
|
|
488
|
+
sizeUploaded: offset,
|
|
502
489
|
chunksTotal: response.chunksTotal,
|
|
503
490
|
chunksUploaded: response.chunksUploaded
|
|
504
491
|
});
|
|
505
492
|
}
|
|
493
|
+
offset += Service.CHUNK_SIZE;
|
|
506
494
|
}
|
|
507
|
-
|
|
508
495
|
return response;
|
|
509
496
|
}
|
|
510
497
|
|
|
511
498
|
/**
|
|
512
|
-
* Get
|
|
499
|
+
* Get deployment
|
|
513
500
|
*
|
|
514
501
|
* Get a code deployment by its unique ID.
|
|
515
502
|
*
|
|
@@ -527,17 +514,17 @@ export class Functions extends Service {
|
|
|
527
514
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
528
515
|
}
|
|
529
516
|
|
|
530
|
-
|
|
531
|
-
|
|
517
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
518
|
+
const payload: Payload = {};
|
|
532
519
|
|
|
533
|
-
const uri = new URL(this.client.config.endpoint +
|
|
520
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
534
521
|
return await this.client.call('get', uri, {
|
|
535
522
|
'content-type': 'application/json',
|
|
536
523
|
}, payload);
|
|
537
524
|
}
|
|
538
525
|
|
|
539
526
|
/**
|
|
540
|
-
* Update
|
|
527
|
+
* Update function deployment
|
|
541
528
|
*
|
|
542
529
|
* Update the function code deployment ID using the unique function ID. Use
|
|
543
530
|
* this endpoint to switch the code deployment that should be executed by the
|
|
@@ -557,17 +544,17 @@ export class Functions extends Service {
|
|
|
557
544
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
558
545
|
}
|
|
559
546
|
|
|
560
|
-
|
|
561
|
-
|
|
547
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
548
|
+
const payload: Payload = {};
|
|
562
549
|
|
|
563
|
-
const uri = new URL(this.client.config.endpoint +
|
|
550
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
564
551
|
return await this.client.call('patch', uri, {
|
|
565
552
|
'content-type': 'application/json',
|
|
566
553
|
}, payload);
|
|
567
554
|
}
|
|
568
555
|
|
|
569
556
|
/**
|
|
570
|
-
* Delete
|
|
557
|
+
* Delete deployment
|
|
571
558
|
*
|
|
572
559
|
* Delete a code deployment by its unique ID.
|
|
573
560
|
*
|
|
@@ -585,18 +572,20 @@ export class Functions extends Service {
|
|
|
585
572
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
586
573
|
}
|
|
587
574
|
|
|
588
|
-
|
|
589
|
-
|
|
575
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
576
|
+
const payload: Payload = {};
|
|
590
577
|
|
|
591
|
-
const uri = new URL(this.client.config.endpoint +
|
|
578
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
592
579
|
return await this.client.call('delete', uri, {
|
|
593
580
|
'content-type': 'application/json',
|
|
594
581
|
}, payload);
|
|
595
582
|
}
|
|
596
583
|
|
|
597
584
|
/**
|
|
598
|
-
* Create
|
|
585
|
+
* Create build
|
|
599
586
|
*
|
|
587
|
+
* Create a new build for an Appwrite Function deployment. This endpoint can
|
|
588
|
+
* be used to retry a failed build.
|
|
600
589
|
*
|
|
601
590
|
* @param {string} functionId
|
|
602
591
|
* @param {string} deploymentId
|
|
@@ -617,10 +606,10 @@ export class Functions extends Service {
|
|
|
617
606
|
throw new AppwriteException('Missing required parameter: "buildId"');
|
|
618
607
|
}
|
|
619
608
|
|
|
620
|
-
|
|
621
|
-
|
|
609
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
610
|
+
const payload: Payload = {};
|
|
622
611
|
|
|
623
|
-
const uri = new URL(this.client.config.endpoint +
|
|
612
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
624
613
|
return await this.client.call('post', uri, {
|
|
625
614
|
'content-type': 'application/json',
|
|
626
615
|
}, payload);
|
|
@@ -629,6 +618,8 @@ export class Functions extends Service {
|
|
|
629
618
|
/**
|
|
630
619
|
* Download Deployment
|
|
631
620
|
*
|
|
621
|
+
* Get a Deployment's contents by its unique ID. This endpoint supports range
|
|
622
|
+
* requests for partial or streaming file download.
|
|
632
623
|
*
|
|
633
624
|
* @param {string} functionId
|
|
634
625
|
* @param {string} deploymentId
|
|
@@ -644,10 +635,10 @@ export class Functions extends Service {
|
|
|
644
635
|
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
645
636
|
}
|
|
646
637
|
|
|
647
|
-
|
|
648
|
-
|
|
638
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
639
|
+
const payload: Payload = {};
|
|
649
640
|
|
|
650
|
-
const uri = new URL(this.client.config.endpoint +
|
|
641
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
651
642
|
payload['project'] = this.client.config.project;
|
|
652
643
|
|
|
653
644
|
|
|
@@ -658,7 +649,7 @@ export class Functions extends Service {
|
|
|
658
649
|
}
|
|
659
650
|
|
|
660
651
|
/**
|
|
661
|
-
* List
|
|
652
|
+
* List executions
|
|
662
653
|
*
|
|
663
654
|
* Get a list of all the current user function execution logs. You can use the
|
|
664
655
|
* query params to filter your results.
|
|
@@ -674,8 +665,8 @@ export class Functions extends Service {
|
|
|
674
665
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
675
666
|
}
|
|
676
667
|
|
|
677
|
-
|
|
678
|
-
|
|
668
|
+
const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
669
|
+
const payload: Payload = {};
|
|
679
670
|
|
|
680
671
|
if (typeof queries !== 'undefined') {
|
|
681
672
|
payload['queries'] = queries;
|
|
@@ -685,14 +676,14 @@ export class Functions extends Service {
|
|
|
685
676
|
payload['search'] = search;
|
|
686
677
|
}
|
|
687
678
|
|
|
688
|
-
const uri = new URL(this.client.config.endpoint +
|
|
679
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
689
680
|
return await this.client.call('get', uri, {
|
|
690
681
|
'content-type': 'application/json',
|
|
691
682
|
}, payload);
|
|
692
683
|
}
|
|
693
684
|
|
|
694
685
|
/**
|
|
695
|
-
* Create
|
|
686
|
+
* Create execution
|
|
696
687
|
*
|
|
697
688
|
* Trigger a function execution. The returned object will return you the
|
|
698
689
|
* current execution status. You can ping the `Get Execution` endpoint to get
|
|
@@ -702,19 +693,19 @@ export class Functions extends Service {
|
|
|
702
693
|
* @param {string} functionId
|
|
703
694
|
* @param {string} body
|
|
704
695
|
* @param {boolean} async
|
|
705
|
-
* @param {string}
|
|
696
|
+
* @param {string} xpath
|
|
706
697
|
* @param {string} method
|
|
707
698
|
* @param {object} headers
|
|
708
699
|
* @throws {AppwriteException}
|
|
709
700
|
* @returns {Promise}
|
|
710
701
|
*/
|
|
711
|
-
async createExecution(functionId: string, body?: string, async?: boolean,
|
|
702
|
+
async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: string, headers?: object): Promise<Models.Execution> {
|
|
712
703
|
if (typeof functionId === 'undefined') {
|
|
713
704
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
714
705
|
}
|
|
715
706
|
|
|
716
|
-
|
|
717
|
-
|
|
707
|
+
const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
708
|
+
const payload: Payload = {};
|
|
718
709
|
|
|
719
710
|
if (typeof body !== 'undefined') {
|
|
720
711
|
payload['body'] = body;
|
|
@@ -724,8 +715,8 @@ export class Functions extends Service {
|
|
|
724
715
|
payload['async'] = async;
|
|
725
716
|
}
|
|
726
717
|
|
|
727
|
-
if (typeof
|
|
728
|
-
payload['path'] =
|
|
718
|
+
if (typeof xpath !== 'undefined') {
|
|
719
|
+
payload['path'] = xpath;
|
|
729
720
|
}
|
|
730
721
|
|
|
731
722
|
if (typeof method !== 'undefined') {
|
|
@@ -736,14 +727,14 @@ export class Functions extends Service {
|
|
|
736
727
|
payload['headers'] = headers;
|
|
737
728
|
}
|
|
738
729
|
|
|
739
|
-
const uri = new URL(this.client.config.endpoint +
|
|
730
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
740
731
|
return await this.client.call('post', uri, {
|
|
741
732
|
'content-type': 'application/json',
|
|
742
733
|
}, payload);
|
|
743
734
|
}
|
|
744
735
|
|
|
745
736
|
/**
|
|
746
|
-
* Get
|
|
737
|
+
* Get execution
|
|
747
738
|
*
|
|
748
739
|
* Get a function execution log by its unique ID.
|
|
749
740
|
*
|
|
@@ -761,17 +752,17 @@ export class Functions extends Service {
|
|
|
761
752
|
throw new AppwriteException('Missing required parameter: "executionId"');
|
|
762
753
|
}
|
|
763
754
|
|
|
764
|
-
|
|
765
|
-
|
|
755
|
+
const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
756
|
+
const payload: Payload = {};
|
|
766
757
|
|
|
767
|
-
const uri = new URL(this.client.config.endpoint +
|
|
758
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
768
759
|
return await this.client.call('get', uri, {
|
|
769
760
|
'content-type': 'application/json',
|
|
770
761
|
}, payload);
|
|
771
762
|
}
|
|
772
763
|
|
|
773
764
|
/**
|
|
774
|
-
* Get
|
|
765
|
+
* Get function usage
|
|
775
766
|
*
|
|
776
767
|
*
|
|
777
768
|
* @param {string} functionId
|
|
@@ -784,21 +775,21 @@ export class Functions extends Service {
|
|
|
784
775
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
785
776
|
}
|
|
786
777
|
|
|
787
|
-
|
|
788
|
-
|
|
778
|
+
const apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
|
|
779
|
+
const payload: Payload = {};
|
|
789
780
|
|
|
790
781
|
if (typeof range !== 'undefined') {
|
|
791
782
|
payload['range'] = range;
|
|
792
783
|
}
|
|
793
784
|
|
|
794
|
-
const uri = new URL(this.client.config.endpoint +
|
|
785
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
795
786
|
return await this.client.call('get', uri, {
|
|
796
787
|
'content-type': 'application/json',
|
|
797
788
|
}, payload);
|
|
798
789
|
}
|
|
799
790
|
|
|
800
791
|
/**
|
|
801
|
-
* List
|
|
792
|
+
* List variables
|
|
802
793
|
*
|
|
803
794
|
* Get a list of all variables of a specific function.
|
|
804
795
|
*
|
|
@@ -811,17 +802,17 @@ export class Functions extends Service {
|
|
|
811
802
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
812
803
|
}
|
|
813
804
|
|
|
814
|
-
|
|
815
|
-
|
|
805
|
+
const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
806
|
+
const payload: Payload = {};
|
|
816
807
|
|
|
817
|
-
const uri = new URL(this.client.config.endpoint +
|
|
808
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
818
809
|
return await this.client.call('get', uri, {
|
|
819
810
|
'content-type': 'application/json',
|
|
820
811
|
}, payload);
|
|
821
812
|
}
|
|
822
813
|
|
|
823
814
|
/**
|
|
824
|
-
* Create
|
|
815
|
+
* Create variable
|
|
825
816
|
*
|
|
826
817
|
* Create a new function environment variable. These variables can be accessed
|
|
827
818
|
* in the function at runtime as environment variables.
|
|
@@ -845,8 +836,8 @@ export class Functions extends Service {
|
|
|
845
836
|
throw new AppwriteException('Missing required parameter: "value"');
|
|
846
837
|
}
|
|
847
838
|
|
|
848
|
-
|
|
849
|
-
|
|
839
|
+
const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
840
|
+
const payload: Payload = {};
|
|
850
841
|
|
|
851
842
|
if (typeof key !== 'undefined') {
|
|
852
843
|
payload['key'] = key;
|
|
@@ -856,14 +847,14 @@ export class Functions extends Service {
|
|
|
856
847
|
payload['value'] = value;
|
|
857
848
|
}
|
|
858
849
|
|
|
859
|
-
const uri = new URL(this.client.config.endpoint +
|
|
850
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
860
851
|
return await this.client.call('post', uri, {
|
|
861
852
|
'content-type': 'application/json',
|
|
862
853
|
}, payload);
|
|
863
854
|
}
|
|
864
855
|
|
|
865
856
|
/**
|
|
866
|
-
* Get
|
|
857
|
+
* Get variable
|
|
867
858
|
*
|
|
868
859
|
* Get a variable by its unique ID.
|
|
869
860
|
*
|
|
@@ -881,17 +872,17 @@ export class Functions extends Service {
|
|
|
881
872
|
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
882
873
|
}
|
|
883
874
|
|
|
884
|
-
|
|
885
|
-
|
|
875
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
876
|
+
const payload: Payload = {};
|
|
886
877
|
|
|
887
|
-
const uri = new URL(this.client.config.endpoint +
|
|
878
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
888
879
|
return await this.client.call('get', uri, {
|
|
889
880
|
'content-type': 'application/json',
|
|
890
881
|
}, payload);
|
|
891
882
|
}
|
|
892
883
|
|
|
893
884
|
/**
|
|
894
|
-
* Update
|
|
885
|
+
* Update variable
|
|
895
886
|
*
|
|
896
887
|
* Update variable by its unique ID.
|
|
897
888
|
*
|
|
@@ -915,8 +906,8 @@ export class Functions extends Service {
|
|
|
915
906
|
throw new AppwriteException('Missing required parameter: "key"');
|
|
916
907
|
}
|
|
917
908
|
|
|
918
|
-
|
|
919
|
-
|
|
909
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
910
|
+
const payload: Payload = {};
|
|
920
911
|
|
|
921
912
|
if (typeof key !== 'undefined') {
|
|
922
913
|
payload['key'] = key;
|
|
@@ -926,14 +917,14 @@ export class Functions extends Service {
|
|
|
926
917
|
payload['value'] = value;
|
|
927
918
|
}
|
|
928
919
|
|
|
929
|
-
const uri = new URL(this.client.config.endpoint +
|
|
920
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
930
921
|
return await this.client.call('put', uri, {
|
|
931
922
|
'content-type': 'application/json',
|
|
932
923
|
}, payload);
|
|
933
924
|
}
|
|
934
925
|
|
|
935
926
|
/**
|
|
936
|
-
* Delete
|
|
927
|
+
* Delete variable
|
|
937
928
|
*
|
|
938
929
|
* Delete a variable by its unique ID.
|
|
939
930
|
*
|
|
@@ -951,10 +942,10 @@ export class Functions extends Service {
|
|
|
951
942
|
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
952
943
|
}
|
|
953
944
|
|
|
954
|
-
|
|
955
|
-
|
|
945
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
946
|
+
const payload: Payload = {};
|
|
956
947
|
|
|
957
|
-
const uri = new URL(this.client.config.endpoint +
|
|
948
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
958
949
|
return await this.client.call('delete', uri, {
|
|
959
950
|
'content-type': 'application/json',
|
|
960
951
|
}, payload);
|