@appwrite.io/console 0.2.0 → 0.4.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/README.md +3 -3
- package/dist/cjs/sdk.js +3353 -1497
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +3350 -1498
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +3353 -1497
- package/docs/examples/account/create-anonymous-session.md +1 -1
- package/docs/examples/account/create-email-session.md +1 -1
- package/docs/examples/account/create-j-w-t.md +1 -1
- package/docs/examples/account/create-magic-u-r-l-session.md +1 -1
- package/docs/examples/account/create-o-auth2session.md +1 -1
- package/docs/examples/account/create-phone-session.md +1 -1
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-recovery.md +1 -1
- package/docs/examples/account/create-verification.md +1 -1
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/{create-with-invite-code.md → delete-identity.md} +2 -2
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/get.md +1 -1
- package/docs/examples/account/list-identities.md +18 -0
- package/docs/examples/account/list-logs.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +1 -1
- package/docs/examples/account/update-magic-u-r-l-session.md +1 -1
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-password.md +1 -1
- package/docs/examples/account/update-phone-session.md +1 -1
- package/docs/examples/account/update-phone-verification.md +1 -1
- package/docs/examples/account/update-phone.md +1 -1
- package/docs/examples/account/update-prefs.md +1 -1
- package/docs/examples/account/update-recovery.md +1 -1
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +1 -1
- package/docs/examples/assistant/chat.md +18 -0
- package/docs/examples/avatars/get-browser.md +1 -1
- package/docs/examples/avatars/get-credit-card.md +1 -1
- package/docs/examples/avatars/get-favicon.md +1 -1
- package/docs/examples/avatars/get-flag.md +1 -1
- package/docs/examples/avatars/get-image.md +1 -1
- package/docs/examples/avatars/get-initials.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/console/variables.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +1 -1
- package/docs/examples/databases/create-collection.md +1 -1
- package/docs/examples/databases/create-datetime-attribute.md +1 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/create-email-attribute.md +1 -1
- package/docs/examples/databases/create-enum-attribute.md +1 -1
- package/docs/examples/databases/create-float-attribute.md +1 -1
- package/docs/examples/databases/create-index.md +1 -1
- package/docs/examples/databases/create-integer-attribute.md +1 -1
- package/docs/examples/databases/create-ip-attribute.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +1 -1
- package/docs/examples/databases/create-string-attribute.md +1 -1
- package/docs/examples/databases/create-url-attribute.md +1 -1
- package/docs/examples/databases/create.md +1 -1
- package/docs/examples/databases/delete-attribute.md +1 -1
- package/docs/examples/databases/delete-collection.md +1 -1
- package/docs/examples/databases/delete-document.md +1 -1
- package/docs/examples/databases/delete-index.md +1 -1
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +1 -1
- package/docs/examples/databases/get-collection-usage.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-database-usage.md +1 -1
- package/docs/examples/databases/get-document.md +1 -1
- package/docs/examples/databases/get-index.md +1 -1
- package/docs/examples/databases/get-usage.md +1 -1
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +1 -1
- package/docs/examples/databases/list-collection-logs.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-document-logs.md +1 -1
- package/docs/examples/databases/list-documents.md +1 -1
- package/docs/examples/databases/list-indexes.md +1 -1
- package/docs/examples/databases/list-logs.md +1 -1
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +1 -1
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +1 -1
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +1 -1
- package/docs/examples/databases/update-enum-attribute.md +1 -1
- package/docs/examples/databases/update-float-attribute.md +1 -1
- package/docs/examples/databases/update-integer-attribute.md +1 -1
- package/docs/examples/databases/update-ip-attribute.md +1 -1
- package/docs/examples/databases/update-relationship-attribute.md +1 -1
- package/docs/examples/databases/update-string-attribute.md +1 -1
- package/docs/examples/databases/update-url-attribute.md +1 -1
- package/docs/examples/databases/update.md +1 -1
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-deployment.md +2 -2
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +1 -1
- package/docs/examples/functions/create.md +2 -2
- package/docs/examples/functions/delete-deployment.md +1 -1
- package/docs/examples/functions/delete-variable.md +1 -1
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +14 -0
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-function-usage.md +1 -1
- package/docs/examples/functions/get-usage.md +1 -1
- package/docs/examples/functions/get-variable.md +1 -1
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/list.md +1 -1
- package/docs/examples/functions/update-deployment.md +1 -1
- package/docs/examples/functions/update-variable.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-d-b.md +1 -1
- package/docs/examples/health/get-pub-sub.md +1 -1
- package/docs/examples/health/get-queue-builds.md +18 -0
- package/docs/examples/health/get-queue-certificates.md +1 -1
- package/docs/examples/health/get-queue-databases.md +18 -0
- package/docs/examples/health/get-queue-deletes.md +18 -0
- package/docs/examples/health/get-queue-functions.md +1 -1
- package/docs/examples/health/get-queue-logs.md +1 -1
- 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/health/get-queue-webhooks.md +1 -1
- package/docs/examples/health/get-queue.md +1 -1
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/health/get.md +1 -1
- package/docs/examples/locale/get.md +1 -1
- package/docs/examples/locale/list-codes.md +18 -0
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-e-u.md +1 -1
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/migrations/create-appwrite-migration.md +18 -0
- package/docs/examples/migrations/create-firebase-migration.md +18 -0
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +18 -0
- package/docs/examples/migrations/create-n-host-migration.md +18 -0
- package/docs/examples/migrations/create-supabase-migration.md +18 -0
- package/docs/examples/migrations/delete-firebase-auth.md +18 -0
- package/docs/examples/migrations/delete.md +18 -0
- package/docs/examples/migrations/get-appwrite-report.md +18 -0
- package/docs/examples/migrations/get-firebase-report-o-auth.md +18 -0
- package/docs/examples/migrations/get-firebase-report.md +18 -0
- package/docs/examples/migrations/get-n-host-report.md +18 -0
- package/docs/examples/migrations/get-supabase-report.md +18 -0
- package/docs/examples/migrations/get.md +18 -0
- package/docs/examples/migrations/list-firebase-projects.md +18 -0
- package/docs/examples/migrations/list.md +18 -0
- package/docs/examples/migrations/retry.md +18 -0
- package/docs/examples/project/create-variable.md +18 -0
- package/docs/examples/project/delete-variable.md +18 -0
- package/docs/examples/project/get-usage.md +2 -2
- package/docs/examples/project/get-variable.md +18 -0
- package/docs/examples/project/list-variables.md +18 -0
- package/docs/examples/project/update-variable.md +18 -0
- package/docs/examples/projects/create-key.md +1 -1
- package/docs/examples/projects/create-platform.md +1 -1
- package/docs/examples/projects/create-webhook.md +1 -1
- package/docs/examples/projects/create.md +2 -2
- package/docs/examples/projects/delete-email-template.md +18 -0
- package/docs/examples/projects/delete-key.md +1 -1
- package/docs/examples/projects/delete-platform.md +1 -1
- package/docs/examples/projects/delete-sms-template.md +18 -0
- package/docs/examples/projects/delete-webhook.md +1 -1
- package/docs/examples/projects/delete.md +2 -2
- package/docs/examples/projects/get-email-template.md +18 -0
- package/docs/examples/projects/get-key.md +1 -1
- package/docs/examples/projects/get-platform.md +1 -1
- package/docs/examples/projects/get-sms-template.md +18 -0
- package/docs/examples/projects/get-webhook.md +1 -1
- package/docs/examples/projects/get.md +1 -1
- package/docs/examples/projects/list-keys.md +1 -1
- package/docs/examples/projects/list-platforms.md +1 -1
- package/docs/examples/projects/list-webhooks.md +1 -1
- package/docs/examples/projects/list.md +1 -1
- package/docs/examples/projects/update-auth-duration.md +1 -1
- package/docs/examples/projects/update-auth-limit.md +1 -1
- package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
- package/docs/examples/projects/update-auth-password-history.md +1 -1
- package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
- package/docs/examples/projects/update-auth-status.md +1 -1
- package/docs/examples/projects/update-email-template.md +18 -0
- package/docs/examples/projects/update-key.md +1 -1
- package/docs/examples/projects/update-o-auth2.md +1 -1
- package/docs/examples/projects/{delete-domain.md → update-personal-data-check.md} +2 -2
- package/docs/examples/projects/update-platform.md +1 -1
- package/docs/examples/projects/{create-domain.md → update-service-status-all.md} +2 -2
- package/docs/examples/projects/update-service-status.md +1 -1
- package/docs/examples/projects/update-sms-template.md +18 -0
- package/docs/examples/projects/{get-domain.md → update-smtp-configuration.md} +2 -2
- package/docs/examples/projects/{list-domains.md → update-team.md} +2 -2
- package/docs/examples/projects/update-webhook-signature.md +1 -1
- package/docs/examples/projects/update-webhook.md +1 -1
- package/docs/examples/projects/update.md +1 -1
- package/docs/examples/proxy/create-rule.md +18 -0
- package/docs/examples/proxy/delete-rule.md +18 -0
- package/docs/examples/proxy/get-rule.md +18 -0
- package/docs/examples/proxy/list-rules.md +18 -0
- package/docs/examples/proxy/update-rule-verification.md +18 -0
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +1 -1
- package/docs/examples/storage/get-bucket-usage.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file-download.md +1 -1
- package/docs/examples/storage/get-file-preview.md +1 -1
- package/docs/examples/storage/get-file-view.md +1 -1
- package/docs/examples/storage/get-file.md +1 -1
- package/docs/examples/storage/get-usage.md +1 -1
- package/docs/examples/storage/list-buckets.md +1 -1
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/teams/create-membership.md +2 -2
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/delete-membership.md +1 -1
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +1 -1
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-logs.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/list.md +1 -1
- package/docs/examples/teams/update-membership-status.md +1 -1
- package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
- package/docs/examples/teams/update-name.md +1 -1
- package/docs/examples/teams/update-prefs.md +1 -1
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +1 -1
- package/docs/examples/users/create-scrypt-user.md +1 -1
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +18 -0
- package/docs/examples/users/delete-session.md +1 -1
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get-usage.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +18 -0
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list.md +1 -1
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +18 -0
- package/docs/examples/users/update-name.md +1 -1
- package/docs/examples/users/update-password.md +1 -1
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/docs/examples/vcs/create-repository-detection.md +18 -0
- package/docs/examples/vcs/create-repository.md +18 -0
- package/docs/examples/vcs/delete-installation.md +18 -0
- package/docs/examples/vcs/get-installation.md +18 -0
- package/docs/examples/vcs/get-repository.md +18 -0
- package/docs/examples/vcs/list-installations.md +18 -0
- package/docs/examples/vcs/list-repositories.md +18 -0
- package/docs/examples/vcs/list-repository-branches.md +18 -0
- package/docs/examples/vcs/update-external-deployments.md +18 -0
- package/package.json +3 -2
- package/src/client.ts +2 -2
- package/src/index.ts +4 -0
- package/src/models.ts +863 -233
- package/src/query.ts +1 -1
- package/src/role.ts +72 -6
- package/src/services/account.ts +1052 -1055
- package/src/services/assistant.ts +38 -0
- package/src/services/avatars.ts +338 -337
- package/src/services/console.ts +16 -16
- package/src/services/databases.ts +2170 -2140
- package/src/services/functions.ts +804 -657
- package/src/services/graphql.ts +47 -47
- package/src/services/health.ts +373 -204
- package/src/services/locale.ts +156 -137
- package/src/services/migrations.ts +707 -0
- package/src/services/project.ts +178 -20
- package/src/services/projects.ts +1511 -1256
- package/src/services/proxy.ts +150 -0
- package/src/services/storage.ts +572 -577
- package/src/services/teams.ts +498 -501
- package/src/services/users.ts +1091 -1001
- package/src/services/vcs.ts +272 -0
- package/types/index.d.ts +4 -0
- package/types/models.d.ts +863 -233
- package/types/role.d.ts +62 -0
- package/types/services/account.d.ts +116 -104
- package/types/services/assistant.d.ts +14 -0
- package/types/services/avatars.d.ts +18 -17
- package/types/services/console.d.ts +2 -2
- package/types/services/databases.d.ts +111 -105
- package/types/services/functions.d.ts +95 -55
- package/types/services/graphql.d.ts +4 -4
- package/types/services/health.d.ts +97 -26
- package/types/services/locale.d.ts +24 -14
- package/types/services/migrations.d.ts +185 -0
- package/types/services/project.d.ts +60 -3
- package/types/services/projects.d.ts +174 -104
- package/types/services/proxy.d.ts +59 -0
- package/types/services/storage.d.ts +29 -28
- package/types/services/teams.d.ts +36 -35
- package/types/services/users.d.ts +105 -66
- package/types/services/vcs.d.ts +97 -0
- package/docs/examples/projects/update-domain-verification.md +0 -18
|
@@ -10,797 +10,944 @@ export class Functions extends Service {
|
|
|
10
10
|
super(client);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (typeof search !== 'undefined') {
|
|
33
|
-
payload['search'] = search;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
37
|
-
return await this.client.call('get', uri, {
|
|
38
|
-
'content-type': 'application/json',
|
|
39
|
-
}, payload);
|
|
13
|
+
/**
|
|
14
|
+
* List functions
|
|
15
|
+
*
|
|
16
|
+
* Get a list of all the project's functions. You can use the query params to
|
|
17
|
+
* filter your results.
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} queries
|
|
20
|
+
* @param {string} search
|
|
21
|
+
* @throws {AppwriteException}
|
|
22
|
+
* @returns {Promise}
|
|
23
|
+
*/
|
|
24
|
+
async list(queries?: string[], search?: string): Promise<Models.FunctionList> {
|
|
25
|
+
const apiPath = '/functions';
|
|
26
|
+
const payload: Payload = {};
|
|
27
|
+
|
|
28
|
+
if (typeof queries !== 'undefined') {
|
|
29
|
+
payload['queries'] = queries;
|
|
40
30
|
}
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* Create a new function. You can pass a list of
|
|
46
|
-
* [permissions](/docs/permissions) to allow different project users or team
|
|
47
|
-
* with access to execute the function using the client API.
|
|
48
|
-
*
|
|
49
|
-
* @param {string} functionId
|
|
50
|
-
* @param {string} name
|
|
51
|
-
* @param {string} runtime
|
|
52
|
-
* @param {string[]} execute
|
|
53
|
-
* @param {string[]} events
|
|
54
|
-
* @param {string} schedule
|
|
55
|
-
* @param {number} timeout
|
|
56
|
-
* @param {boolean} enabled
|
|
57
|
-
* @throws {AppwriteException}
|
|
58
|
-
* @returns {Promise}
|
|
59
|
-
*/
|
|
60
|
-
async create(functionId: string, name: string, runtime: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function> {
|
|
61
|
-
if (typeof functionId === 'undefined') {
|
|
62
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (typeof name === 'undefined') {
|
|
66
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
67
|
-
}
|
|
32
|
+
if (typeof search !== 'undefined') {
|
|
33
|
+
payload['search'] = search;
|
|
34
|
+
}
|
|
68
35
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
36
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
37
|
+
return await this.client.call('get', uri, {
|
|
38
|
+
'content-type': 'application/json',
|
|
39
|
+
}, payload);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Create function
|
|
44
|
+
*
|
|
45
|
+
* Create a new function. You can pass a list of
|
|
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.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} functionId
|
|
51
|
+
* @param {string} name
|
|
52
|
+
* @param {string} runtime
|
|
53
|
+
* @param {string[]} execute
|
|
54
|
+
* @param {string[]} events
|
|
55
|
+
* @param {string} schedule
|
|
56
|
+
* @param {number} timeout
|
|
57
|
+
* @param {boolean} enabled
|
|
58
|
+
* @param {boolean} logging
|
|
59
|
+
* @param {string} entrypoint
|
|
60
|
+
* @param {string} commands
|
|
61
|
+
* @param {string} installationId
|
|
62
|
+
* @param {string} providerRepositoryId
|
|
63
|
+
* @param {string} providerBranch
|
|
64
|
+
* @param {boolean} providerSilentMode
|
|
65
|
+
* @param {string} providerRootDirectory
|
|
66
|
+
* @param {string} templateRepository
|
|
67
|
+
* @param {string} templateOwner
|
|
68
|
+
* @param {string} templateRootDirectory
|
|
69
|
+
* @param {string} templateBranch
|
|
70
|
+
* @throws {AppwriteException}
|
|
71
|
+
* @returns {Promise}
|
|
72
|
+
*/
|
|
73
|
+
async create(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, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateBranch?: string): Promise<Models.Function> {
|
|
74
|
+
if (typeof functionId === 'undefined') {
|
|
75
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
76
|
+
}
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
if (typeof name === 'undefined') {
|
|
79
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
80
|
+
}
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
if (typeof runtime === 'undefined') {
|
|
83
|
+
throw new AppwriteException('Missing required parameter: "runtime"');
|
|
84
|
+
}
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
86
|
+
const apiPath = '/functions';
|
|
87
|
+
const payload: Payload = {};
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
if (typeof functionId !== 'undefined') {
|
|
90
|
+
payload['functionId'] = functionId;
|
|
91
|
+
}
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
if (typeof name !== 'undefined') {
|
|
94
|
+
payload['name'] = name;
|
|
95
|
+
}
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
if (typeof runtime !== 'undefined') {
|
|
98
|
+
payload['runtime'] = runtime;
|
|
99
|
+
}
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
if (typeof execute !== 'undefined') {
|
|
102
|
+
payload['execute'] = execute;
|
|
103
|
+
}
|
|
99
104
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
if (typeof events !== 'undefined') {
|
|
106
|
+
payload['events'] = events;
|
|
107
|
+
}
|
|
103
108
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
if (typeof schedule !== 'undefined') {
|
|
110
|
+
payload['schedule'] = schedule;
|
|
111
|
+
}
|
|
107
112
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
'content-type': 'application/json',
|
|
111
|
-
}, payload);
|
|
113
|
+
if (typeof timeout !== 'undefined') {
|
|
114
|
+
payload['timeout'] = timeout;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
*
|
|
117
|
-
* Get a list of all runtimes that are currently active on your instance.
|
|
118
|
-
*
|
|
119
|
-
* @throws {AppwriteException}
|
|
120
|
-
* @returns {Promise}
|
|
121
|
-
*/
|
|
122
|
-
async listRuntimes(): Promise<Models.RuntimeList> {
|
|
123
|
-
let path = '/functions/runtimes';
|
|
124
|
-
let payload: Payload = {};
|
|
125
|
-
|
|
126
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
127
|
-
return await this.client.call('get', uri, {
|
|
128
|
-
'content-type': 'application/json',
|
|
129
|
-
}, payload);
|
|
117
|
+
if (typeof enabled !== 'undefined') {
|
|
118
|
+
payload['enabled'] = enabled;
|
|
130
119
|
}
|
|
131
120
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*
|
|
136
|
-
* @param {string} range
|
|
137
|
-
* @throws {AppwriteException}
|
|
138
|
-
* @returns {Promise}
|
|
139
|
-
*/
|
|
140
|
-
async getUsage(range?: string): Promise<Models.UsageFunctions> {
|
|
141
|
-
let path = '/functions/usage';
|
|
142
|
-
let payload: Payload = {};
|
|
143
|
-
|
|
144
|
-
if (typeof range !== 'undefined') {
|
|
145
|
-
payload['range'] = range;
|
|
146
|
-
}
|
|
121
|
+
if (typeof logging !== 'undefined') {
|
|
122
|
+
payload['logging'] = logging;
|
|
123
|
+
}
|
|
147
124
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
'content-type': 'application/json',
|
|
151
|
-
}, payload);
|
|
125
|
+
if (typeof entrypoint !== 'undefined') {
|
|
126
|
+
payload['entrypoint'] = entrypoint;
|
|
152
127
|
}
|
|
153
128
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* Get a function by its unique ID.
|
|
158
|
-
*
|
|
159
|
-
* @param {string} functionId
|
|
160
|
-
* @throws {AppwriteException}
|
|
161
|
-
* @returns {Promise}
|
|
162
|
-
*/
|
|
163
|
-
async get(functionId: string): Promise<Models.Function> {
|
|
164
|
-
if (typeof functionId === 'undefined') {
|
|
165
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
166
|
-
}
|
|
129
|
+
if (typeof commands !== 'undefined') {
|
|
130
|
+
payload['commands'] = commands;
|
|
131
|
+
}
|
|
167
132
|
|
|
168
|
-
|
|
169
|
-
|
|
133
|
+
if (typeof installationId !== 'undefined') {
|
|
134
|
+
payload['installationId'] = installationId;
|
|
135
|
+
}
|
|
170
136
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
'content-type': 'application/json',
|
|
174
|
-
}, payload);
|
|
137
|
+
if (typeof providerRepositoryId !== 'undefined') {
|
|
138
|
+
payload['providerRepositoryId'] = providerRepositoryId;
|
|
175
139
|
}
|
|
176
140
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* Update function by its unique ID.
|
|
181
|
-
*
|
|
182
|
-
* @param {string} functionId
|
|
183
|
-
* @param {string} name
|
|
184
|
-
* @param {string[]} execute
|
|
185
|
-
* @param {string[]} events
|
|
186
|
-
* @param {string} schedule
|
|
187
|
-
* @param {number} timeout
|
|
188
|
-
* @param {boolean} enabled
|
|
189
|
-
* @throws {AppwriteException}
|
|
190
|
-
* @returns {Promise}
|
|
191
|
-
*/
|
|
192
|
-
async update(functionId: string, name: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function> {
|
|
193
|
-
if (typeof functionId === 'undefined') {
|
|
194
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
195
|
-
}
|
|
141
|
+
if (typeof providerBranch !== 'undefined') {
|
|
142
|
+
payload['providerBranch'] = providerBranch;
|
|
143
|
+
}
|
|
196
144
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
145
|
+
if (typeof providerSilentMode !== 'undefined') {
|
|
146
|
+
payload['providerSilentMode'] = providerSilentMode;
|
|
147
|
+
}
|
|
200
148
|
|
|
201
|
-
|
|
202
|
-
|
|
149
|
+
if (typeof providerRootDirectory !== 'undefined') {
|
|
150
|
+
payload['providerRootDirectory'] = providerRootDirectory;
|
|
151
|
+
}
|
|
203
152
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
153
|
+
if (typeof templateRepository !== 'undefined') {
|
|
154
|
+
payload['templateRepository'] = templateRepository;
|
|
155
|
+
}
|
|
207
156
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
157
|
+
if (typeof templateOwner !== 'undefined') {
|
|
158
|
+
payload['templateOwner'] = templateOwner;
|
|
159
|
+
}
|
|
211
160
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
161
|
+
if (typeof templateRootDirectory !== 'undefined') {
|
|
162
|
+
payload['templateRootDirectory'] = templateRootDirectory;
|
|
163
|
+
}
|
|
215
164
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
165
|
+
if (typeof templateBranch !== 'undefined') {
|
|
166
|
+
payload['templateBranch'] = templateBranch;
|
|
167
|
+
}
|
|
219
168
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
169
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
170
|
+
return await this.client.call('post', uri, {
|
|
171
|
+
'content-type': 'application/json',
|
|
172
|
+
}, payload);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* List runtimes
|
|
177
|
+
*
|
|
178
|
+
* Get a list of all runtimes that are currently active on your instance.
|
|
179
|
+
*
|
|
180
|
+
* @throws {AppwriteException}
|
|
181
|
+
* @returns {Promise}
|
|
182
|
+
*/
|
|
183
|
+
async listRuntimes(): Promise<Models.RuntimeList> {
|
|
184
|
+
const apiPath = '/functions/runtimes';
|
|
185
|
+
const payload: Payload = {};
|
|
186
|
+
|
|
187
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
188
|
+
return await this.client.call('get', uri, {
|
|
189
|
+
'content-type': 'application/json',
|
|
190
|
+
}, payload);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Get functions usage
|
|
195
|
+
*
|
|
196
|
+
*
|
|
197
|
+
* @param {string} range
|
|
198
|
+
* @throws {AppwriteException}
|
|
199
|
+
* @returns {Promise}
|
|
200
|
+
*/
|
|
201
|
+
async getUsage(range?: string): Promise<Models.UsageFunctions> {
|
|
202
|
+
const apiPath = '/functions/usage';
|
|
203
|
+
const payload: Payload = {};
|
|
204
|
+
|
|
205
|
+
if (typeof range !== 'undefined') {
|
|
206
|
+
payload['range'] = range;
|
|
207
|
+
}
|
|
223
208
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
209
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
210
|
+
return await this.client.call('get', uri, {
|
|
211
|
+
'content-type': 'application/json',
|
|
212
|
+
}, payload);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Get function
|
|
217
|
+
*
|
|
218
|
+
* Get a function by its unique ID.
|
|
219
|
+
*
|
|
220
|
+
* @param {string} functionId
|
|
221
|
+
* @throws {AppwriteException}
|
|
222
|
+
* @returns {Promise}
|
|
223
|
+
*/
|
|
224
|
+
async get(functionId: string): Promise<Models.Function> {
|
|
225
|
+
if (typeof functionId === 'undefined') {
|
|
226
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
227
|
+
}
|
|
227
228
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
230
|
+
const payload: Payload = {};
|
|
231
|
+
|
|
232
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
233
|
+
return await this.client.call('get', uri, {
|
|
234
|
+
'content-type': 'application/json',
|
|
235
|
+
}, payload);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Update function
|
|
240
|
+
*
|
|
241
|
+
* Update function by its unique ID.
|
|
242
|
+
*
|
|
243
|
+
* @param {string} functionId
|
|
244
|
+
* @param {string} name
|
|
245
|
+
* @param {string} runtime
|
|
246
|
+
* @param {string[]} execute
|
|
247
|
+
* @param {string[]} events
|
|
248
|
+
* @param {string} schedule
|
|
249
|
+
* @param {number} timeout
|
|
250
|
+
* @param {boolean} enabled
|
|
251
|
+
* @param {boolean} logging
|
|
252
|
+
* @param {string} entrypoint
|
|
253
|
+
* @param {string} commands
|
|
254
|
+
* @param {string} installationId
|
|
255
|
+
* @param {string} providerRepositoryId
|
|
256
|
+
* @param {string} providerBranch
|
|
257
|
+
* @param {boolean} providerSilentMode
|
|
258
|
+
* @param {string} providerRootDirectory
|
|
259
|
+
* @throws {AppwriteException}
|
|
260
|
+
* @returns {Promise}
|
|
261
|
+
*/
|
|
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> {
|
|
263
|
+
if (typeof functionId === 'undefined') {
|
|
264
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
232
265
|
}
|
|
233
266
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
* Delete a function by its unique ID.
|
|
238
|
-
*
|
|
239
|
-
* @param {string} functionId
|
|
240
|
-
* @throws {AppwriteException}
|
|
241
|
-
* @returns {Promise}
|
|
242
|
-
*/
|
|
243
|
-
async delete(functionId: string): Promise<{}> {
|
|
244
|
-
if (typeof functionId === 'undefined') {
|
|
245
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
246
|
-
}
|
|
267
|
+
if (typeof name === 'undefined') {
|
|
268
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
269
|
+
}
|
|
247
270
|
|
|
248
|
-
|
|
249
|
-
|
|
271
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
272
|
+
const payload: Payload = {};
|
|
250
273
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
'content-type': 'application/json',
|
|
254
|
-
}, payload);
|
|
274
|
+
if (typeof name !== 'undefined') {
|
|
275
|
+
payload['name'] = name;
|
|
255
276
|
}
|
|
256
277
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
* Get a list of all the project's code deployments. You can use the query
|
|
261
|
-
* params to filter your results.
|
|
262
|
-
*
|
|
263
|
-
* @param {string} functionId
|
|
264
|
-
* @param {string[]} queries
|
|
265
|
-
* @param {string} search
|
|
266
|
-
* @throws {AppwriteException}
|
|
267
|
-
* @returns {Promise}
|
|
268
|
-
*/
|
|
269
|
-
async listDeployments(functionId: string, queries?: string[], search?: string): Promise<Models.DeploymentList> {
|
|
270
|
-
if (typeof functionId === 'undefined') {
|
|
271
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
272
|
-
}
|
|
278
|
+
if (typeof runtime !== 'undefined') {
|
|
279
|
+
payload['runtime'] = runtime;
|
|
280
|
+
}
|
|
273
281
|
|
|
274
|
-
|
|
275
|
-
|
|
282
|
+
if (typeof execute !== 'undefined') {
|
|
283
|
+
payload['execute'] = execute;
|
|
284
|
+
}
|
|
276
285
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
286
|
+
if (typeof events !== 'undefined') {
|
|
287
|
+
payload['events'] = events;
|
|
288
|
+
}
|
|
280
289
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
290
|
+
if (typeof schedule !== 'undefined') {
|
|
291
|
+
payload['schedule'] = schedule;
|
|
292
|
+
}
|
|
284
293
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
'content-type': 'application/json',
|
|
288
|
-
}, payload);
|
|
294
|
+
if (typeof timeout !== 'undefined') {
|
|
295
|
+
payload['timeout'] = timeout;
|
|
289
296
|
}
|
|
290
297
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
* Create a new function code deployment. Use this endpoint to upload a new
|
|
295
|
-
* version of your code function. To execute your newly uploaded code, you'll
|
|
296
|
-
* need to update the function's deployment to use your new deployment UID.
|
|
297
|
-
*
|
|
298
|
-
* This endpoint accepts a tar.gz file compressed with your code. Make sure to
|
|
299
|
-
* include any dependencies your code has within the compressed file. You can
|
|
300
|
-
* learn more about code packaging in the [Appwrite Cloud Functions
|
|
301
|
-
* tutorial](/docs/functions).
|
|
302
|
-
*
|
|
303
|
-
* Use the "command" param to set the entry point used to execute your code.
|
|
304
|
-
*
|
|
305
|
-
* @param {string} functionId
|
|
306
|
-
* @param {string} entrypoint
|
|
307
|
-
* @param {File} code
|
|
308
|
-
* @param {boolean} activate
|
|
309
|
-
* @throws {AppwriteException}
|
|
310
|
-
* @returns {Promise}
|
|
311
|
-
*/
|
|
312
|
-
async createDeployment(functionId: string, entrypoint: string, code: File, activate: boolean, onProgress = (progress: UploadProgress) => {}): Promise<Models.Deployment> {
|
|
313
|
-
if (typeof functionId === 'undefined') {
|
|
314
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
315
|
-
}
|
|
298
|
+
if (typeof enabled !== 'undefined') {
|
|
299
|
+
payload['enabled'] = enabled;
|
|
300
|
+
}
|
|
316
301
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
302
|
+
if (typeof logging !== 'undefined') {
|
|
303
|
+
payload['logging'] = logging;
|
|
304
|
+
}
|
|
320
305
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
306
|
+
if (typeof entrypoint !== 'undefined') {
|
|
307
|
+
payload['entrypoint'] = entrypoint;
|
|
308
|
+
}
|
|
324
309
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
310
|
+
if (typeof commands !== 'undefined') {
|
|
311
|
+
payload['commands'] = commands;
|
|
312
|
+
}
|
|
328
313
|
|
|
329
|
-
|
|
330
|
-
|
|
314
|
+
if (typeof installationId !== 'undefined') {
|
|
315
|
+
payload['installationId'] = installationId;
|
|
316
|
+
}
|
|
331
317
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
318
|
+
if (typeof providerRepositoryId !== 'undefined') {
|
|
319
|
+
payload['providerRepositoryId'] = providerRepositoryId;
|
|
320
|
+
}
|
|
335
321
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
322
|
+
if (typeof providerBranch !== 'undefined') {
|
|
323
|
+
payload['providerBranch'] = providerBranch;
|
|
324
|
+
}
|
|
339
325
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
326
|
+
if (typeof providerSilentMode !== 'undefined') {
|
|
327
|
+
payload['providerSilentMode'] = providerSilentMode;
|
|
328
|
+
}
|
|
343
329
|
|
|
344
|
-
|
|
330
|
+
if (typeof providerRootDirectory !== 'undefined') {
|
|
331
|
+
payload['providerRootDirectory'] = providerRootDirectory;
|
|
332
|
+
}
|
|
345
333
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
334
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
335
|
+
return await this.client.call('put', uri, {
|
|
336
|
+
'content-type': 'application/json',
|
|
337
|
+
}, payload);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Delete function
|
|
342
|
+
*
|
|
343
|
+
* Delete a function by its unique ID.
|
|
344
|
+
*
|
|
345
|
+
* @param {string} functionId
|
|
346
|
+
* @throws {AppwriteException}
|
|
347
|
+
* @returns {Promise}
|
|
348
|
+
*/
|
|
349
|
+
async delete(functionId: string): Promise<{}> {
|
|
350
|
+
if (typeof functionId === 'undefined') {
|
|
351
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
352
|
+
}
|
|
349
353
|
|
|
350
|
-
|
|
354
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
355
|
+
const payload: Payload = {};
|
|
356
|
+
|
|
357
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
358
|
+
return await this.client.call('delete', uri, {
|
|
359
|
+
'content-type': 'application/json',
|
|
360
|
+
}, payload);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* List deployments
|
|
365
|
+
*
|
|
366
|
+
* Get a list of all the project's code deployments. You can use the query
|
|
367
|
+
* params to filter your results.
|
|
368
|
+
*
|
|
369
|
+
* @param {string} functionId
|
|
370
|
+
* @param {string[]} queries
|
|
371
|
+
* @param {string} search
|
|
372
|
+
* @throws {AppwriteException}
|
|
373
|
+
* @returns {Promise}
|
|
374
|
+
*/
|
|
375
|
+
async listDeployments(functionId: string, queries?: string[], search?: string): Promise<Models.DeploymentList> {
|
|
376
|
+
if (typeof functionId === 'undefined') {
|
|
377
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
378
|
+
}
|
|
351
379
|
|
|
352
|
-
|
|
353
|
-
|
|
380
|
+
const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
381
|
+
const payload: Payload = {};
|
|
354
382
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
let id = undefined;
|
|
359
|
-
let response = undefined;
|
|
383
|
+
if (typeof queries !== 'undefined') {
|
|
384
|
+
payload['queries'] = queries;
|
|
385
|
+
}
|
|
360
386
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
387
|
+
if (typeof search !== 'undefined') {
|
|
388
|
+
payload['search'] = search;
|
|
389
|
+
}
|
|
364
390
|
|
|
365
|
-
|
|
366
|
-
|
|
391
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
392
|
+
return await this.client.call('get', uri, {
|
|
393
|
+
'content-type': 'application/json',
|
|
394
|
+
}, payload);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Create deployment
|
|
399
|
+
*
|
|
400
|
+
* Create a new function code deployment. Use this endpoint to upload a new
|
|
401
|
+
* version of your code function. To execute your newly uploaded code, you'll
|
|
402
|
+
* need to update the function's deployment to use your new deployment UID.
|
|
403
|
+
*
|
|
404
|
+
* This endpoint accepts a tar.gz file compressed with your code. Make sure to
|
|
405
|
+
* include any dependencies your code has within the compressed file. You can
|
|
406
|
+
* learn more about code packaging in the [Appwrite Cloud Functions
|
|
407
|
+
* tutorial](https://appwrite.io/docs/functions).
|
|
408
|
+
*
|
|
409
|
+
* Use the "command" param to set the entrypoint used to execute your code.
|
|
410
|
+
*
|
|
411
|
+
* @param {string} functionId
|
|
412
|
+
* @param {File} code
|
|
413
|
+
* @param {boolean} activate
|
|
414
|
+
* @param {string} entrypoint
|
|
415
|
+
* @param {string} commands
|
|
416
|
+
* @throws {AppwriteException}
|
|
417
|
+
* @returns {Promise}
|
|
418
|
+
*/
|
|
419
|
+
async createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress = (progress: UploadProgress) => {}): Promise<Models.Deployment> {
|
|
420
|
+
if (typeof functionId === 'undefined') {
|
|
421
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
422
|
+
}
|
|
367
423
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
424
|
+
if (typeof code === 'undefined') {
|
|
425
|
+
throw new AppwriteException('Missing required parameter: "code"');
|
|
426
|
+
}
|
|
371
427
|
|
|
372
|
-
|
|
428
|
+
if (typeof activate === 'undefined') {
|
|
429
|
+
throw new AppwriteException('Missing required parameter: "activate"');
|
|
430
|
+
}
|
|
373
431
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
432
|
+
const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
433
|
+
const payload: Payload = {};
|
|
377
434
|
|
|
378
|
-
|
|
379
|
-
|
|
435
|
+
if (typeof entrypoint !== 'undefined') {
|
|
436
|
+
payload['entrypoint'] = entrypoint;
|
|
437
|
+
}
|
|
380
438
|
|
|
381
|
-
|
|
439
|
+
if (typeof commands !== 'undefined') {
|
|
440
|
+
payload['commands'] = commands;
|
|
441
|
+
}
|
|
382
442
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
443
|
+
if (typeof code !== 'undefined') {
|
|
444
|
+
payload['code'] = code;
|
|
445
|
+
}
|
|
386
446
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
progress: Math.min((counter + 1) * Service.CHUNK_SIZE - 1, size) / size * 100,
|
|
391
|
-
sizeUploaded: end,
|
|
392
|
-
chunksTotal: response.chunksTotal,
|
|
393
|
-
chunksUploaded: response.chunksUploaded
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
}
|
|
447
|
+
if (typeof activate !== 'undefined') {
|
|
448
|
+
payload['activate'] = activate;
|
|
449
|
+
}
|
|
397
450
|
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Get Deployment
|
|
403
|
-
*
|
|
404
|
-
* Get a code deployment by its unique ID.
|
|
405
|
-
*
|
|
406
|
-
* @param {string} functionId
|
|
407
|
-
* @param {string} deploymentId
|
|
408
|
-
* @throws {AppwriteException}
|
|
409
|
-
* @returns {Promise}
|
|
410
|
-
*/
|
|
411
|
-
async getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment> {
|
|
412
|
-
if (typeof functionId === 'undefined') {
|
|
413
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
414
|
-
}
|
|
451
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
415
452
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
453
|
+
if(!(code instanceof File)) {
|
|
454
|
+
throw new AppwriteException('Parameter "code" has to be a File.');
|
|
455
|
+
}
|
|
419
456
|
|
|
420
|
-
|
|
421
|
-
let payload: Payload = {};
|
|
457
|
+
const size = code.size;
|
|
422
458
|
|
|
423
|
-
|
|
424
|
-
return await this.client.call('
|
|
425
|
-
'content-type': '
|
|
459
|
+
if (size <= Service.CHUNK_SIZE) {
|
|
460
|
+
return await this.client.call('post', uri, {
|
|
461
|
+
'content-type': 'multipart/form-data',
|
|
426
462
|
}, payload);
|
|
427
463
|
}
|
|
428
464
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
*
|
|
432
|
-
* Update the function code deployment ID using the unique function ID. Use
|
|
433
|
-
* this endpoint to switch the code deployment that should be executed by the
|
|
434
|
-
* execution endpoint.
|
|
435
|
-
*
|
|
436
|
-
* @param {string} functionId
|
|
437
|
-
* @param {string} deploymentId
|
|
438
|
-
* @throws {AppwriteException}
|
|
439
|
-
* @returns {Promise}
|
|
440
|
-
*/
|
|
441
|
-
async updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function> {
|
|
442
|
-
if (typeof functionId === 'undefined') {
|
|
443
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (typeof deploymentId === 'undefined') {
|
|
447
|
-
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
451
|
-
let payload: Payload = {};
|
|
452
|
-
|
|
453
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
454
|
-
return await this.client.call('patch', uri, {
|
|
455
|
-
'content-type': 'application/json',
|
|
456
|
-
}, payload);
|
|
465
|
+
const apiHeaders: { [header: string]: string } = {
|
|
466
|
+
'content-type': 'multipart/form-data',
|
|
457
467
|
}
|
|
458
468
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
*
|
|
462
|
-
* Delete a code deployment by its unique ID.
|
|
463
|
-
*
|
|
464
|
-
* @param {string} functionId
|
|
465
|
-
* @param {string} deploymentId
|
|
466
|
-
* @throws {AppwriteException}
|
|
467
|
-
* @returns {Promise}
|
|
468
|
-
*/
|
|
469
|
-
async deleteDeployment(functionId: string, deploymentId: string): Promise<{}> {
|
|
470
|
-
if (typeof functionId === 'undefined') {
|
|
471
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
472
|
-
}
|
|
469
|
+
let offset = 0;
|
|
470
|
+
let response = undefined;
|
|
473
471
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
472
|
+
while (offset < size) {
|
|
473
|
+
let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
|
|
477
474
|
|
|
478
|
-
|
|
479
|
-
|
|
475
|
+
apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
|
|
476
|
+
if (response && response.$id) {
|
|
477
|
+
apiHeaders['x-appwrite-id'] = response.$id;
|
|
478
|
+
}
|
|
480
479
|
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}, payload);
|
|
485
|
-
}
|
|
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);
|
|
486
483
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
* @returns {Promise}
|
|
496
|
-
*/
|
|
497
|
-
async createBuild(functionId: string, deploymentId: string, buildId: string): Promise<{}> {
|
|
498
|
-
if (typeof functionId === 'undefined') {
|
|
499
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
484
|
+
if (onProgress) {
|
|
485
|
+
onProgress({
|
|
486
|
+
$id: response.$id,
|
|
487
|
+
progress: (offset / size) * 100,
|
|
488
|
+
sizeUploaded: offset,
|
|
489
|
+
chunksTotal: response.chunksTotal,
|
|
490
|
+
chunksUploaded: response.chunksUploaded
|
|
491
|
+
});
|
|
500
492
|
}
|
|
493
|
+
offset += Service.CHUNK_SIZE;
|
|
494
|
+
}
|
|
495
|
+
return response;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Get deployment
|
|
500
|
+
*
|
|
501
|
+
* Get a code deployment by its unique ID.
|
|
502
|
+
*
|
|
503
|
+
* @param {string} functionId
|
|
504
|
+
* @param {string} deploymentId
|
|
505
|
+
* @throws {AppwriteException}
|
|
506
|
+
* @returns {Promise}
|
|
507
|
+
*/
|
|
508
|
+
async getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment> {
|
|
509
|
+
if (typeof functionId === 'undefined') {
|
|
510
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
511
|
+
}
|
|
501
512
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
513
|
+
if (typeof deploymentId === 'undefined') {
|
|
514
|
+
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
515
|
+
}
|
|
505
516
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
517
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
518
|
+
const payload: Payload = {};
|
|
519
|
+
|
|
520
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
521
|
+
return await this.client.call('get', uri, {
|
|
522
|
+
'content-type': 'application/json',
|
|
523
|
+
}, payload);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Update function deployment
|
|
528
|
+
*
|
|
529
|
+
* Update the function code deployment ID using the unique function ID. Use
|
|
530
|
+
* this endpoint to switch the code deployment that should be executed by the
|
|
531
|
+
* execution endpoint.
|
|
532
|
+
*
|
|
533
|
+
* @param {string} functionId
|
|
534
|
+
* @param {string} deploymentId
|
|
535
|
+
* @throws {AppwriteException}
|
|
536
|
+
* @returns {Promise}
|
|
537
|
+
*/
|
|
538
|
+
async updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function> {
|
|
539
|
+
if (typeof functionId === 'undefined') {
|
|
540
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
541
|
+
}
|
|
509
542
|
|
|
510
|
-
|
|
511
|
-
|
|
543
|
+
if (typeof deploymentId === 'undefined') {
|
|
544
|
+
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
545
|
+
}
|
|
512
546
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
547
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
548
|
+
const payload: Payload = {};
|
|
549
|
+
|
|
550
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
551
|
+
return await this.client.call('patch', uri, {
|
|
552
|
+
'content-type': 'application/json',
|
|
553
|
+
}, payload);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Delete deployment
|
|
558
|
+
*
|
|
559
|
+
* Delete a code deployment by its unique ID.
|
|
560
|
+
*
|
|
561
|
+
* @param {string} functionId
|
|
562
|
+
* @param {string} deploymentId
|
|
563
|
+
* @throws {AppwriteException}
|
|
564
|
+
* @returns {Promise}
|
|
565
|
+
*/
|
|
566
|
+
async deleteDeployment(functionId: string, deploymentId: string): Promise<{}> {
|
|
567
|
+
if (typeof functionId === 'undefined') {
|
|
568
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
517
569
|
}
|
|
518
570
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
* Get a list of all the current user function execution logs. You can use the
|
|
523
|
-
* query params to filter your results.
|
|
524
|
-
*
|
|
525
|
-
* @param {string} functionId
|
|
526
|
-
* @param {string[]} queries
|
|
527
|
-
* @param {string} search
|
|
528
|
-
* @throws {AppwriteException}
|
|
529
|
-
* @returns {Promise}
|
|
530
|
-
*/
|
|
531
|
-
async listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> {
|
|
532
|
-
if (typeof functionId === 'undefined') {
|
|
533
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
534
|
-
}
|
|
571
|
+
if (typeof deploymentId === 'undefined') {
|
|
572
|
+
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
573
|
+
}
|
|
535
574
|
|
|
536
|
-
|
|
537
|
-
|
|
575
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
576
|
+
const payload: Payload = {};
|
|
577
|
+
|
|
578
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
579
|
+
return await this.client.call('delete', uri, {
|
|
580
|
+
'content-type': 'application/json',
|
|
581
|
+
}, payload);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Create build
|
|
586
|
+
*
|
|
587
|
+
* Create a new build for an Appwrite Function deployment. This endpoint can
|
|
588
|
+
* be used to retry a failed build.
|
|
589
|
+
*
|
|
590
|
+
* @param {string} functionId
|
|
591
|
+
* @param {string} deploymentId
|
|
592
|
+
* @param {string} buildId
|
|
593
|
+
* @throws {AppwriteException}
|
|
594
|
+
* @returns {Promise}
|
|
595
|
+
*/
|
|
596
|
+
async createBuild(functionId: string, deploymentId: string, buildId: string): Promise<{}> {
|
|
597
|
+
if (typeof functionId === 'undefined') {
|
|
598
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
599
|
+
}
|
|
538
600
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
601
|
+
if (typeof deploymentId === 'undefined') {
|
|
602
|
+
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
603
|
+
}
|
|
542
604
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
605
|
+
if (typeof buildId === 'undefined') {
|
|
606
|
+
throw new AppwriteException('Missing required parameter: "buildId"');
|
|
607
|
+
}
|
|
546
608
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
609
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
610
|
+
const payload: Payload = {};
|
|
611
|
+
|
|
612
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
613
|
+
return await this.client.call('post', uri, {
|
|
614
|
+
'content-type': 'application/json',
|
|
615
|
+
}, payload);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Download Deployment
|
|
620
|
+
*
|
|
621
|
+
* Get a Deployment's contents by its unique ID. This endpoint supports range
|
|
622
|
+
* requests for partial or streaming file download.
|
|
623
|
+
*
|
|
624
|
+
* @param {string} functionId
|
|
625
|
+
* @param {string} deploymentId
|
|
626
|
+
* @throws {AppwriteException}
|
|
627
|
+
* @returns {URL}
|
|
628
|
+
*/
|
|
629
|
+
downloadDeployment(functionId: string, deploymentId: string): URL {
|
|
630
|
+
if (typeof functionId === 'undefined') {
|
|
631
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
551
632
|
}
|
|
552
633
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
* Trigger a function execution. The returned object will return you the
|
|
557
|
-
* current execution status. You can ping the `Get Execution` endpoint to get
|
|
558
|
-
* updates on the current execution status. Once this endpoint is called, your
|
|
559
|
-
* function execution process will start asynchronously.
|
|
560
|
-
*
|
|
561
|
-
* @param {string} functionId
|
|
562
|
-
* @param {string} data
|
|
563
|
-
* @param {boolean} async
|
|
564
|
-
* @throws {AppwriteException}
|
|
565
|
-
* @returns {Promise}
|
|
566
|
-
*/
|
|
567
|
-
async createExecution(functionId: string, data?: string, async?: boolean): Promise<Models.Execution> {
|
|
568
|
-
if (typeof functionId === 'undefined') {
|
|
569
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
570
|
-
}
|
|
634
|
+
if (typeof deploymentId === 'undefined') {
|
|
635
|
+
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
636
|
+
}
|
|
571
637
|
|
|
572
|
-
|
|
573
|
-
|
|
638
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
639
|
+
const payload: Payload = {};
|
|
574
640
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
641
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
642
|
+
payload['project'] = this.client.config.project;
|
|
578
643
|
|
|
579
|
-
if (typeof async !== 'undefined') {
|
|
580
|
-
payload['async'] = async;
|
|
581
|
-
}
|
|
582
644
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
645
|
+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
646
|
+
uri.searchParams.append(key, value);
|
|
647
|
+
}
|
|
648
|
+
return uri;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* List executions
|
|
653
|
+
*
|
|
654
|
+
* Get a list of all the current user function execution logs. You can use the
|
|
655
|
+
* query params to filter your results.
|
|
656
|
+
*
|
|
657
|
+
* @param {string} functionId
|
|
658
|
+
* @param {string[]} queries
|
|
659
|
+
* @param {string} search
|
|
660
|
+
* @throws {AppwriteException}
|
|
661
|
+
* @returns {Promise}
|
|
662
|
+
*/
|
|
663
|
+
async listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> {
|
|
664
|
+
if (typeof functionId === 'undefined') {
|
|
665
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
587
666
|
}
|
|
588
667
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
*
|
|
592
|
-
* Get a function execution log by its unique ID.
|
|
593
|
-
*
|
|
594
|
-
* @param {string} functionId
|
|
595
|
-
* @param {string} executionId
|
|
596
|
-
* @throws {AppwriteException}
|
|
597
|
-
* @returns {Promise}
|
|
598
|
-
*/
|
|
599
|
-
async getExecution(functionId: string, executionId: string): Promise<Models.Execution> {
|
|
600
|
-
if (typeof functionId === 'undefined') {
|
|
601
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
602
|
-
}
|
|
668
|
+
const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
669
|
+
const payload: Payload = {};
|
|
603
670
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
671
|
+
if (typeof queries !== 'undefined') {
|
|
672
|
+
payload['queries'] = queries;
|
|
673
|
+
}
|
|
607
674
|
|
|
608
|
-
|
|
609
|
-
|
|
675
|
+
if (typeof search !== 'undefined') {
|
|
676
|
+
payload['search'] = search;
|
|
677
|
+
}
|
|
610
678
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
679
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
680
|
+
return await this.client.call('get', uri, {
|
|
681
|
+
'content-type': 'application/json',
|
|
682
|
+
}, payload);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Create execution
|
|
687
|
+
*
|
|
688
|
+
* Trigger a function execution. The returned object will return you the
|
|
689
|
+
* current execution status. You can ping the `Get Execution` endpoint to get
|
|
690
|
+
* updates on the current execution status. Once this endpoint is called, your
|
|
691
|
+
* function execution process will start asynchronously.
|
|
692
|
+
*
|
|
693
|
+
* @param {string} functionId
|
|
694
|
+
* @param {string} body
|
|
695
|
+
* @param {boolean} async
|
|
696
|
+
* @param {string} xpath
|
|
697
|
+
* @param {string} method
|
|
698
|
+
* @param {object} headers
|
|
699
|
+
* @throws {AppwriteException}
|
|
700
|
+
* @returns {Promise}
|
|
701
|
+
*/
|
|
702
|
+
async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: string, headers?: object): Promise<Models.Execution> {
|
|
703
|
+
if (typeof functionId === 'undefined') {
|
|
704
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
615
705
|
}
|
|
616
706
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
* @param {string} functionId
|
|
622
|
-
* @param {string} range
|
|
623
|
-
* @throws {AppwriteException}
|
|
624
|
-
* @returns {Promise}
|
|
625
|
-
*/
|
|
626
|
-
async getFunctionUsage(functionId: string, range?: string): Promise<Models.UsageFunctions> {
|
|
627
|
-
if (typeof functionId === 'undefined') {
|
|
628
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
629
|
-
}
|
|
707
|
+
const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
708
|
+
const payload: Payload = {};
|
|
630
709
|
|
|
631
|
-
|
|
632
|
-
|
|
710
|
+
if (typeof body !== 'undefined') {
|
|
711
|
+
payload['body'] = body;
|
|
712
|
+
}
|
|
633
713
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
714
|
+
if (typeof async !== 'undefined') {
|
|
715
|
+
payload['async'] = async;
|
|
716
|
+
}
|
|
637
717
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
'content-type': 'application/json',
|
|
641
|
-
}, payload);
|
|
718
|
+
if (typeof xpath !== 'undefined') {
|
|
719
|
+
payload['path'] = xpath;
|
|
642
720
|
}
|
|
643
721
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
* Get a list of all variables of a specific function.
|
|
648
|
-
*
|
|
649
|
-
* @param {string} functionId
|
|
650
|
-
* @throws {AppwriteException}
|
|
651
|
-
* @returns {Promise}
|
|
652
|
-
*/
|
|
653
|
-
async listVariables(functionId: string): Promise<Models.VariableList> {
|
|
654
|
-
if (typeof functionId === 'undefined') {
|
|
655
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
656
|
-
}
|
|
722
|
+
if (typeof method !== 'undefined') {
|
|
723
|
+
payload['method'] = method;
|
|
724
|
+
}
|
|
657
725
|
|
|
658
|
-
|
|
659
|
-
|
|
726
|
+
if (typeof headers !== 'undefined') {
|
|
727
|
+
payload['headers'] = headers;
|
|
728
|
+
}
|
|
660
729
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
730
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
731
|
+
return await this.client.call('post', uri, {
|
|
732
|
+
'content-type': 'application/json',
|
|
733
|
+
}, payload);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Get execution
|
|
738
|
+
*
|
|
739
|
+
* Get a function execution log by its unique ID.
|
|
740
|
+
*
|
|
741
|
+
* @param {string} functionId
|
|
742
|
+
* @param {string} executionId
|
|
743
|
+
* @throws {AppwriteException}
|
|
744
|
+
* @returns {Promise}
|
|
745
|
+
*/
|
|
746
|
+
async getExecution(functionId: string, executionId: string): Promise<Models.Execution> {
|
|
747
|
+
if (typeof functionId === 'undefined') {
|
|
748
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
665
749
|
}
|
|
666
750
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
* Create a new function variable. These variables can be accessed within
|
|
671
|
-
* function in the `env` object under the request variable.
|
|
672
|
-
*
|
|
673
|
-
* @param {string} functionId
|
|
674
|
-
* @param {string} key
|
|
675
|
-
* @param {string} value
|
|
676
|
-
* @throws {AppwriteException}
|
|
677
|
-
* @returns {Promise}
|
|
678
|
-
*/
|
|
679
|
-
async createVariable(functionId: string, key: string, value: string): Promise<Models.Variable> {
|
|
680
|
-
if (typeof functionId === 'undefined') {
|
|
681
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
682
|
-
}
|
|
751
|
+
if (typeof executionId === 'undefined') {
|
|
752
|
+
throw new AppwriteException('Missing required parameter: "executionId"');
|
|
753
|
+
}
|
|
683
754
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
755
|
+
const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
756
|
+
const payload: Payload = {};
|
|
757
|
+
|
|
758
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
759
|
+
return await this.client.call('get', uri, {
|
|
760
|
+
'content-type': 'application/json',
|
|
761
|
+
}, payload);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Get function usage
|
|
766
|
+
*
|
|
767
|
+
*
|
|
768
|
+
* @param {string} functionId
|
|
769
|
+
* @param {string} range
|
|
770
|
+
* @throws {AppwriteException}
|
|
771
|
+
* @returns {Promise}
|
|
772
|
+
*/
|
|
773
|
+
async getFunctionUsage(functionId: string, range?: string): Promise<Models.UsageFunctions> {
|
|
774
|
+
if (typeof functionId === 'undefined') {
|
|
775
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
776
|
+
}
|
|
687
777
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}
|
|
778
|
+
const apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
|
|
779
|
+
const payload: Payload = {};
|
|
691
780
|
|
|
692
|
-
|
|
693
|
-
|
|
781
|
+
if (typeof range !== 'undefined') {
|
|
782
|
+
payload['range'] = range;
|
|
783
|
+
}
|
|
694
784
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
785
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
786
|
+
return await this.client.call('get', uri, {
|
|
787
|
+
'content-type': 'application/json',
|
|
788
|
+
}, payload);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* List variables
|
|
793
|
+
*
|
|
794
|
+
* Get a list of all variables of a specific function.
|
|
795
|
+
*
|
|
796
|
+
* @param {string} functionId
|
|
797
|
+
* @throws {AppwriteException}
|
|
798
|
+
* @returns {Promise}
|
|
799
|
+
*/
|
|
800
|
+
async listVariables(functionId: string): Promise<Models.VariableList> {
|
|
801
|
+
if (typeof functionId === 'undefined') {
|
|
802
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
803
|
+
}
|
|
698
804
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
805
|
+
const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
806
|
+
const payload: Payload = {};
|
|
807
|
+
|
|
808
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
809
|
+
return await this.client.call('get', uri, {
|
|
810
|
+
'content-type': 'application/json',
|
|
811
|
+
}, payload);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Create variable
|
|
816
|
+
*
|
|
817
|
+
* Create a new function environment variable. These variables can be accessed
|
|
818
|
+
* in the function at runtime as environment variables.
|
|
819
|
+
*
|
|
820
|
+
* @param {string} functionId
|
|
821
|
+
* @param {string} key
|
|
822
|
+
* @param {string} value
|
|
823
|
+
* @throws {AppwriteException}
|
|
824
|
+
* @returns {Promise}
|
|
825
|
+
*/
|
|
826
|
+
async createVariable(functionId: string, key: string, value: string): Promise<Models.Variable> {
|
|
827
|
+
if (typeof functionId === 'undefined') {
|
|
828
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
829
|
+
}
|
|
702
830
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
'content-type': 'application/json',
|
|
706
|
-
}, payload);
|
|
831
|
+
if (typeof key === 'undefined') {
|
|
832
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
707
833
|
}
|
|
708
834
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
* Get a variable by its unique ID.
|
|
713
|
-
*
|
|
714
|
-
* @param {string} functionId
|
|
715
|
-
* @param {string} variableId
|
|
716
|
-
* @throws {AppwriteException}
|
|
717
|
-
* @returns {Promise}
|
|
718
|
-
*/
|
|
719
|
-
async getVariable(functionId: string, variableId: string): Promise<Models.Variable> {
|
|
720
|
-
if (typeof functionId === 'undefined') {
|
|
721
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
722
|
-
}
|
|
835
|
+
if (typeof value === 'undefined') {
|
|
836
|
+
throw new AppwriteException('Missing required parameter: "value"');
|
|
837
|
+
}
|
|
723
838
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
839
|
+
const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
840
|
+
const payload: Payload = {};
|
|
727
841
|
|
|
728
|
-
|
|
729
|
-
|
|
842
|
+
if (typeof key !== 'undefined') {
|
|
843
|
+
payload['key'] = key;
|
|
844
|
+
}
|
|
730
845
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
'content-type': 'application/json',
|
|
734
|
-
}, payload);
|
|
846
|
+
if (typeof value !== 'undefined') {
|
|
847
|
+
payload['value'] = value;
|
|
735
848
|
}
|
|
736
849
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
850
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
851
|
+
return await this.client.call('post', uri, {
|
|
852
|
+
'content-type': 'application/json',
|
|
853
|
+
}, payload);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Get variable
|
|
858
|
+
*
|
|
859
|
+
* Get a variable by its unique ID.
|
|
860
|
+
*
|
|
861
|
+
* @param {string} functionId
|
|
862
|
+
* @param {string} variableId
|
|
863
|
+
* @throws {AppwriteException}
|
|
864
|
+
* @returns {Promise}
|
|
865
|
+
*/
|
|
866
|
+
async getVariable(functionId: string, variableId: string): Promise<Models.Variable> {
|
|
867
|
+
if (typeof functionId === 'undefined') {
|
|
868
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
869
|
+
}
|
|
753
870
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
871
|
+
if (typeof variableId === 'undefined') {
|
|
872
|
+
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
873
|
+
}
|
|
757
874
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
875
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
876
|
+
const payload: Payload = {};
|
|
877
|
+
|
|
878
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
879
|
+
return await this.client.call('get', uri, {
|
|
880
|
+
'content-type': 'application/json',
|
|
881
|
+
}, payload);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Update variable
|
|
886
|
+
*
|
|
887
|
+
* Update variable by its unique ID.
|
|
888
|
+
*
|
|
889
|
+
* @param {string} functionId
|
|
890
|
+
* @param {string} variableId
|
|
891
|
+
* @param {string} key
|
|
892
|
+
* @param {string} value
|
|
893
|
+
* @throws {AppwriteException}
|
|
894
|
+
* @returns {Promise}
|
|
895
|
+
*/
|
|
896
|
+
async updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise<Models.Variable> {
|
|
897
|
+
if (typeof functionId === 'undefined') {
|
|
898
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
899
|
+
}
|
|
761
900
|
|
|
762
|
-
|
|
763
|
-
|
|
901
|
+
if (typeof variableId === 'undefined') {
|
|
902
|
+
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
903
|
+
}
|
|
764
904
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
905
|
+
if (typeof key === 'undefined') {
|
|
906
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
907
|
+
}
|
|
768
908
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
909
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
910
|
+
const payload: Payload = {};
|
|
772
911
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
'content-type': 'application/json',
|
|
776
|
-
}, payload);
|
|
912
|
+
if (typeof key !== 'undefined') {
|
|
913
|
+
payload['key'] = key;
|
|
777
914
|
}
|
|
778
915
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
* Delete a variable by its unique ID.
|
|
783
|
-
*
|
|
784
|
-
* @param {string} functionId
|
|
785
|
-
* @param {string} variableId
|
|
786
|
-
* @throws {AppwriteException}
|
|
787
|
-
* @returns {Promise}
|
|
788
|
-
*/
|
|
789
|
-
async deleteVariable(functionId: string, variableId: string): Promise<{}> {
|
|
790
|
-
if (typeof functionId === 'undefined') {
|
|
791
|
-
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
if (typeof variableId === 'undefined') {
|
|
795
|
-
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
796
|
-
}
|
|
916
|
+
if (typeof value !== 'undefined') {
|
|
917
|
+
payload['value'] = value;
|
|
918
|
+
}
|
|
797
919
|
|
|
798
|
-
|
|
799
|
-
|
|
920
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
921
|
+
return await this.client.call('put', uri, {
|
|
922
|
+
'content-type': 'application/json',
|
|
923
|
+
}, payload);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Delete variable
|
|
928
|
+
*
|
|
929
|
+
* Delete a variable by its unique ID.
|
|
930
|
+
*
|
|
931
|
+
* @param {string} functionId
|
|
932
|
+
* @param {string} variableId
|
|
933
|
+
* @throws {AppwriteException}
|
|
934
|
+
* @returns {Promise}
|
|
935
|
+
*/
|
|
936
|
+
async deleteVariable(functionId: string, variableId: string): Promise<{}> {
|
|
937
|
+
if (typeof functionId === 'undefined') {
|
|
938
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
939
|
+
}
|
|
800
940
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
'content-type': 'application/json',
|
|
804
|
-
}, payload);
|
|
941
|
+
if (typeof variableId === 'undefined') {
|
|
942
|
+
throw new AppwriteException('Missing required parameter: "variableId"');
|
|
805
943
|
}
|
|
944
|
+
|
|
945
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
946
|
+
const payload: Payload = {};
|
|
947
|
+
|
|
948
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
949
|
+
return await this.client.call('delete', uri, {
|
|
950
|
+
'content-type': 'application/json',
|
|
951
|
+
}, payload);
|
|
952
|
+
}
|
|
806
953
|
};
|