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