@appwrite.io/console 0.6.2 → 0.7.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/autoclose.yml +11 -0
- package/.github/workflows/publish.yml +40 -16
- package/README.md +3 -3
- package/dist/cjs/sdk.js +2749 -2318
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +2749 -2318
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +2749 -2318
- package/docs/examples/account/create-anonymous-session.md +2 -2
- package/docs/examples/account/create-email-password-session.md +2 -2
- package/docs/examples/account/create-email-token.md +2 -2
- package/docs/examples/account/create-j-w-t.md +2 -2
- package/docs/examples/account/create-magic-u-r-l-token.md +2 -2
- package/docs/examples/account/create-mfa-authenticator.md +2 -2
- package/docs/examples/account/create-mfa-challenge.md +2 -2
- package/docs/examples/account/create-mfa-recovery-codes.md +2 -2
- package/docs/examples/account/create-o-auth2session.md +1 -1
- package/docs/examples/account/create-o-auth2token.md +1 -1
- package/docs/examples/account/create-phone-token.md +2 -2
- package/docs/examples/account/create-phone-verification.md +2 -2
- package/docs/examples/account/create-push-target.md +2 -2
- package/docs/examples/account/create-recovery.md +2 -2
- package/docs/examples/account/create-session.md +2 -2
- package/docs/examples/account/create-verification.md +2 -2
- package/docs/examples/account/create.md +2 -2
- package/docs/examples/account/delete-identity.md +2 -2
- package/docs/examples/account/delete-mfa-authenticator.md +3 -4
- package/docs/examples/account/delete-push-target.md +2 -2
- package/docs/examples/account/delete-session.md +2 -2
- package/docs/examples/account/delete-sessions.md +2 -2
- package/docs/examples/account/delete.md +2 -2
- package/docs/examples/account/get-mfa-recovery-codes.md +2 -2
- package/docs/examples/account/get-prefs.md +2 -2
- package/docs/examples/account/get-session.md +2 -2
- package/docs/examples/account/get.md +2 -2
- package/docs/examples/account/list-identities.md +2 -2
- package/docs/examples/account/list-logs.md +2 -2
- package/docs/examples/account/list-mfa-factors.md +2 -2
- package/docs/examples/account/list-sessions.md +2 -2
- package/docs/examples/account/update-email.md +2 -2
- package/docs/examples/account/update-m-f-a.md +2 -2
- package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
- package/docs/examples/account/update-mfa-authenticator.md +2 -2
- package/docs/examples/account/update-mfa-challenge.md +2 -2
- package/docs/examples/account/update-mfa-recovery-codes.md +2 -2
- package/docs/examples/account/update-name.md +2 -2
- package/docs/examples/account/update-password.md +2 -2
- package/docs/examples/account/update-phone-session.md +2 -2
- package/docs/examples/account/update-phone-verification.md +2 -2
- package/docs/examples/account/update-phone.md +2 -2
- package/docs/examples/account/update-prefs.md +2 -2
- package/docs/examples/account/update-push-target.md +2 -2
- package/docs/examples/account/update-recovery.md +2 -2
- package/docs/examples/account/update-session.md +2 -2
- package/docs/examples/account/update-status.md +2 -2
- package/docs/examples/account/update-verification.md +2 -2
- package/docs/examples/assistant/chat.md +2 -2
- 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 +2 -2
- package/docs/examples/databases/create-boolean-attribute.md +2 -2
- package/docs/examples/databases/create-collection.md +2 -2
- package/docs/examples/databases/create-datetime-attribute.md +2 -2
- package/docs/examples/databases/create-document.md +2 -2
- package/docs/examples/databases/create-email-attribute.md +2 -2
- package/docs/examples/databases/create-enum-attribute.md +2 -2
- package/docs/examples/databases/create-float-attribute.md +2 -2
- package/docs/examples/databases/create-index.md +2 -2
- package/docs/examples/databases/create-integer-attribute.md +2 -2
- package/docs/examples/databases/create-ip-attribute.md +2 -2
- package/docs/examples/databases/create-relationship-attribute.md +2 -2
- package/docs/examples/databases/create-string-attribute.md +2 -2
- package/docs/examples/databases/create-url-attribute.md +2 -2
- package/docs/examples/databases/create.md +2 -2
- package/docs/examples/databases/delete-attribute.md +2 -2
- package/docs/examples/databases/delete-collection.md +2 -2
- package/docs/examples/databases/delete-document.md +2 -2
- package/docs/examples/databases/delete-index.md +2 -2
- package/docs/examples/databases/delete.md +2 -2
- package/docs/examples/databases/get-attribute.md +2 -2
- package/docs/examples/databases/get-collection-usage.md +2 -2
- package/docs/examples/databases/get-collection.md +2 -2
- package/docs/examples/databases/get-database-usage.md +2 -2
- package/docs/examples/databases/get-document.md +2 -2
- package/docs/examples/databases/get-index.md +2 -2
- package/docs/examples/databases/get-usage.md +2 -2
- package/docs/examples/databases/get.md +2 -2
- package/docs/examples/databases/list-attributes.md +2 -2
- package/docs/examples/databases/list-collection-logs.md +2 -2
- package/docs/examples/databases/list-collections.md +2 -2
- package/docs/examples/databases/list-document-logs.md +2 -2
- package/docs/examples/databases/list-documents.md +2 -2
- package/docs/examples/databases/list-indexes.md +2 -2
- package/docs/examples/databases/list-logs.md +2 -2
- package/docs/examples/databases/list.md +2 -2
- package/docs/examples/databases/update-boolean-attribute.md +2 -2
- package/docs/examples/databases/update-collection.md +2 -2
- package/docs/examples/databases/update-datetime-attribute.md +2 -2
- package/docs/examples/databases/update-document.md +2 -2
- package/docs/examples/databases/update-email-attribute.md +2 -2
- package/docs/examples/databases/update-enum-attribute.md +2 -2
- package/docs/examples/databases/update-float-attribute.md +2 -2
- package/docs/examples/databases/update-integer-attribute.md +2 -2
- package/docs/examples/databases/update-ip-attribute.md +2 -2
- package/docs/examples/databases/update-relationship-attribute.md +2 -2
- package/docs/examples/databases/update-string-attribute.md +2 -2
- package/docs/examples/databases/update-url-attribute.md +2 -2
- package/docs/examples/databases/update.md +2 -2
- package/docs/examples/functions/create-build.md +3 -3
- package/docs/examples/functions/create-deployment.md +2 -2
- package/docs/examples/functions/create-execution.md +4 -3
- package/docs/examples/functions/create-variable.md +2 -2
- package/docs/examples/functions/create.md +4 -3
- package/docs/examples/functions/delete-deployment.md +2 -2
- package/docs/examples/functions/delete-execution.md +14 -0
- package/docs/examples/functions/delete-variable.md +2 -2
- package/docs/examples/functions/delete.md +2 -2
- package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +2 -2
- package/docs/examples/functions/get-deployment.md +2 -2
- package/docs/examples/functions/get-execution.md +2 -2
- package/docs/examples/functions/get-function-usage.md +2 -2
- package/docs/examples/functions/get-template.md +13 -0
- package/docs/examples/functions/get-usage.md +2 -2
- package/docs/examples/functions/get-variable.md +2 -2
- package/docs/examples/functions/get.md +2 -2
- package/docs/examples/functions/list-deployments.md +2 -2
- package/docs/examples/functions/list-executions.md +2 -2
- package/docs/examples/functions/list-runtimes.md +2 -2
- package/docs/examples/functions/list-templates.md +16 -0
- package/docs/examples/functions/list-variables.md +2 -2
- package/docs/examples/functions/list.md +2 -2
- package/docs/examples/functions/update-deployment-build.md +14 -0
- package/docs/examples/functions/update-deployment.md +2 -2
- package/docs/examples/functions/update-variable.md +2 -2
- package/docs/examples/functions/update.md +3 -2
- package/docs/examples/graphql/mutation.md +2 -2
- package/docs/examples/graphql/query.md +2 -2
- package/docs/examples/health/get-antivirus.md +2 -2
- package/docs/examples/health/get-cache.md +2 -2
- package/docs/examples/health/get-certificate.md +2 -2
- package/docs/examples/health/get-d-b.md +2 -2
- package/docs/examples/health/get-failed-jobs.md +2 -2
- package/docs/examples/health/get-pub-sub.md +2 -2
- package/docs/examples/health/get-queue-builds.md +2 -2
- package/docs/examples/health/get-queue-certificates.md +2 -2
- package/docs/examples/health/get-queue-databases.md +2 -2
- package/docs/examples/health/get-queue-deletes.md +2 -2
- package/docs/examples/health/get-queue-functions.md +2 -2
- package/docs/examples/health/get-queue-logs.md +2 -2
- package/docs/examples/health/get-queue-mails.md +2 -2
- package/docs/examples/health/get-queue-messaging.md +2 -2
- package/docs/examples/health/get-queue-migrations.md +2 -2
- package/docs/examples/health/get-queue-usage-dump.md +2 -2
- package/docs/examples/health/get-queue-usage.md +2 -2
- package/docs/examples/health/get-queue-webhooks.md +2 -2
- package/docs/examples/health/get-queue.md +2 -2
- package/docs/examples/health/get-storage-local.md +2 -2
- package/docs/examples/health/get-storage.md +2 -2
- package/docs/examples/health/get-time.md +2 -2
- package/docs/examples/health/get.md +2 -2
- package/docs/examples/locale/get.md +2 -2
- package/docs/examples/locale/list-codes.md +2 -2
- package/docs/examples/locale/list-continents.md +2 -2
- package/docs/examples/locale/list-countries-e-u.md +2 -2
- package/docs/examples/locale/list-countries-phones.md +2 -2
- package/docs/examples/locale/list-countries.md +2 -2
- package/docs/examples/locale/list-currencies.md +2 -2
- package/docs/examples/locale/list-languages.md +2 -2
- package/docs/examples/messaging/create-apns-provider.md +2 -2
- package/docs/examples/messaging/create-email.md +2 -2
- package/docs/examples/messaging/create-fcm-provider.md +2 -2
- package/docs/examples/messaging/create-mailgun-provider.md +2 -2
- package/docs/examples/messaging/create-msg91provider.md +2 -2
- package/docs/examples/messaging/create-push.md +2 -2
- package/docs/examples/messaging/create-sendgrid-provider.md +2 -2
- package/docs/examples/messaging/create-sms.md +2 -2
- package/docs/examples/messaging/create-smtp-provider.md +2 -2
- package/docs/examples/messaging/create-subscriber.md +2 -2
- package/docs/examples/messaging/create-telesign-provider.md +2 -2
- package/docs/examples/messaging/create-textmagic-provider.md +2 -2
- package/docs/examples/messaging/create-topic.md +2 -2
- package/docs/examples/messaging/create-twilio-provider.md +2 -2
- package/docs/examples/messaging/create-vonage-provider.md +2 -2
- package/docs/examples/messaging/delete-provider.md +2 -2
- package/docs/examples/messaging/delete-subscriber.md +2 -2
- package/docs/examples/messaging/delete-topic.md +2 -2
- package/docs/examples/messaging/delete.md +2 -2
- package/docs/examples/messaging/get-message.md +2 -2
- package/docs/examples/messaging/get-provider.md +2 -2
- package/docs/examples/messaging/get-subscriber.md +2 -2
- package/docs/examples/messaging/get-topic.md +2 -2
- package/docs/examples/messaging/list-message-logs.md +2 -2
- package/docs/examples/messaging/list-messages.md +2 -2
- package/docs/examples/messaging/list-provider-logs.md +2 -2
- package/docs/examples/messaging/list-providers.md +2 -2
- package/docs/examples/messaging/list-subscriber-logs.md +2 -2
- package/docs/examples/messaging/list-subscribers.md +2 -2
- package/docs/examples/messaging/list-targets.md +2 -2
- package/docs/examples/messaging/list-topic-logs.md +2 -2
- package/docs/examples/messaging/list-topics.md +2 -2
- package/docs/examples/messaging/update-apns-provider.md +2 -2
- package/docs/examples/messaging/update-email.md +2 -2
- package/docs/examples/messaging/update-fcm-provider.md +2 -2
- package/docs/examples/messaging/update-mailgun-provider.md +2 -2
- package/docs/examples/messaging/update-msg91provider.md +2 -2
- package/docs/examples/messaging/update-push.md +2 -2
- package/docs/examples/messaging/update-sendgrid-provider.md +2 -2
- package/docs/examples/messaging/update-sms.md +2 -2
- package/docs/examples/messaging/update-smtp-provider.md +2 -2
- package/docs/examples/messaging/update-telesign-provider.md +2 -2
- package/docs/examples/messaging/update-textmagic-provider.md +2 -2
- package/docs/examples/messaging/update-topic.md +2 -2
- package/docs/examples/messaging/update-twilio-provider.md +2 -2
- package/docs/examples/messaging/update-vonage-provider.md +2 -2
- package/docs/examples/migrations/create-appwrite-migration.md +2 -2
- package/docs/examples/migrations/create-firebase-migration.md +2 -2
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +2 -2
- package/docs/examples/migrations/create-n-host-migration.md +2 -2
- package/docs/examples/migrations/create-supabase-migration.md +2 -2
- package/docs/examples/migrations/delete-firebase-auth.md +2 -2
- package/docs/examples/migrations/delete.md +2 -2
- package/docs/examples/migrations/get-appwrite-report.md +2 -2
- package/docs/examples/migrations/get-firebase-report-o-auth.md +2 -2
- package/docs/examples/migrations/get-firebase-report.md +2 -2
- package/docs/examples/migrations/get-n-host-report.md +2 -2
- package/docs/examples/migrations/get-supabase-report.md +2 -2
- package/docs/examples/migrations/get.md +2 -2
- package/docs/examples/migrations/list-firebase-projects.md +2 -2
- package/docs/examples/migrations/list.md +2 -2
- package/docs/examples/migrations/retry.md +2 -2
- package/docs/examples/project/create-variable.md +2 -2
- package/docs/examples/project/delete-variable.md +2 -2
- package/docs/examples/project/get-usage.md +2 -2
- package/docs/examples/project/get-variable.md +2 -2
- package/docs/examples/project/list-variables.md +2 -2
- package/docs/examples/project/update-variable.md +2 -2
- package/docs/examples/projects/create-j-w-t.md +15 -0
- package/docs/examples/projects/create-key.md +2 -2
- package/docs/examples/projects/create-platform.md +2 -2
- package/docs/examples/projects/create-smtp-test.md +2 -2
- package/docs/examples/projects/create-webhook.md +2 -2
- package/docs/examples/projects/create.md +2 -2
- package/docs/examples/projects/delete-email-template.md +2 -2
- package/docs/examples/projects/delete-key.md +2 -2
- package/docs/examples/projects/delete-platform.md +2 -2
- package/docs/examples/projects/delete-sms-template.md +2 -2
- package/docs/examples/projects/delete-webhook.md +2 -2
- package/docs/examples/projects/delete.md +2 -2
- package/docs/examples/projects/get-email-template.md +2 -2
- package/docs/examples/projects/get-key.md +2 -2
- package/docs/examples/projects/get-platform.md +2 -2
- package/docs/examples/projects/get-sms-template.md +2 -2
- package/docs/examples/projects/get-webhook.md +2 -2
- package/docs/examples/projects/get.md +2 -2
- package/docs/examples/projects/list-keys.md +2 -2
- package/docs/examples/projects/list-platforms.md +2 -2
- package/docs/examples/projects/list-webhooks.md +2 -2
- package/docs/examples/projects/list.md +2 -2
- package/docs/examples/projects/update-api-status-all.md +2 -2
- package/docs/examples/projects/update-api-status.md +2 -2
- package/docs/examples/projects/update-auth-duration.md +2 -2
- package/docs/examples/projects/update-auth-limit.md +2 -2
- package/docs/examples/projects/update-auth-password-dictionary.md +2 -2
- package/docs/examples/projects/update-auth-password-history.md +2 -2
- package/docs/examples/projects/update-auth-sessions-limit.md +2 -2
- package/docs/examples/projects/update-auth-status.md +2 -2
- package/docs/examples/projects/update-email-template.md +2 -2
- package/docs/examples/projects/update-key.md +2 -2
- package/docs/examples/projects/update-mock-numbers.md +14 -0
- package/docs/examples/projects/update-o-auth2.md +2 -2
- package/docs/examples/projects/update-personal-data-check.md +2 -2
- package/docs/examples/projects/update-platform.md +2 -2
- package/docs/examples/projects/update-service-status-all.md +2 -2
- package/docs/examples/projects/update-service-status.md +2 -2
- package/docs/examples/projects/update-session-alerts.md +14 -0
- package/docs/examples/projects/update-sms-template.md +2 -2
- package/docs/examples/projects/update-smtp.md +2 -2
- package/docs/examples/projects/update-team.md +2 -2
- package/docs/examples/projects/update-webhook-signature.md +2 -2
- package/docs/examples/projects/update-webhook.md +2 -2
- package/docs/examples/projects/update.md +2 -2
- package/docs/examples/proxy/create-rule.md +2 -2
- package/docs/examples/proxy/delete-rule.md +2 -2
- package/docs/examples/proxy/get-rule.md +2 -2
- package/docs/examples/proxy/list-rules.md +2 -2
- package/docs/examples/proxy/update-rule-verification.md +2 -2
- package/docs/examples/storage/create-bucket.md +2 -2
- package/docs/examples/storage/create-file.md +2 -2
- package/docs/examples/storage/delete-bucket.md +2 -2
- package/docs/examples/storage/delete-file.md +2 -2
- package/docs/examples/storage/get-bucket-usage.md +2 -2
- package/docs/examples/storage/get-bucket.md +2 -2
- 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 +2 -2
- package/docs/examples/storage/get-usage.md +2 -2
- package/docs/examples/storage/list-buckets.md +2 -2
- package/docs/examples/storage/list-files.md +2 -2
- package/docs/examples/storage/update-bucket.md +2 -2
- package/docs/examples/storage/update-file.md +2 -2
- package/docs/examples/teams/create-membership.md +2 -2
- package/docs/examples/teams/create.md +2 -2
- package/docs/examples/teams/delete-membership.md +2 -2
- package/docs/examples/teams/delete.md +2 -2
- package/docs/examples/teams/get-membership.md +2 -2
- package/docs/examples/teams/get-prefs.md +2 -2
- package/docs/examples/teams/get.md +2 -2
- package/docs/examples/teams/list-logs.md +2 -2
- package/docs/examples/teams/list-memberships.md +2 -2
- package/docs/examples/teams/list.md +2 -2
- package/docs/examples/teams/update-membership-status.md +2 -2
- package/docs/examples/teams/update-membership.md +2 -2
- package/docs/examples/teams/update-name.md +2 -2
- package/docs/examples/teams/update-prefs.md +2 -2
- package/docs/examples/users/create-argon2user.md +2 -2
- package/docs/examples/users/create-bcrypt-user.md +2 -2
- package/docs/examples/users/create-j-w-t.md +15 -0
- package/docs/examples/users/create-m-d5user.md +2 -2
- package/docs/examples/users/create-mfa-recovery-codes.md +2 -2
- package/docs/examples/users/create-p-h-pass-user.md +2 -2
- package/docs/examples/users/create-s-h-a-user.md +2 -2
- package/docs/examples/users/create-scrypt-modified-user.md +2 -2
- package/docs/examples/users/create-scrypt-user.md +2 -2
- package/docs/examples/users/create-session.md +2 -2
- package/docs/examples/users/create-target.md +2 -2
- package/docs/examples/users/create-token.md +2 -2
- package/docs/examples/users/create.md +2 -2
- package/docs/examples/users/delete-identity.md +2 -2
- package/docs/examples/users/delete-mfa-authenticator.md +2 -2
- package/docs/examples/users/delete-session.md +2 -2
- package/docs/examples/users/delete-sessions.md +2 -2
- package/docs/examples/users/delete-target.md +2 -2
- package/docs/examples/users/delete.md +2 -2
- package/docs/examples/users/get-mfa-recovery-codes.md +2 -2
- package/docs/examples/users/get-prefs.md +2 -2
- package/docs/examples/users/get-target.md +2 -2
- package/docs/examples/users/get-usage.md +2 -2
- package/docs/examples/users/get.md +2 -2
- package/docs/examples/users/list-identities.md +2 -2
- package/docs/examples/users/list-logs.md +2 -2
- package/docs/examples/users/list-memberships.md +2 -2
- package/docs/examples/users/list-mfa-factors.md +2 -2
- package/docs/examples/users/list-sessions.md +2 -2
- package/docs/examples/users/list-targets.md +2 -2
- package/docs/examples/users/list.md +2 -2
- package/docs/examples/users/update-email-verification.md +2 -2
- package/docs/examples/users/update-email.md +2 -2
- package/docs/examples/users/update-labels.md +2 -2
- package/docs/examples/users/update-mfa-recovery-codes.md +2 -2
- package/docs/examples/users/update-mfa.md +2 -2
- package/docs/examples/users/update-name.md +2 -2
- package/docs/examples/users/update-password.md +2 -2
- package/docs/examples/users/update-phone-verification.md +2 -2
- package/docs/examples/users/update-phone.md +2 -2
- package/docs/examples/users/update-prefs.md +2 -2
- package/docs/examples/users/update-status.md +2 -2
- package/docs/examples/users/update-target.md +2 -2
- package/docs/examples/vcs/create-repository-detection.md +2 -2
- package/docs/examples/vcs/create-repository.md +2 -2
- package/docs/examples/vcs/delete-installation.md +2 -2
- package/docs/examples/vcs/get-installation.md +2 -2
- package/docs/examples/vcs/get-repository-contents.md +15 -0
- package/docs/examples/vcs/get-repository.md +2 -2
- package/docs/examples/vcs/list-installations.md +2 -2
- package/docs/examples/vcs/list-repositories.md +2 -2
- package/docs/examples/vcs/list-repository-branches.md +2 -2
- package/docs/examples/vcs/update-external-deployments.md +2 -2
- package/package.json +1 -1
- package/src/client.ts +322 -51
- package/src/enums/credit-card.ts +1 -1
- package/src/enums/email-template-type.ts +2 -0
- package/src/enums/name.ts +1 -2
- package/src/enums/platform-type.ts +2 -0
- package/src/enums/runtime.ts +1 -3
- package/src/id.ts +21 -2
- package/src/index.ts +7 -0
- package/src/models.ts +299 -0
- package/src/permission.ts +41 -6
- package/src/query.ts +161 -1
- package/src/service.ts +3 -0
- package/src/services/account.ts +654 -647
- 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 +446 -321
- 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 +82 -4
- package/types/enums/credit-card.d.ts +1 -1
- package/types/enums/email-template-type.d.ts +3 -1
- package/types/enums/name.d.ts +2 -3
- package/types/enums/platform-type.d.ts +3 -1
- package/types/enums/runtime.d.ts +2 -4
- package/types/id.d.ts +15 -0
- package/types/index.d.ts +7 -0
- package/types/models.d.ts +299 -0
- package/types/permission.d.ts +36 -0
- package/types/query.d.ts +160 -0
- package/types/service.d.ts +3 -0
- package/types/services/account.d.ts +165 -320
- 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 +119 -92
- 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
package/src/services/storage.ts
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
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 { Compression } from '../enums/compression';
|
|
6
4
|
import { ImageGravity } from '../enums/image-gravity';
|
|
7
5
|
import { ImageFormat } from '../enums/image-format';
|
|
8
6
|
import { StorageUsageRange } from '../enums/storage-usage-range';
|
|
9
7
|
|
|
10
|
-
export class Storage
|
|
8
|
+
export class Storage {
|
|
9
|
+
client: Client;
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
11
|
+
constructor(client: Client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* List buckets
|
|
19
17
|
*
|
|
20
|
-
* Get a list of all the storage buckets. You can use the query params to
|
|
21
|
-
* filter your results.
|
|
18
|
+
* Get a list of all the storage buckets. You can use the query params to filter your results.
|
|
22
19
|
*
|
|
23
20
|
* @param {string[]} queries
|
|
24
21
|
* @param {string} search
|
|
25
22
|
* @throws {AppwriteException}
|
|
26
|
-
* @returns {Promise}
|
|
27
|
-
|
|
23
|
+
* @returns {Promise<Models.BucketList>}
|
|
24
|
+
*/
|
|
28
25
|
async listBuckets(queries?: string[], search?: string): Promise<Models.BucketList> {
|
|
29
26
|
const apiPath = '/storage/buckets';
|
|
30
27
|
const payload: Payload = {};
|
|
31
|
-
|
|
32
28
|
if (typeof queries !== 'undefined') {
|
|
33
29
|
payload['queries'] = queries;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
if (typeof search !== 'undefined') {
|
|
37
32
|
payload['search'] = search;
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
41
|
-
|
|
35
|
+
|
|
36
|
+
const apiHeaders: { [header: string]: string } = {
|
|
42
37
|
'content-type': 'application/json',
|
|
43
|
-
}
|
|
44
|
-
}
|
|
38
|
+
}
|
|
45
39
|
|
|
40
|
+
return await this.client.call(
|
|
41
|
+
'get',
|
|
42
|
+
uri,
|
|
43
|
+
apiHeaders,
|
|
44
|
+
payload
|
|
45
|
+
);
|
|
46
|
+
}
|
|
46
47
|
/**
|
|
47
48
|
* Create bucket
|
|
48
49
|
*
|
|
@@ -59,90 +60,88 @@ export class Storage extends Service {
|
|
|
59
60
|
* @param {boolean} encryption
|
|
60
61
|
* @param {boolean} antivirus
|
|
61
62
|
* @throws {AppwriteException}
|
|
62
|
-
* @returns {Promise}
|
|
63
|
-
|
|
63
|
+
* @returns {Promise<Models.Bucket>}
|
|
64
|
+
*/
|
|
64
65
|
async createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket> {
|
|
65
66
|
if (typeof bucketId === 'undefined') {
|
|
66
67
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
67
68
|
}
|
|
68
|
-
|
|
69
69
|
if (typeof name === 'undefined') {
|
|
70
70
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
const apiPath = '/storage/buckets';
|
|
74
73
|
const payload: Payload = {};
|
|
75
|
-
|
|
76
74
|
if (typeof bucketId !== 'undefined') {
|
|
77
75
|
payload['bucketId'] = bucketId;
|
|
78
76
|
}
|
|
79
|
-
|
|
80
77
|
if (typeof name !== 'undefined') {
|
|
81
78
|
payload['name'] = name;
|
|
82
79
|
}
|
|
83
|
-
|
|
84
80
|
if (typeof permissions !== 'undefined') {
|
|
85
81
|
payload['permissions'] = permissions;
|
|
86
82
|
}
|
|
87
|
-
|
|
88
83
|
if (typeof fileSecurity !== 'undefined') {
|
|
89
84
|
payload['fileSecurity'] = fileSecurity;
|
|
90
85
|
}
|
|
91
|
-
|
|
92
86
|
if (typeof enabled !== 'undefined') {
|
|
93
87
|
payload['enabled'] = enabled;
|
|
94
88
|
}
|
|
95
|
-
|
|
96
89
|
if (typeof maximumFileSize !== 'undefined') {
|
|
97
90
|
payload['maximumFileSize'] = maximumFileSize;
|
|
98
91
|
}
|
|
99
|
-
|
|
100
92
|
if (typeof allowedFileExtensions !== 'undefined') {
|
|
101
93
|
payload['allowedFileExtensions'] = allowedFileExtensions;
|
|
102
94
|
}
|
|
103
|
-
|
|
104
95
|
if (typeof compression !== 'undefined') {
|
|
105
96
|
payload['compression'] = compression;
|
|
106
97
|
}
|
|
107
|
-
|
|
108
98
|
if (typeof encryption !== 'undefined') {
|
|
109
99
|
payload['encryption'] = encryption;
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
if (typeof antivirus !== 'undefined') {
|
|
113
102
|
payload['antivirus'] = antivirus;
|
|
114
103
|
}
|
|
115
|
-
|
|
116
104
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
117
|
-
|
|
105
|
+
|
|
106
|
+
const apiHeaders: { [header: string]: string } = {
|
|
118
107
|
'content-type': 'application/json',
|
|
119
|
-
}
|
|
120
|
-
}
|
|
108
|
+
}
|
|
121
109
|
|
|
110
|
+
return await this.client.call(
|
|
111
|
+
'post',
|
|
112
|
+
uri,
|
|
113
|
+
apiHeaders,
|
|
114
|
+
payload
|
|
115
|
+
);
|
|
116
|
+
}
|
|
122
117
|
/**
|
|
123
118
|
* Get bucket
|
|
124
119
|
*
|
|
125
|
-
* Get a storage bucket by its unique ID. This endpoint response returns a
|
|
126
|
-
* JSON object with the storage bucket metadata.
|
|
120
|
+
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
|
|
127
121
|
*
|
|
128
122
|
* @param {string} bucketId
|
|
129
123
|
* @throws {AppwriteException}
|
|
130
|
-
* @returns {Promise}
|
|
131
|
-
|
|
124
|
+
* @returns {Promise<Models.Bucket>}
|
|
125
|
+
*/
|
|
132
126
|
async getBucket(bucketId: string): Promise<Models.Bucket> {
|
|
133
127
|
if (typeof bucketId === 'undefined') {
|
|
134
128
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
135
129
|
}
|
|
136
|
-
|
|
137
130
|
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
138
131
|
const payload: Payload = {};
|
|
139
|
-
|
|
140
132
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
141
|
-
|
|
133
|
+
|
|
134
|
+
const apiHeaders: { [header: string]: string } = {
|
|
142
135
|
'content-type': 'application/json',
|
|
143
|
-
}
|
|
144
|
-
}
|
|
136
|
+
}
|
|
145
137
|
|
|
138
|
+
return await this.client.call(
|
|
139
|
+
'get',
|
|
140
|
+
uri,
|
|
141
|
+
apiHeaders,
|
|
142
|
+
payload
|
|
143
|
+
);
|
|
144
|
+
}
|
|
146
145
|
/**
|
|
147
146
|
* Update bucket
|
|
148
147
|
*
|
|
@@ -159,62 +158,57 @@ export class Storage extends Service {
|
|
|
159
158
|
* @param {boolean} encryption
|
|
160
159
|
* @param {boolean} antivirus
|
|
161
160
|
* @throws {AppwriteException}
|
|
162
|
-
* @returns {Promise}
|
|
163
|
-
|
|
161
|
+
* @returns {Promise<Models.Bucket>}
|
|
162
|
+
*/
|
|
164
163
|
async updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket> {
|
|
165
164
|
if (typeof bucketId === 'undefined') {
|
|
166
165
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
167
166
|
}
|
|
168
|
-
|
|
169
167
|
if (typeof name === 'undefined') {
|
|
170
168
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
171
169
|
}
|
|
172
|
-
|
|
173
170
|
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
174
171
|
const payload: Payload = {};
|
|
175
|
-
|
|
176
172
|
if (typeof name !== 'undefined') {
|
|
177
173
|
payload['name'] = name;
|
|
178
174
|
}
|
|
179
|
-
|
|
180
175
|
if (typeof permissions !== 'undefined') {
|
|
181
176
|
payload['permissions'] = permissions;
|
|
182
177
|
}
|
|
183
|
-
|
|
184
178
|
if (typeof fileSecurity !== 'undefined') {
|
|
185
179
|
payload['fileSecurity'] = fileSecurity;
|
|
186
180
|
}
|
|
187
|
-
|
|
188
181
|
if (typeof enabled !== 'undefined') {
|
|
189
182
|
payload['enabled'] = enabled;
|
|
190
183
|
}
|
|
191
|
-
|
|
192
184
|
if (typeof maximumFileSize !== 'undefined') {
|
|
193
185
|
payload['maximumFileSize'] = maximumFileSize;
|
|
194
186
|
}
|
|
195
|
-
|
|
196
187
|
if (typeof allowedFileExtensions !== 'undefined') {
|
|
197
188
|
payload['allowedFileExtensions'] = allowedFileExtensions;
|
|
198
189
|
}
|
|
199
|
-
|
|
200
190
|
if (typeof compression !== 'undefined') {
|
|
201
191
|
payload['compression'] = compression;
|
|
202
192
|
}
|
|
203
|
-
|
|
204
193
|
if (typeof encryption !== 'undefined') {
|
|
205
194
|
payload['encryption'] = encryption;
|
|
206
195
|
}
|
|
207
|
-
|
|
208
196
|
if (typeof antivirus !== 'undefined') {
|
|
209
197
|
payload['antivirus'] = antivirus;
|
|
210
198
|
}
|
|
211
|
-
|
|
212
199
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
213
|
-
|
|
200
|
+
|
|
201
|
+
const apiHeaders: { [header: string]: string } = {
|
|
214
202
|
'content-type': 'application/json',
|
|
215
|
-
}
|
|
216
|
-
}
|
|
203
|
+
}
|
|
217
204
|
|
|
205
|
+
return await this.client.call(
|
|
206
|
+
'put',
|
|
207
|
+
uri,
|
|
208
|
+
apiHeaders,
|
|
209
|
+
payload
|
|
210
|
+
);
|
|
211
|
+
}
|
|
218
212
|
/**
|
|
219
213
|
* Delete bucket
|
|
220
214
|
*
|
|
@@ -222,306 +216,258 @@ export class Storage extends Service {
|
|
|
222
216
|
*
|
|
223
217
|
* @param {string} bucketId
|
|
224
218
|
* @throws {AppwriteException}
|
|
225
|
-
* @returns {Promise}
|
|
226
|
-
|
|
219
|
+
* @returns {Promise<{}>}
|
|
220
|
+
*/
|
|
227
221
|
async deleteBucket(bucketId: string): Promise<{}> {
|
|
228
222
|
if (typeof bucketId === 'undefined') {
|
|
229
223
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
230
224
|
}
|
|
231
|
-
|
|
232
225
|
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
233
226
|
const payload: Payload = {};
|
|
234
|
-
|
|
235
227
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
236
|
-
|
|
228
|
+
|
|
229
|
+
const apiHeaders: { [header: string]: string } = {
|
|
237
230
|
'content-type': 'application/json',
|
|
238
|
-
}
|
|
239
|
-
}
|
|
231
|
+
}
|
|
240
232
|
|
|
233
|
+
return await this.client.call(
|
|
234
|
+
'delete',
|
|
235
|
+
uri,
|
|
236
|
+
apiHeaders,
|
|
237
|
+
payload
|
|
238
|
+
);
|
|
239
|
+
}
|
|
241
240
|
/**
|
|
242
241
|
* List files
|
|
243
242
|
*
|
|
244
|
-
* Get a list of all the user files. You can use the query params to filter
|
|
245
|
-
* your results.
|
|
243
|
+
* Get a list of all the user files. You can use the query params to filter your results.
|
|
246
244
|
*
|
|
247
245
|
* @param {string} bucketId
|
|
248
246
|
* @param {string[]} queries
|
|
249
247
|
* @param {string} search
|
|
250
248
|
* @throws {AppwriteException}
|
|
251
|
-
* @returns {Promise}
|
|
252
|
-
|
|
249
|
+
* @returns {Promise<Models.FileList>}
|
|
250
|
+
*/
|
|
253
251
|
async listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList> {
|
|
254
252
|
if (typeof bucketId === 'undefined') {
|
|
255
253
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
256
254
|
}
|
|
257
|
-
|
|
258
255
|
const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
|
|
259
256
|
const payload: Payload = {};
|
|
260
|
-
|
|
261
257
|
if (typeof queries !== 'undefined') {
|
|
262
258
|
payload['queries'] = queries;
|
|
263
259
|
}
|
|
264
|
-
|
|
265
260
|
if (typeof search !== 'undefined') {
|
|
266
261
|
payload['search'] = search;
|
|
267
262
|
}
|
|
268
|
-
|
|
269
263
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
270
|
-
|
|
264
|
+
|
|
265
|
+
const apiHeaders: { [header: string]: string } = {
|
|
271
266
|
'content-type': 'application/json',
|
|
272
|
-
}
|
|
273
|
-
}
|
|
267
|
+
}
|
|
274
268
|
|
|
269
|
+
return await this.client.call(
|
|
270
|
+
'get',
|
|
271
|
+
uri,
|
|
272
|
+
apiHeaders,
|
|
273
|
+
payload
|
|
274
|
+
);
|
|
275
|
+
}
|
|
275
276
|
/**
|
|
276
277
|
* Create file
|
|
277
278
|
*
|
|
278
|
-
* Create a new file. Before using this route, you should create a new bucket
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* The `content-range` header values should always be in bytes.
|
|
287
|
-
*
|
|
288
|
-
* When the first request is sent, the server will return the **File** object,
|
|
289
|
-
* and the subsequent part request must include the file's **id** in
|
|
290
|
-
* `x-appwrite-id` header to allow the server to know that the partial upload
|
|
291
|
-
* is for the existing file and not for a new one.
|
|
292
|
-
*
|
|
293
|
-
* If you're creating a new file using one of the Appwrite SDKs, all the
|
|
294
|
-
* chunking logic will be managed by the SDK internally.
|
|
295
|
-
*
|
|
279
|
+
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
|
|
280
|
+
|
|
281
|
+
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
|
|
282
|
+
|
|
283
|
+
When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
|
|
284
|
+
|
|
285
|
+
If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
|
|
286
|
+
|
|
296
287
|
*
|
|
297
288
|
* @param {string} bucketId
|
|
298
289
|
* @param {string} fileId
|
|
299
290
|
* @param {File} file
|
|
300
291
|
* @param {string[]} permissions
|
|
301
292
|
* @throws {AppwriteException}
|
|
302
|
-
* @returns {Promise}
|
|
303
|
-
|
|
293
|
+
* @returns {Promise<Models.File>}
|
|
294
|
+
*/
|
|
304
295
|
async createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress = (progress: UploadProgress) => {}): Promise<Models.File> {
|
|
305
296
|
if (typeof bucketId === 'undefined') {
|
|
306
297
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
307
298
|
}
|
|
308
|
-
|
|
309
299
|
if (typeof fileId === 'undefined') {
|
|
310
300
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
311
301
|
}
|
|
312
|
-
|
|
313
302
|
if (typeof file === 'undefined') {
|
|
314
303
|
throw new AppwriteException('Missing required parameter: "file"');
|
|
315
304
|
}
|
|
316
|
-
|
|
317
305
|
const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
|
|
318
306
|
const payload: Payload = {};
|
|
319
|
-
|
|
320
307
|
if (typeof fileId !== 'undefined') {
|
|
321
308
|
payload['fileId'] = fileId;
|
|
322
309
|
}
|
|
323
|
-
|
|
324
310
|
if (typeof file !== 'undefined') {
|
|
325
311
|
payload['file'] = file;
|
|
326
312
|
}
|
|
327
|
-
|
|
328
313
|
if (typeof permissions !== 'undefined') {
|
|
329
314
|
payload['permissions'] = permissions;
|
|
330
315
|
}
|
|
331
|
-
|
|
332
316
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
333
317
|
|
|
334
|
-
if(!(file instanceof File)) {
|
|
335
|
-
throw new AppwriteException('Parameter "file" has to be a File.');
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
const size = file.size;
|
|
339
|
-
|
|
340
|
-
if (size <= Service.CHUNK_SIZE) {
|
|
341
|
-
return await this.client.call('post', uri, {
|
|
342
|
-
'content-type': 'multipart/form-data',
|
|
343
|
-
}, payload);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
318
|
const apiHeaders: { [header: string]: string } = {
|
|
347
319
|
'content-type': 'multipart/form-data',
|
|
348
320
|
}
|
|
349
321
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
while (offset < size) {
|
|
361
|
-
let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
|
|
362
|
-
|
|
363
|
-
apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
|
|
364
|
-
if (response && response.$id) {
|
|
365
|
-
apiHeaders['x-appwrite-id'] = response.$id;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
const chunk = file.slice(offset, end + 1);
|
|
369
|
-
payload['file'] = new File([chunk], file.name);
|
|
370
|
-
response = await this.client.call('post', uri, apiHeaders, payload);
|
|
371
|
-
|
|
372
|
-
if (onProgress) {
|
|
373
|
-
onProgress({
|
|
374
|
-
$id: response.$id,
|
|
375
|
-
progress: (offset / size) * 100,
|
|
376
|
-
sizeUploaded: offset,
|
|
377
|
-
chunksTotal: response.chunksTotal,
|
|
378
|
-
chunksUploaded: response.chunksUploaded
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
offset += Service.CHUNK_SIZE;
|
|
382
|
-
}
|
|
383
|
-
return response;
|
|
322
|
+
return await this.client.chunkedUpload(
|
|
323
|
+
'post',
|
|
324
|
+
uri,
|
|
325
|
+
apiHeaders,
|
|
326
|
+
payload,
|
|
327
|
+
onProgress
|
|
328
|
+
);
|
|
384
329
|
}
|
|
385
|
-
|
|
386
330
|
/**
|
|
387
331
|
* Get file
|
|
388
332
|
*
|
|
389
|
-
* Get a file by its unique ID. This endpoint response returns a JSON object
|
|
390
|
-
* with the file metadata.
|
|
333
|
+
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
|
|
391
334
|
*
|
|
392
335
|
* @param {string} bucketId
|
|
393
336
|
* @param {string} fileId
|
|
394
337
|
* @throws {AppwriteException}
|
|
395
|
-
* @returns {Promise}
|
|
396
|
-
|
|
338
|
+
* @returns {Promise<Models.File>}
|
|
339
|
+
*/
|
|
397
340
|
async getFile(bucketId: string, fileId: string): Promise<Models.File> {
|
|
398
341
|
if (typeof bucketId === 'undefined') {
|
|
399
342
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
400
343
|
}
|
|
401
|
-
|
|
402
344
|
if (typeof fileId === 'undefined') {
|
|
403
345
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
404
346
|
}
|
|
405
|
-
|
|
406
347
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
407
348
|
const payload: Payload = {};
|
|
408
|
-
|
|
409
349
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
410
|
-
|
|
350
|
+
|
|
351
|
+
const apiHeaders: { [header: string]: string } = {
|
|
411
352
|
'content-type': 'application/json',
|
|
412
|
-
}
|
|
413
|
-
}
|
|
353
|
+
}
|
|
414
354
|
|
|
355
|
+
return await this.client.call(
|
|
356
|
+
'get',
|
|
357
|
+
uri,
|
|
358
|
+
apiHeaders,
|
|
359
|
+
payload
|
|
360
|
+
);
|
|
361
|
+
}
|
|
415
362
|
/**
|
|
416
363
|
* Update file
|
|
417
364
|
*
|
|
418
|
-
* Update a file by its unique ID. Only users with write permissions have
|
|
419
|
-
* access to update this resource.
|
|
365
|
+
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
|
|
420
366
|
*
|
|
421
367
|
* @param {string} bucketId
|
|
422
368
|
* @param {string} fileId
|
|
423
369
|
* @param {string} name
|
|
424
370
|
* @param {string[]} permissions
|
|
425
371
|
* @throws {AppwriteException}
|
|
426
|
-
* @returns {Promise}
|
|
427
|
-
|
|
372
|
+
* @returns {Promise<Models.File>}
|
|
373
|
+
*/
|
|
428
374
|
async updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File> {
|
|
429
375
|
if (typeof bucketId === 'undefined') {
|
|
430
376
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
431
377
|
}
|
|
432
|
-
|
|
433
378
|
if (typeof fileId === 'undefined') {
|
|
434
379
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
435
380
|
}
|
|
436
|
-
|
|
437
381
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
438
382
|
const payload: Payload = {};
|
|
439
|
-
|
|
440
383
|
if (typeof name !== 'undefined') {
|
|
441
384
|
payload['name'] = name;
|
|
442
385
|
}
|
|
443
|
-
|
|
444
386
|
if (typeof permissions !== 'undefined') {
|
|
445
387
|
payload['permissions'] = permissions;
|
|
446
388
|
}
|
|
447
|
-
|
|
448
389
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
449
|
-
|
|
390
|
+
|
|
391
|
+
const apiHeaders: { [header: string]: string } = {
|
|
450
392
|
'content-type': 'application/json',
|
|
451
|
-
}
|
|
452
|
-
}
|
|
393
|
+
}
|
|
453
394
|
|
|
395
|
+
return await this.client.call(
|
|
396
|
+
'put',
|
|
397
|
+
uri,
|
|
398
|
+
apiHeaders,
|
|
399
|
+
payload
|
|
400
|
+
);
|
|
401
|
+
}
|
|
454
402
|
/**
|
|
455
403
|
* Delete File
|
|
456
404
|
*
|
|
457
|
-
* Delete a file by its unique ID. Only users with write permissions have
|
|
458
|
-
* access to delete this resource.
|
|
405
|
+
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
|
|
459
406
|
*
|
|
460
407
|
* @param {string} bucketId
|
|
461
408
|
* @param {string} fileId
|
|
462
409
|
* @throws {AppwriteException}
|
|
463
|
-
* @returns {Promise}
|
|
464
|
-
|
|
410
|
+
* @returns {Promise<{}>}
|
|
411
|
+
*/
|
|
465
412
|
async deleteFile(bucketId: string, fileId: string): Promise<{}> {
|
|
466
413
|
if (typeof bucketId === 'undefined') {
|
|
467
414
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
468
415
|
}
|
|
469
|
-
|
|
470
416
|
if (typeof fileId === 'undefined') {
|
|
471
417
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
472
418
|
}
|
|
473
|
-
|
|
474
419
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
475
420
|
const payload: Payload = {};
|
|
476
|
-
|
|
477
421
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
478
|
-
|
|
422
|
+
|
|
423
|
+
const apiHeaders: { [header: string]: string } = {
|
|
479
424
|
'content-type': 'application/json',
|
|
480
|
-
}
|
|
481
|
-
}
|
|
425
|
+
}
|
|
482
426
|
|
|
427
|
+
return await this.client.call(
|
|
428
|
+
'delete',
|
|
429
|
+
uri,
|
|
430
|
+
apiHeaders,
|
|
431
|
+
payload
|
|
432
|
+
);
|
|
433
|
+
}
|
|
483
434
|
/**
|
|
484
435
|
* Get file for download
|
|
485
436
|
*
|
|
486
|
-
* Get a file content by its unique ID. The endpoint response return with a
|
|
487
|
-
* 'Content-Disposition: attachment' header that tells the browser to start
|
|
488
|
-
* downloading the file to user downloads directory.
|
|
437
|
+
* Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
|
|
489
438
|
*
|
|
490
439
|
* @param {string} bucketId
|
|
491
440
|
* @param {string} fileId
|
|
492
441
|
* @throws {AppwriteException}
|
|
493
|
-
* @returns {
|
|
494
|
-
|
|
495
|
-
getFileDownload(bucketId: string, fileId: string):
|
|
442
|
+
* @returns {string}
|
|
443
|
+
*/
|
|
444
|
+
getFileDownload(bucketId: string, fileId: string): string {
|
|
496
445
|
if (typeof bucketId === 'undefined') {
|
|
497
446
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
498
447
|
}
|
|
499
|
-
|
|
500
448
|
if (typeof fileId === 'undefined') {
|
|
501
449
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
502
450
|
}
|
|
503
|
-
|
|
504
451
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
505
452
|
const payload: Payload = {};
|
|
506
|
-
|
|
507
453
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
508
|
-
payload['project'] = this.client.config.project;
|
|
509
454
|
|
|
455
|
+
const apiHeaders: { [header: string]: string } = {
|
|
456
|
+
'content-type': 'application/json',
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
payload['project'] = this.client.config.project;
|
|
510
460
|
|
|
511
|
-
for (const [key, value] of Object.entries(
|
|
461
|
+
for (const [key, value] of Object.entries(Client.flatten(payload))) {
|
|
512
462
|
uri.searchParams.append(key, value);
|
|
513
463
|
}
|
|
514
|
-
return uri;
|
|
515
|
-
}
|
|
516
464
|
|
|
465
|
+
return uri.toString();
|
|
466
|
+
}
|
|
517
467
|
/**
|
|
518
468
|
* Get file preview
|
|
519
469
|
*
|
|
520
|
-
* Get a file preview image. Currently, this method supports preview for image
|
|
521
|
-
* files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
|
|
522
|
-
* and spreadsheets, will return the file icon image. You can also pass query
|
|
523
|
-
* string arguments for cutting and resizing your preview image. Preview is
|
|
524
|
-
* supported only for image files smaller than 10MB.
|
|
470
|
+
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
|
|
525
471
|
*
|
|
526
472
|
* @param {string} bucketId
|
|
527
473
|
* @param {string} fileId
|
|
@@ -537,130 +483,124 @@ export class Storage extends Service {
|
|
|
537
483
|
* @param {string} background
|
|
538
484
|
* @param {ImageFormat} output
|
|
539
485
|
* @throws {AppwriteException}
|
|
540
|
-
* @returns {
|
|
541
|
-
|
|
542
|
-
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat):
|
|
486
|
+
* @returns {string}
|
|
487
|
+
*/
|
|
488
|
+
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): string {
|
|
543
489
|
if (typeof bucketId === 'undefined') {
|
|
544
490
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
545
491
|
}
|
|
546
|
-
|
|
547
492
|
if (typeof fileId === 'undefined') {
|
|
548
493
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
549
494
|
}
|
|
550
|
-
|
|
551
495
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
552
496
|
const payload: Payload = {};
|
|
553
|
-
|
|
554
497
|
if (typeof width !== 'undefined') {
|
|
555
498
|
payload['width'] = width;
|
|
556
499
|
}
|
|
557
|
-
|
|
558
500
|
if (typeof height !== 'undefined') {
|
|
559
501
|
payload['height'] = height;
|
|
560
502
|
}
|
|
561
|
-
|
|
562
503
|
if (typeof gravity !== 'undefined') {
|
|
563
504
|
payload['gravity'] = gravity;
|
|
564
505
|
}
|
|
565
|
-
|
|
566
506
|
if (typeof quality !== 'undefined') {
|
|
567
507
|
payload['quality'] = quality;
|
|
568
508
|
}
|
|
569
|
-
|
|
570
509
|
if (typeof borderWidth !== 'undefined') {
|
|
571
510
|
payload['borderWidth'] = borderWidth;
|
|
572
511
|
}
|
|
573
|
-
|
|
574
512
|
if (typeof borderColor !== 'undefined') {
|
|
575
513
|
payload['borderColor'] = borderColor;
|
|
576
514
|
}
|
|
577
|
-
|
|
578
515
|
if (typeof borderRadius !== 'undefined') {
|
|
579
516
|
payload['borderRadius'] = borderRadius;
|
|
580
517
|
}
|
|
581
|
-
|
|
582
518
|
if (typeof opacity !== 'undefined') {
|
|
583
519
|
payload['opacity'] = opacity;
|
|
584
520
|
}
|
|
585
|
-
|
|
586
521
|
if (typeof rotation !== 'undefined') {
|
|
587
522
|
payload['rotation'] = rotation;
|
|
588
523
|
}
|
|
589
|
-
|
|
590
524
|
if (typeof background !== 'undefined') {
|
|
591
525
|
payload['background'] = background;
|
|
592
526
|
}
|
|
593
|
-
|
|
594
527
|
if (typeof output !== 'undefined') {
|
|
595
528
|
payload['output'] = output;
|
|
596
529
|
}
|
|
597
|
-
|
|
598
530
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
599
|
-
payload['project'] = this.client.config.project;
|
|
600
531
|
|
|
532
|
+
const apiHeaders: { [header: string]: string } = {
|
|
533
|
+
'content-type': 'application/json',
|
|
534
|
+
}
|
|
601
535
|
|
|
602
|
-
|
|
536
|
+
payload['project'] = this.client.config.project;
|
|
537
|
+
|
|
538
|
+
for (const [key, value] of Object.entries(Client.flatten(payload))) {
|
|
603
539
|
uri.searchParams.append(key, value);
|
|
604
540
|
}
|
|
605
|
-
return uri;
|
|
606
|
-
}
|
|
607
541
|
|
|
542
|
+
return uri.toString();
|
|
543
|
+
}
|
|
608
544
|
/**
|
|
609
545
|
* Get file for view
|
|
610
546
|
*
|
|
611
|
-
* Get a file content by its unique ID. This endpoint is similar to the
|
|
612
|
-
* download method but returns with no 'Content-Disposition: attachment'
|
|
613
|
-
* header.
|
|
547
|
+
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
|
|
614
548
|
*
|
|
615
549
|
* @param {string} bucketId
|
|
616
550
|
* @param {string} fileId
|
|
617
551
|
* @throws {AppwriteException}
|
|
618
|
-
* @returns {
|
|
619
|
-
|
|
620
|
-
getFileView(bucketId: string, fileId: string):
|
|
552
|
+
* @returns {string}
|
|
553
|
+
*/
|
|
554
|
+
getFileView(bucketId: string, fileId: string): string {
|
|
621
555
|
if (typeof bucketId === 'undefined') {
|
|
622
556
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
623
557
|
}
|
|
624
|
-
|
|
625
558
|
if (typeof fileId === 'undefined') {
|
|
626
559
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
627
560
|
}
|
|
628
|
-
|
|
629
561
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
630
562
|
const payload: Payload = {};
|
|
631
|
-
|
|
632
563
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
633
|
-
payload['project'] = this.client.config.project;
|
|
634
564
|
|
|
565
|
+
const apiHeaders: { [header: string]: string } = {
|
|
566
|
+
'content-type': 'application/json',
|
|
567
|
+
}
|
|
635
568
|
|
|
636
|
-
|
|
569
|
+
payload['project'] = this.client.config.project;
|
|
570
|
+
|
|
571
|
+
for (const [key, value] of Object.entries(Client.flatten(payload))) {
|
|
637
572
|
uri.searchParams.append(key, value);
|
|
638
573
|
}
|
|
639
|
-
return uri;
|
|
640
|
-
}
|
|
641
574
|
|
|
575
|
+
return uri.toString();
|
|
576
|
+
}
|
|
642
577
|
/**
|
|
643
578
|
* Get storage usage stats
|
|
644
579
|
*
|
|
645
580
|
*
|
|
646
581
|
* @param {StorageUsageRange} range
|
|
647
582
|
* @throws {AppwriteException}
|
|
648
|
-
* @returns {Promise}
|
|
649
|
-
|
|
583
|
+
* @returns {Promise<Models.UsageStorage>}
|
|
584
|
+
*/
|
|
650
585
|
async getUsage(range?: StorageUsageRange): Promise<Models.UsageStorage> {
|
|
651
586
|
const apiPath = '/storage/usage';
|
|
652
587
|
const payload: Payload = {};
|
|
653
|
-
|
|
654
588
|
if (typeof range !== 'undefined') {
|
|
655
589
|
payload['range'] = range;
|
|
656
590
|
}
|
|
657
|
-
|
|
658
591
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
659
|
-
|
|
592
|
+
|
|
593
|
+
const apiHeaders: { [header: string]: string } = {
|
|
660
594
|
'content-type': 'application/json',
|
|
661
|
-
}
|
|
662
|
-
}
|
|
595
|
+
}
|
|
663
596
|
|
|
597
|
+
return await this.client.call(
|
|
598
|
+
'get',
|
|
599
|
+
uri,
|
|
600
|
+
apiHeaders,
|
|
601
|
+
payload
|
|
602
|
+
);
|
|
603
|
+
}
|
|
664
604
|
/**
|
|
665
605
|
* Get bucket usage stats
|
|
666
606
|
*
|
|
@@ -668,23 +608,28 @@ export class Storage extends Service {
|
|
|
668
608
|
* @param {string} bucketId
|
|
669
609
|
* @param {StorageUsageRange} range
|
|
670
610
|
* @throws {AppwriteException}
|
|
671
|
-
* @returns {Promise}
|
|
672
|
-
|
|
611
|
+
* @returns {Promise<Models.UsageBuckets>}
|
|
612
|
+
*/
|
|
673
613
|
async getBucketUsage(bucketId: string, range?: StorageUsageRange): Promise<Models.UsageBuckets> {
|
|
674
614
|
if (typeof bucketId === 'undefined') {
|
|
675
615
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
676
616
|
}
|
|
677
|
-
|
|
678
617
|
const apiPath = '/storage/{bucketId}/usage'.replace('{bucketId}', bucketId);
|
|
679
618
|
const payload: Payload = {};
|
|
680
|
-
|
|
681
619
|
if (typeof range !== 'undefined') {
|
|
682
620
|
payload['range'] = range;
|
|
683
621
|
}
|
|
684
|
-
|
|
685
622
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
686
|
-
|
|
623
|
+
|
|
624
|
+
const apiHeaders: { [header: string]: string } = {
|
|
687
625
|
'content-type': 'application/json',
|
|
688
|
-
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
return await this.client.call(
|
|
629
|
+
'get',
|
|
630
|
+
uri,
|
|
631
|
+
apiHeaders,
|
|
632
|
+
payload
|
|
633
|
+
);
|
|
689
634
|
}
|
|
690
|
-
}
|
|
635
|
+
}
|