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