@appwrite.io/console 0.6.0-rc.8 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +32 -0
- package/README.md +6 -6
- package/dist/cjs/sdk.js +1839 -338
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1840 -339
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +1839 -338
- package/docs/examples/account/create-anonymous-session.md +5 -12
- package/docs/examples/account/create-email-password-session.md +8 -12
- package/docs/examples/account/create-email-token.md +9 -12
- package/docs/examples/account/create-j-w-t.md +5 -12
- package/docs/examples/account/create-magic-u-r-l-token.md +10 -12
- package/docs/examples/account/create-mfa-authenticator.md +13 -0
- package/docs/examples/account/create-mfa-challenge.md +13 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/create-o-auth2session.md +10 -9
- package/docs/examples/account/create-o-auth2token.md +15 -0
- package/docs/examples/account/create-phone-token.md +8 -12
- package/docs/examples/account/create-phone-verification.md +5 -12
- package/docs/examples/account/create-push-target.md +9 -12
- package/docs/examples/account/create-recovery.md +8 -12
- package/docs/examples/account/create-session.md +8 -12
- package/docs/examples/account/create-verification.md +7 -12
- package/docs/examples/account/create.md +10 -12
- package/docs/examples/account/delete-identity.md +7 -12
- package/docs/examples/account/delete-mfa-authenticator.md +14 -0
- package/docs/examples/account/delete-push-target.md +13 -0
- package/docs/examples/account/delete-session.md +7 -12
- package/docs/examples/account/delete-sessions.md +5 -12
- package/docs/examples/account/delete.md +5 -12
- package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/get-prefs.md +5 -12
- package/docs/examples/account/get-session.md +7 -12
- package/docs/examples/account/get.md +5 -12
- package/docs/examples/account/list-identities.md +7 -12
- package/docs/examples/account/list-logs.md +7 -12
- package/docs/examples/account/list-mfa-factors.md +11 -0
- package/docs/examples/account/list-sessions.md +5 -12
- package/docs/examples/account/update-email.md +8 -12
- package/docs/examples/account/update-m-f-a.md +7 -12
- package/docs/examples/account/update-magic-u-r-l-session.md +8 -12
- package/docs/examples/account/update-mfa-authenticator.md +14 -0
- package/docs/examples/account/update-mfa-challenge.md +14 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/update-name.md +7 -12
- package/docs/examples/account/update-password.md +8 -12
- package/docs/examples/account/update-phone-session.md +14 -0
- package/docs/examples/account/update-phone-verification.md +8 -12
- package/docs/examples/account/update-phone.md +8 -12
- package/docs/examples/account/update-prefs.md +7 -12
- package/docs/examples/account/update-push-target.md +8 -12
- package/docs/examples/account/update-recovery.md +9 -12
- package/docs/examples/account/update-session.md +7 -12
- package/docs/examples/account/update-status.md +5 -12
- package/docs/examples/account/update-verification.md +8 -12
- package/docs/examples/assistant/chat.md +7 -12
- package/docs/examples/avatars/get-browser.md +11 -9
- package/docs/examples/avatars/get-credit-card.md +11 -9
- package/docs/examples/avatars/get-favicon.md +7 -8
- package/docs/examples/avatars/get-flag.md +11 -9
- package/docs/examples/avatars/get-image.md +9 -8
- package/docs/examples/avatars/get-initials.md +10 -8
- package/docs/examples/avatars/get-q-r.md +10 -8
- package/docs/examples/console/variables.md +5 -12
- package/docs/examples/databases/create-boolean-attribute.md +12 -12
- package/docs/examples/databases/create-collection.md +12 -12
- package/docs/examples/databases/create-datetime-attribute.md +12 -12
- package/docs/examples/databases/create-document.md +11 -12
- package/docs/examples/databases/create-email-attribute.md +12 -12
- package/docs/examples/databases/create-enum-attribute.md +13 -12
- package/docs/examples/databases/create-float-attribute.md +14 -12
- package/docs/examples/databases/create-index.md +13 -13
- package/docs/examples/databases/create-integer-attribute.md +14 -12
- package/docs/examples/databases/create-ip-attribute.md +12 -12
- package/docs/examples/databases/create-relationship-attribute.md +15 -13
- package/docs/examples/databases/create-string-attribute.md +14 -12
- package/docs/examples/databases/create-url-attribute.md +12 -12
- package/docs/examples/databases/create.md +9 -12
- package/docs/examples/databases/delete-attribute.md +9 -12
- package/docs/examples/databases/delete-collection.md +8 -12
- package/docs/examples/databases/delete-document.md +9 -12
- package/docs/examples/databases/delete-index.md +9 -12
- package/docs/examples/databases/delete.md +7 -12
- package/docs/examples/databases/get-attribute.md +9 -12
- package/docs/examples/databases/get-collection-usage.md +10 -13
- package/docs/examples/databases/get-collection.md +8 -12
- package/docs/examples/databases/get-database-usage.md +9 -13
- package/docs/examples/databases/get-document.md +10 -12
- package/docs/examples/databases/get-index.md +9 -12
- package/docs/examples/databases/get-usage.md +8 -13
- package/docs/examples/databases/get.md +7 -12
- package/docs/examples/databases/list-attributes.md +9 -12
- package/docs/examples/databases/list-collection-logs.md +9 -12
- package/docs/examples/databases/list-collections.md +9 -12
- package/docs/examples/databases/list-document-logs.md +10 -12
- package/docs/examples/databases/list-documents.md +9 -12
- package/docs/examples/databases/list-indexes.md +9 -12
- package/docs/examples/databases/list-logs.md +8 -12
- package/docs/examples/databases/list.md +8 -12
- package/docs/examples/databases/update-boolean-attribute.md +11 -12
- package/docs/examples/databases/update-collection.md +12 -12
- package/docs/examples/databases/update-datetime-attribute.md +11 -12
- package/docs/examples/databases/update-document.md +11 -12
- package/docs/examples/databases/update-email-attribute.md +11 -12
- package/docs/examples/databases/update-enum-attribute.md +12 -12
- package/docs/examples/databases/update-float-attribute.md +13 -12
- package/docs/examples/databases/update-integer-attribute.md +13 -12
- package/docs/examples/databases/update-ip-attribute.md +11 -12
- package/docs/examples/databases/update-relationship-attribute.md +11 -13
- package/docs/examples/databases/update-string-attribute.md +11 -12
- package/docs/examples/databases/update-url-attribute.md +11 -12
- package/docs/examples/databases/update.md +9 -12
- package/docs/examples/functions/create-build.md +9 -12
- package/docs/examples/functions/create-deployment.md +11 -12
- package/docs/examples/functions/create-execution.md +13 -13
- package/docs/examples/functions/create-variable.md +9 -12
- package/docs/examples/functions/create.md +27 -13
- package/docs/examples/functions/delete-deployment.md +8 -12
- package/docs/examples/functions/delete-variable.md +8 -12
- package/docs/examples/functions/delete.md +7 -12
- package/docs/examples/functions/download-deployment.md +8 -8
- package/docs/examples/functions/get-deployment.md +8 -12
- package/docs/examples/functions/get-execution.md +8 -12
- package/docs/examples/functions/get-function-usage.md +9 -13
- package/docs/examples/functions/get-usage.md +8 -13
- package/docs/examples/functions/get-variable.md +8 -12
- package/docs/examples/functions/get.md +7 -12
- package/docs/examples/functions/list-deployments.md +9 -12
- package/docs/examples/functions/list-executions.md +9 -12
- package/docs/examples/functions/list-runtimes.md +5 -12
- package/docs/examples/functions/list-variables.md +7 -12
- package/docs/examples/functions/list.md +8 -12
- package/docs/examples/functions/update-deployment.md +8 -12
- package/docs/examples/functions/update-variable.md +10 -12
- package/docs/examples/functions/update.md +23 -13
- package/docs/examples/graphql/mutation.md +7 -12
- package/docs/examples/graphql/query.md +7 -12
- package/docs/examples/health/get-antivirus.md +5 -12
- package/docs/examples/health/get-cache.md +5 -12
- package/docs/examples/health/get-certificate.md +13 -0
- package/docs/examples/health/get-d-b.md +5 -12
- package/docs/examples/health/get-failed-jobs.md +14 -0
- package/docs/examples/health/get-pub-sub.md +5 -12
- package/docs/examples/health/get-queue-builds.md +7 -12
- package/docs/examples/health/get-queue-certificates.md +7 -12
- package/docs/examples/health/get-queue-databases.md +8 -12
- package/docs/examples/health/get-queue-deletes.md +7 -12
- package/docs/examples/health/get-queue-functions.md +7 -12
- package/docs/examples/health/get-queue-logs.md +7 -12
- package/docs/examples/health/get-queue-mails.md +7 -12
- package/docs/examples/health/get-queue-messaging.md +7 -12
- package/docs/examples/health/get-queue-migrations.md +7 -12
- package/docs/examples/health/get-queue-usage-dump.md +13 -0
- package/docs/examples/health/get-queue-usage.md +13 -0
- package/docs/examples/health/get-queue-webhooks.md +7 -12
- package/docs/examples/health/get-queue.md +5 -12
- package/docs/examples/health/get-storage-local.md +5 -12
- package/docs/examples/health/get-storage.md +11 -0
- package/docs/examples/health/get-time.md +5 -12
- package/docs/examples/health/get.md +5 -12
- package/docs/examples/locale/get.md +5 -12
- package/docs/examples/locale/list-codes.md +5 -12
- package/docs/examples/locale/list-continents.md +5 -12
- package/docs/examples/locale/list-countries-e-u.md +5 -12
- package/docs/examples/locale/list-countries-phones.md +5 -12
- package/docs/examples/locale/list-countries.md +5 -12
- package/docs/examples/locale/list-currencies.md +5 -12
- package/docs/examples/locale/list-languages.md +5 -12
- package/docs/examples/messaging/create-apns-provider.md +20 -0
- package/docs/examples/messaging/create-email.md +18 -12
- package/docs/examples/messaging/create-fcm-provider.md +16 -0
- package/docs/examples/messaging/create-mailgun-provider.md +16 -12
- package/docs/examples/messaging/create-msg91provider.md +12 -12
- package/docs/examples/messaging/create-push.md +22 -12
- package/docs/examples/messaging/create-sendgrid-provider.md +14 -12
- package/docs/examples/messaging/create-sms.md +19 -0
- package/docs/examples/messaging/create-smtp-provider.md +26 -0
- package/docs/examples/messaging/create-subscriber.md +9 -12
- package/docs/examples/messaging/create-telesign-provider.md +12 -12
- package/docs/examples/messaging/create-textmagic-provider.md +12 -12
- package/docs/examples/messaging/create-topic.md +9 -12
- package/docs/examples/messaging/create-twilio-provider.md +12 -12
- package/docs/examples/messaging/create-vonage-provider.md +12 -12
- package/docs/examples/messaging/delete-provider.md +7 -12
- package/docs/examples/messaging/delete-subscriber.md +8 -12
- package/docs/examples/messaging/delete-topic.md +7 -12
- package/docs/examples/messaging/delete.md +13 -0
- package/docs/examples/messaging/get-message.md +7 -12
- package/docs/examples/messaging/get-provider.md +7 -12
- package/docs/examples/messaging/get-subscriber.md +8 -12
- package/docs/examples/messaging/get-topic.md +7 -12
- package/docs/examples/messaging/list-message-logs.md +8 -12
- package/docs/examples/messaging/list-messages.md +8 -12
- package/docs/examples/messaging/list-provider-logs.md +8 -12
- package/docs/examples/messaging/list-providers.md +8 -12
- package/docs/examples/messaging/list-subscriber-logs.md +8 -12
- package/docs/examples/messaging/list-subscribers.md +9 -12
- package/docs/examples/messaging/list-targets.md +8 -12
- package/docs/examples/messaging/list-topic-logs.md +8 -12
- package/docs/examples/messaging/list-topics.md +8 -12
- package/docs/examples/messaging/update-apns-provider.md +20 -0
- package/docs/examples/messaging/update-email.md +17 -12
- package/docs/examples/messaging/update-fcm-provider.md +16 -0
- package/docs/examples/messaging/update-mailgun-provider.md +16 -12
- package/docs/examples/messaging/update-msg91provider.md +12 -12
- package/docs/examples/messaging/update-push.md +28 -0
- package/docs/examples/messaging/update-sendgrid-provider.md +14 -12
- package/docs/examples/messaging/update-sms.md +19 -0
- package/docs/examples/messaging/update-smtp-provider.md +26 -0
- package/docs/examples/messaging/update-telesign-provider.md +12 -12
- package/docs/examples/messaging/update-textmagic-provider.md +12 -12
- package/docs/examples/messaging/update-topic.md +9 -12
- package/docs/examples/messaging/update-twilio-provider.md +12 -12
- package/docs/examples/messaging/update-vonage-provider.md +12 -12
- package/docs/examples/migrations/create-appwrite-migration.md +10 -12
- package/docs/examples/migrations/create-firebase-migration.md +8 -12
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +8 -12
- package/docs/examples/migrations/create-n-host-migration.md +14 -12
- package/docs/examples/migrations/create-supabase-migration.md +13 -12
- package/docs/examples/migrations/delete-firebase-auth.md +5 -12
- package/docs/examples/migrations/delete.md +7 -12
- package/docs/examples/migrations/get-appwrite-report.md +10 -12
- package/docs/examples/migrations/get-firebase-report-o-auth.md +8 -12
- package/docs/examples/migrations/get-firebase-report.md +8 -12
- package/docs/examples/migrations/get-n-host-report.md +14 -12
- package/docs/examples/migrations/get-supabase-report.md +13 -12
- package/docs/examples/migrations/get.md +7 -12
- package/docs/examples/migrations/list-firebase-projects.md +5 -12
- package/docs/examples/migrations/list.md +8 -12
- package/docs/examples/migrations/retry.md +7 -12
- package/docs/examples/project/create-variable.md +8 -12
- package/docs/examples/project/delete-variable.md +7 -12
- package/docs/examples/project/get-usage.md +10 -13
- package/docs/examples/project/get-variable.md +7 -12
- package/docs/examples/project/list-variables.md +5 -12
- package/docs/examples/project/update-variable.md +9 -12
- package/docs/examples/projects/create-key.md +10 -12
- package/docs/examples/projects/create-platform.md +13 -13
- package/docs/examples/projects/create-smtp-test.md +17 -13
- package/docs/examples/projects/create-webhook.md +14 -12
- package/docs/examples/projects/create.md +20 -13
- package/docs/examples/projects/delete-email-template.md +10 -13
- package/docs/examples/projects/delete-key.md +8 -12
- package/docs/examples/projects/delete-platform.md +8 -12
- package/docs/examples/projects/delete-sms-template.md +10 -13
- package/docs/examples/projects/delete-webhook.md +8 -12
- package/docs/examples/projects/delete.md +7 -12
- package/docs/examples/projects/get-email-template.md +10 -13
- package/docs/examples/projects/get-key.md +8 -12
- package/docs/examples/projects/get-platform.md +8 -12
- package/docs/examples/projects/get-sms-template.md +10 -13
- package/docs/examples/projects/get-webhook.md +8 -12
- package/docs/examples/projects/get.md +7 -12
- package/docs/examples/projects/list-keys.md +7 -12
- package/docs/examples/projects/list-platforms.md +7 -12
- package/docs/examples/projects/list-webhooks.md +7 -12
- package/docs/examples/projects/list.md +8 -12
- package/docs/examples/projects/update-api-status-all.md +14 -0
- package/docs/examples/projects/update-api-status.md +15 -0
- package/docs/examples/projects/update-auth-duration.md +8 -12
- package/docs/examples/projects/update-auth-limit.md +8 -12
- package/docs/examples/projects/update-auth-password-dictionary.md +8 -12
- package/docs/examples/projects/update-auth-password-history.md +8 -12
- package/docs/examples/projects/update-auth-sessions-limit.md +8 -12
- package/docs/examples/projects/update-auth-status.md +10 -13
- package/docs/examples/projects/update-email-template.md +15 -13
- package/docs/examples/projects/update-key.md +11 -12
- package/docs/examples/projects/update-o-auth2.md +12 -13
- package/docs/examples/projects/update-personal-data-check.md +8 -12
- package/docs/examples/projects/update-platform.md +12 -12
- package/docs/examples/projects/update-service-status-all.md +8 -12
- package/docs/examples/projects/update-service-status.md +10 -13
- package/docs/examples/projects/update-sms-template.md +11 -13
- package/docs/examples/projects/update-smtp.md +17 -13
- package/docs/examples/projects/update-team.md +8 -12
- package/docs/examples/projects/update-webhook-signature.md +8 -12
- package/docs/examples/projects/update-webhook.md +15 -12
- package/docs/examples/projects/update.md +17 -12
- package/docs/examples/proxy/create-rule.md +10 -13
- package/docs/examples/proxy/delete-rule.md +7 -12
- package/docs/examples/proxy/get-rule.md +7 -12
- package/docs/examples/proxy/list-rules.md +8 -12
- package/docs/examples/proxy/update-rule-verification.md +7 -12
- package/docs/examples/storage/create-bucket.md +17 -13
- package/docs/examples/storage/create-file.md +10 -12
- package/docs/examples/storage/delete-bucket.md +7 -12
- package/docs/examples/storage/delete-file.md +8 -12
- package/docs/examples/storage/get-bucket-usage.md +9 -13
- package/docs/examples/storage/get-bucket.md +7 -12
- package/docs/examples/storage/get-file-download.md +8 -8
- package/docs/examples/storage/get-file-preview.md +20 -9
- package/docs/examples/storage/get-file-view.md +8 -8
- package/docs/examples/storage/get-file.md +8 -12
- package/docs/examples/storage/get-usage.md +8 -13
- package/docs/examples/storage/list-buckets.md +8 -12
- package/docs/examples/storage/list-files.md +9 -12
- package/docs/examples/storage/update-bucket.md +17 -13
- package/docs/examples/storage/update-file.md +10 -12
- package/docs/examples/teams/create-membership.md +13 -12
- package/docs/examples/teams/create.md +9 -12
- package/docs/examples/teams/delete-membership.md +8 -12
- package/docs/examples/teams/delete.md +7 -12
- package/docs/examples/teams/get-membership.md +8 -12
- package/docs/examples/teams/get-prefs.md +7 -12
- package/docs/examples/teams/get.md +7 -12
- package/docs/examples/teams/list-logs.md +8 -12
- package/docs/examples/teams/list-memberships.md +9 -12
- package/docs/examples/teams/list.md +8 -12
- package/docs/examples/teams/update-membership-status.md +10 -12
- package/docs/examples/teams/update-membership.md +9 -12
- package/docs/examples/teams/update-name.md +8 -12
- package/docs/examples/teams/update-prefs.md +8 -12
- package/docs/examples/users/create-argon2user.md +10 -12
- package/docs/examples/users/create-bcrypt-user.md +10 -12
- package/docs/examples/users/create-m-d5user.md +10 -12
- package/docs/examples/users/create-mfa-recovery-codes.md +13 -0
- package/docs/examples/users/create-p-h-pass-user.md +10 -12
- package/docs/examples/users/create-s-h-a-user.md +12 -13
- package/docs/examples/users/create-scrypt-modified-user.md +13 -12
- package/docs/examples/users/create-scrypt-user.md +15 -12
- package/docs/examples/users/create-session.md +7 -12
- package/docs/examples/users/create-target.md +13 -13
- package/docs/examples/users/create-token.md +9 -12
- package/docs/examples/users/create.md +11 -12
- package/docs/examples/users/delete-identity.md +7 -12
- package/docs/examples/users/delete-mfa-authenticator.md +14 -0
- package/docs/examples/users/delete-session.md +8 -12
- package/docs/examples/users/delete-sessions.md +7 -12
- package/docs/examples/users/delete-target.md +8 -12
- package/docs/examples/users/delete.md +7 -12
- package/docs/examples/users/get-mfa-recovery-codes.md +13 -0
- package/docs/examples/users/get-prefs.md +7 -12
- package/docs/examples/users/get-target.md +8 -12
- package/docs/examples/users/get-usage.md +8 -13
- package/docs/examples/users/get.md +7 -12
- package/docs/examples/users/list-identities.md +8 -12
- package/docs/examples/users/list-logs.md +8 -12
- package/docs/examples/users/list-memberships.md +7 -12
- package/docs/examples/users/list-mfa-factors.md +13 -0
- package/docs/examples/users/list-sessions.md +7 -12
- package/docs/examples/users/list-targets.md +8 -12
- package/docs/examples/users/list.md +8 -12
- package/docs/examples/users/update-email-verification.md +8 -12
- package/docs/examples/users/update-email.md +8 -12
- package/docs/examples/users/update-labels.md +8 -12
- package/docs/examples/users/update-mfa-recovery-codes.md +13 -0
- package/docs/examples/users/update-mfa.md +8 -12
- package/docs/examples/users/update-name.md +8 -12
- package/docs/examples/users/update-password.md +8 -12
- package/docs/examples/users/update-phone-verification.md +8 -12
- package/docs/examples/users/update-phone.md +8 -12
- package/docs/examples/users/update-prefs.md +8 -12
- package/docs/examples/users/update-status.md +8 -12
- package/docs/examples/users/update-target.md +11 -12
- package/docs/examples/vcs/create-repository-detection.md +9 -12
- package/docs/examples/vcs/create-repository.md +9 -12
- package/docs/examples/vcs/delete-installation.md +7 -12
- package/docs/examples/vcs/get-installation.md +7 -12
- package/docs/examples/vcs/get-repository.md +8 -12
- package/docs/examples/vcs/list-installations.md +8 -12
- package/docs/examples/vcs/list-repositories.md +8 -12
- package/docs/examples/vcs/list-repository-branches.md +8 -12
- package/docs/examples/vcs/update-external-deployments.md +9 -12
- package/package.json +1 -1
- package/src/client.ts +3 -3
- package/src/enums/api-service.ts +13 -0
- package/src/enums/api.ts +5 -0
- package/src/enums/auth-method.ts +9 -0
- package/src/enums/authentication-factor.ts +6 -0
- package/src/enums/authenticator-type.ts +3 -0
- package/src/enums/browser.ts +16 -0
- package/src/enums/compression.ts +5 -0
- package/src/enums/credit-card.ts +18 -0
- package/src/enums/database-usage-range.ts +5 -0
- package/src/enums/email-template-locale.ts +133 -0
- package/src/enums/email-template-type.ts +7 -0
- package/src/enums/execution-method.ts +8 -0
- package/src/enums/flag.ts +196 -0
- package/src/enums/function-usage-range.ts +5 -0
- package/src/enums/image-format.ts +7 -0
- package/src/enums/image-gravity.ts +11 -0
- package/src/enums/index-type.ts +5 -0
- package/src/enums/messaging-provider-type.ts +5 -0
- package/src/enums/name.ts +15 -0
- package/src/enums/o-auth-provider.ts +41 -0
- package/src/enums/password-hash.ts +13 -0
- package/src/enums/platform-type.ts +15 -0
- package/src/enums/project-usage-range.ts +4 -0
- package/src/enums/region.ts +4 -0
- package/src/enums/relation-mutate.ts +5 -0
- package/src/enums/relationship-type.ts +6 -0
- package/src/enums/resource-type.ts +4 -0
- package/src/enums/runtime.ts +46 -0
- package/src/enums/s-m-t-p-secure.ts +3 -0
- package/src/enums/sms-template-locale.ts +133 -0
- package/src/enums/sms-template-type.ts +6 -0
- package/src/enums/smtp-encryption.ts +5 -0
- package/src/enums/storage-usage-range.ts +5 -0
- package/src/enums/user-usage-range.ts +5 -0
- package/src/index.ts +35 -1
- package/src/models.ts +61 -23
- package/src/query.ts +61 -34
- package/src/service.ts +4 -7
- package/src/services/account.ts +274 -75
- package/src/services/avatars.ts +9 -6
- package/src/services/databases.ts +37 -16
- package/src/services/functions.ts +13 -10
- package/src/services/health.ts +121 -0
- package/src/services/messaging.ts +374 -117
- package/src/services/migrations.ts +2 -2
- package/src/services/project.ts +4 -3
- package/src/services/projects.ts +110 -59
- package/src/services/proxy.ts +3 -2
- package/src/services/storage.ts +17 -13
- package/src/services/users.ts +125 -44
- package/types/enums/api-service.d.ts +13 -0
- package/types/enums/api.d.ts +5 -0
- package/types/enums/auth-method.d.ts +9 -0
- package/types/enums/authentication-factor.d.ts +6 -0
- package/types/enums/authenticator-type.d.ts +3 -0
- package/types/enums/browser.d.ts +16 -0
- package/types/enums/compression.d.ts +5 -0
- package/types/enums/credit-card.d.ts +18 -0
- package/types/enums/database-usage-range.d.ts +5 -0
- package/types/enums/email-template-locale.d.ts +133 -0
- package/types/enums/email-template-type.d.ts +7 -0
- package/types/enums/execution-method.d.ts +8 -0
- package/types/enums/flag.d.ts +196 -0
- package/types/enums/function-usage-range.d.ts +5 -0
- package/types/enums/image-format.d.ts +7 -0
- package/types/enums/image-gravity.d.ts +11 -0
- package/types/enums/index-type.d.ts +5 -0
- package/types/enums/messaging-provider-type.d.ts +5 -0
- package/types/enums/name.d.ts +15 -0
- package/types/enums/o-auth-provider.d.ts +41 -0
- package/types/enums/password-hash.d.ts +13 -0
- package/types/enums/platform-type.d.ts +15 -0
- package/types/enums/project-usage-range.d.ts +4 -0
- package/types/enums/region.d.ts +4 -0
- package/types/enums/relation-mutate.d.ts +5 -0
- package/types/enums/relationship-type.d.ts +6 -0
- package/types/enums/resource-type.d.ts +4 -0
- package/types/enums/runtime.d.ts +46 -0
- package/types/enums/s-m-t-p-secure.d.ts +3 -0
- package/types/enums/sms-template-locale.d.ts +133 -0
- package/types/enums/sms-template-type.d.ts +6 -0
- package/types/enums/smtp-encryption.d.ts +5 -0
- package/types/enums/storage-usage-range.d.ts +5 -0
- package/types/enums/user-usage-range.d.ts +5 -0
- package/types/index.d.ts +34 -0
- package/types/models.d.ts +61 -23
- package/types/query.d.ts +10 -3
- package/types/services/account.d.ts +138 -33
- package/types/services/avatars.d.ts +9 -6
- package/types/services/databases.d.ts +37 -16
- package/types/services/functions.d.ts +13 -10
- package/types/services/health.d.ts +56 -0
- package/types/services/messaging.d.ts +170 -64
- package/types/services/migrations.d.ts +2 -2
- package/types/services/project.d.ts +4 -3
- package/types/services/projects.d.ts +64 -42
- package/types/services/proxy.d.ts +3 -2
- package/types/services/storage.d.ts +17 -13
- package/types/services/users.d.ts +73 -23
- package/docs/examples/account/add-authenticator.md +0 -18
- package/docs/examples/account/create-challenge.md +0 -18
- package/docs/examples/account/delete-authenticator.md +0 -18
- package/docs/examples/account/list-providers.md +0 -18
- package/docs/examples/account/update-challenge.md +0 -18
- package/docs/examples/account/verify-authenticator.md +0 -18
- package/docs/examples/messaging/create-a-p-n-s-provider.md +0 -18
- package/docs/examples/messaging/create-f-c-m-provider.md +0 -18
- package/docs/examples/messaging/create-s-m-s.md +0 -18
- package/docs/examples/messaging/update-a-p-n-s-provider.md +0 -18
- package/docs/examples/messaging/update-f-c-m-provider.md +0 -18
- package/docs/examples/messaging/update-push-notification.md +0 -18
- package/docs/examples/messaging/update-s-m-s.md +0 -18
- package/docs/examples/projects/update-auth-mfa-factors.md +0 -18
- package/docs/examples/users/delete-authenticator.md +0 -18
- package/docs/examples/users/list-providers.md +0 -18
package/src/services/account.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import { AuthenticatorType } from '../enums/authenticator-type';
|
|
6
|
+
import { AuthenticationFactor } from '../enums/authentication-factor';
|
|
7
|
+
import { OAuthProvider } from '../enums/o-auth-provider';
|
|
5
8
|
|
|
6
9
|
export class Account extends Service {
|
|
7
10
|
|
|
@@ -150,11 +153,11 @@ export class Account extends Service {
|
|
|
150
153
|
*
|
|
151
154
|
* Get the list of identities for the currently logged in user.
|
|
152
155
|
*
|
|
153
|
-
* @param {string} queries
|
|
156
|
+
* @param {string[]} queries
|
|
154
157
|
* @throws {AppwriteException}
|
|
155
158
|
* @returns {Promise}
|
|
156
159
|
*/
|
|
157
|
-
async listIdentities(queries?: string): Promise<Models.IdentityList> {
|
|
160
|
+
async listIdentities(queries?: string[]): Promise<Models.IdentityList> {
|
|
158
161
|
const apiPath = '/account/identities';
|
|
159
162
|
const payload: Payload = {};
|
|
160
163
|
|
|
@@ -240,6 +243,7 @@ export class Account extends Service {
|
|
|
240
243
|
/**
|
|
241
244
|
* Update MFA
|
|
242
245
|
*
|
|
246
|
+
* Enable or disable MFA on an account.
|
|
243
247
|
*
|
|
244
248
|
* @param {boolean} mfa
|
|
245
249
|
* @throws {AppwriteException}
|
|
@@ -264,25 +268,25 @@ export class Account extends Service {
|
|
|
264
268
|
}
|
|
265
269
|
|
|
266
270
|
/**
|
|
267
|
-
*
|
|
271
|
+
* Add Authenticator
|
|
268
272
|
*
|
|
273
|
+
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
274
|
+
* authenticator using the [verify
|
|
275
|
+
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
|
|
276
|
+
* method.
|
|
269
277
|
*
|
|
270
|
-
* @param {
|
|
278
|
+
* @param {AuthenticatorType} type
|
|
271
279
|
* @throws {AppwriteException}
|
|
272
280
|
* @returns {Promise}
|
|
273
281
|
*/
|
|
274
|
-
async
|
|
275
|
-
if (typeof
|
|
276
|
-
throw new AppwriteException('Missing required parameter: "
|
|
282
|
+
async createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
|
|
283
|
+
if (typeof type === 'undefined') {
|
|
284
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
277
285
|
}
|
|
278
286
|
|
|
279
|
-
const apiPath = '/account/mfa/
|
|
287
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
280
288
|
const payload: Payload = {};
|
|
281
289
|
|
|
282
|
-
if (typeof provider !== 'undefined') {
|
|
283
|
-
payload['provider'] = provider;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
290
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
287
291
|
return await this.client.call('post', uri, {
|
|
288
292
|
'content-type': 'application/json',
|
|
@@ -290,30 +294,29 @@ export class Account extends Service {
|
|
|
290
294
|
}
|
|
291
295
|
|
|
292
296
|
/**
|
|
293
|
-
*
|
|
297
|
+
* Verify Authenticator
|
|
294
298
|
*
|
|
299
|
+
* Verify an authenticator app after adding it using the [add
|
|
300
|
+
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
|
|
301
|
+
* method.
|
|
295
302
|
*
|
|
296
|
-
* @param {
|
|
303
|
+
* @param {AuthenticatorType} type
|
|
297
304
|
* @param {string} otp
|
|
298
305
|
* @throws {AppwriteException}
|
|
299
306
|
* @returns {Promise}
|
|
300
307
|
*/
|
|
301
|
-
async
|
|
302
|
-
if (typeof
|
|
303
|
-
throw new AppwriteException('Missing required parameter: "
|
|
308
|
+
async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
|
|
309
|
+
if (typeof type === 'undefined') {
|
|
310
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
304
311
|
}
|
|
305
312
|
|
|
306
313
|
if (typeof otp === 'undefined') {
|
|
307
314
|
throw new AppwriteException('Missing required parameter: "otp"');
|
|
308
315
|
}
|
|
309
316
|
|
|
310
|
-
const apiPath = '/account/mfa/
|
|
317
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
311
318
|
const payload: Payload = {};
|
|
312
319
|
|
|
313
|
-
if (typeof challengeId !== 'undefined') {
|
|
314
|
-
payload['challengeId'] = challengeId;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
320
|
if (typeof otp !== 'undefined') {
|
|
318
321
|
payload['otp'] = otp;
|
|
319
322
|
}
|
|
@@ -325,39 +328,60 @@ export class Account extends Service {
|
|
|
325
328
|
}
|
|
326
329
|
|
|
327
330
|
/**
|
|
328
|
-
*
|
|
331
|
+
* Delete Authenticator
|
|
329
332
|
*
|
|
330
|
-
*
|
|
333
|
+
* Delete an authenticator for a user by ID.
|
|
331
334
|
*
|
|
335
|
+
* @param {AuthenticatorType} type
|
|
336
|
+
* @param {string} otp
|
|
332
337
|
* @throws {AppwriteException}
|
|
333
338
|
* @returns {Promise}
|
|
334
339
|
*/
|
|
335
|
-
async
|
|
336
|
-
|
|
340
|
+
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
|
|
341
|
+
if (typeof type === 'undefined') {
|
|
342
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (typeof otp === 'undefined') {
|
|
346
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
337
350
|
const payload: Payload = {};
|
|
338
351
|
|
|
352
|
+
if (typeof otp !== 'undefined') {
|
|
353
|
+
payload['otp'] = otp;
|
|
354
|
+
}
|
|
355
|
+
|
|
339
356
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
340
|
-
return await this.client.call('
|
|
357
|
+
return await this.client.call('delete', uri, {
|
|
341
358
|
'content-type': 'application/json',
|
|
342
359
|
}, payload);
|
|
343
360
|
}
|
|
344
361
|
|
|
345
362
|
/**
|
|
346
|
-
*
|
|
363
|
+
* Create 2FA Challenge
|
|
347
364
|
*
|
|
365
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with
|
|
366
|
+
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
|
|
367
|
+
* method.
|
|
348
368
|
*
|
|
349
|
-
* @param {
|
|
369
|
+
* @param {AuthenticationFactor} factor
|
|
350
370
|
* @throws {AppwriteException}
|
|
351
371
|
* @returns {Promise}
|
|
352
372
|
*/
|
|
353
|
-
async
|
|
354
|
-
if (typeof
|
|
355
|
-
throw new AppwriteException('Missing required parameter: "
|
|
373
|
+
async createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
|
|
374
|
+
if (typeof factor === 'undefined') {
|
|
375
|
+
throw new AppwriteException('Missing required parameter: "factor"');
|
|
356
376
|
}
|
|
357
377
|
|
|
358
|
-
const apiPath = '/account/mfa/
|
|
378
|
+
const apiPath = '/account/mfa/challenge';
|
|
359
379
|
const payload: Payload = {};
|
|
360
380
|
|
|
381
|
+
if (typeof factor !== 'undefined') {
|
|
382
|
+
payload['factor'] = factor;
|
|
383
|
+
}
|
|
384
|
+
|
|
361
385
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
362
386
|
return await this.client.call('post', uri, {
|
|
363
387
|
'content-type': 'application/json',
|
|
@@ -365,26 +389,35 @@ export class Account extends Service {
|
|
|
365
389
|
}
|
|
366
390
|
|
|
367
391
|
/**
|
|
368
|
-
*
|
|
392
|
+
* Create MFA Challenge (confirmation)
|
|
369
393
|
*
|
|
394
|
+
* Complete the MFA challenge by providing the one-time password. Finish the
|
|
395
|
+
* process of MFA verification by providing the one-time password. To begin
|
|
396
|
+
* the flow, use
|
|
397
|
+
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
398
|
+
* method.
|
|
370
399
|
*
|
|
371
|
-
* @param {string}
|
|
400
|
+
* @param {string} challengeId
|
|
372
401
|
* @param {string} otp
|
|
373
402
|
* @throws {AppwriteException}
|
|
374
403
|
* @returns {Promise}
|
|
375
404
|
*/
|
|
376
|
-
async
|
|
377
|
-
if (typeof
|
|
378
|
-
throw new AppwriteException('Missing required parameter: "
|
|
405
|
+
async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
|
|
406
|
+
if (typeof challengeId === 'undefined') {
|
|
407
|
+
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
379
408
|
}
|
|
380
409
|
|
|
381
410
|
if (typeof otp === 'undefined') {
|
|
382
411
|
throw new AppwriteException('Missing required parameter: "otp"');
|
|
383
412
|
}
|
|
384
413
|
|
|
385
|
-
const apiPath = '/account/mfa/
|
|
414
|
+
const apiPath = '/account/mfa/challenge';
|
|
386
415
|
const payload: Payload = {};
|
|
387
416
|
|
|
417
|
+
if (typeof challengeId !== 'undefined') {
|
|
418
|
+
payload['challengeId'] = challengeId;
|
|
419
|
+
}
|
|
420
|
+
|
|
388
421
|
if (typeof otp !== 'undefined') {
|
|
389
422
|
payload['otp'] = otp;
|
|
390
423
|
}
|
|
@@ -396,32 +429,83 @@ export class Account extends Service {
|
|
|
396
429
|
}
|
|
397
430
|
|
|
398
431
|
/**
|
|
399
|
-
*
|
|
432
|
+
* List Factors
|
|
400
433
|
*
|
|
434
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
401
435
|
*
|
|
402
|
-
* @param {string} provider
|
|
403
|
-
* @param {string} otp
|
|
404
436
|
* @throws {AppwriteException}
|
|
405
437
|
* @returns {Promise}
|
|
406
438
|
*/
|
|
407
|
-
async
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}
|
|
439
|
+
async listMfaFactors(): Promise<Models.MfaFactors> {
|
|
440
|
+
const apiPath = '/account/mfa/factors';
|
|
441
|
+
const payload: Payload = {};
|
|
411
442
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
443
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
444
|
+
return await this.client.call('get', uri, {
|
|
445
|
+
'content-type': 'application/json',
|
|
446
|
+
}, payload);
|
|
447
|
+
}
|
|
415
448
|
|
|
416
|
-
|
|
449
|
+
/**
|
|
450
|
+
* Get MFA Recovery Codes
|
|
451
|
+
*
|
|
452
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting
|
|
453
|
+
* codes, they must be generated using
|
|
454
|
+
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
455
|
+
* method. An OTP challenge is required to read recovery codes.
|
|
456
|
+
*
|
|
457
|
+
* @throws {AppwriteException}
|
|
458
|
+
* @returns {Promise}
|
|
459
|
+
*/
|
|
460
|
+
async getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
461
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
417
462
|
const payload: Payload = {};
|
|
418
463
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
464
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
465
|
+
return await this.client.call('get', uri, {
|
|
466
|
+
'content-type': 'application/json',
|
|
467
|
+
}, payload);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Create MFA Recovery Codes
|
|
472
|
+
*
|
|
473
|
+
* Generate recovery codes as backup for MFA flow. It's recommended to
|
|
474
|
+
* generate and show then immediately after user successfully adds their
|
|
475
|
+
* authehticator. Recovery codes can be used as a MFA verification type in
|
|
476
|
+
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
477
|
+
* method.
|
|
478
|
+
*
|
|
479
|
+
* @throws {AppwriteException}
|
|
480
|
+
* @returns {Promise}
|
|
481
|
+
*/
|
|
482
|
+
async createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
483
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
484
|
+
const payload: Payload = {};
|
|
422
485
|
|
|
423
486
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
424
|
-
return await this.client.call('
|
|
487
|
+
return await this.client.call('post', uri, {
|
|
488
|
+
'content-type': 'application/json',
|
|
489
|
+
}, payload);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Regenerate MFA Recovery Codes
|
|
494
|
+
*
|
|
495
|
+
* Regenerate recovery codes that can be used as backup for MFA flow. Before
|
|
496
|
+
* regenerating codes, they must be first generated using
|
|
497
|
+
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
498
|
+
* method. An OTP challenge is required to regenreate recovery codes.
|
|
499
|
+
*
|
|
500
|
+
* @throws {AppwriteException}
|
|
501
|
+
* @returns {Promise}
|
|
502
|
+
*/
|
|
503
|
+
async updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
504
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
505
|
+
const payload: Payload = {};
|
|
506
|
+
|
|
507
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
508
|
+
return await this.client.call('patch', uri, {
|
|
425
509
|
'content-type': 'application/json',
|
|
426
510
|
}, payload);
|
|
427
511
|
}
|
|
@@ -775,7 +859,7 @@ export class Account extends Service {
|
|
|
775
859
|
}
|
|
776
860
|
|
|
777
861
|
/**
|
|
778
|
-
*
|
|
862
|
+
* Update magic URL session
|
|
779
863
|
*
|
|
780
864
|
* Use this endpoint to create a session from token. Provide the **userId**
|
|
781
865
|
* and **secret** parameters from the successful response of authentication
|
|
@@ -832,15 +916,14 @@ export class Account extends Service {
|
|
|
832
916
|
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
833
917
|
*
|
|
834
918
|
*
|
|
835
|
-
* @param {
|
|
919
|
+
* @param {OAuthProvider} provider
|
|
836
920
|
* @param {string} success
|
|
837
921
|
* @param {string} failure
|
|
838
|
-
* @param {boolean} token
|
|
839
922
|
* @param {string[]} scopes
|
|
840
923
|
* @throws {AppwriteException}
|
|
841
924
|
* @returns {void|string}
|
|
842
925
|
*/
|
|
843
|
-
createOAuth2Session(provider:
|
|
926
|
+
createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL {
|
|
844
927
|
if (typeof provider === 'undefined') {
|
|
845
928
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
846
929
|
}
|
|
@@ -856,10 +939,6 @@ export class Account extends Service {
|
|
|
856
939
|
payload['failure'] = failure;
|
|
857
940
|
}
|
|
858
941
|
|
|
859
|
-
if (typeof token !== 'undefined') {
|
|
860
|
-
payload['token'] = token;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
942
|
if (typeof scopes !== 'undefined') {
|
|
864
943
|
payload['scopes'] = scopes;
|
|
865
944
|
}
|
|
@@ -878,6 +957,44 @@ export class Account extends Service {
|
|
|
878
957
|
}
|
|
879
958
|
}
|
|
880
959
|
|
|
960
|
+
/**
|
|
961
|
+
* Update phone session
|
|
962
|
+
*
|
|
963
|
+
* Use this endpoint to create a session from token. Provide the **userId**
|
|
964
|
+
* and **secret** parameters from the successful response of authentication
|
|
965
|
+
* flows initiated by token creation. For example, magic URL and phone login.
|
|
966
|
+
*
|
|
967
|
+
* @param {string} userId
|
|
968
|
+
* @param {string} secret
|
|
969
|
+
* @throws {AppwriteException}
|
|
970
|
+
* @returns {Promise}
|
|
971
|
+
*/
|
|
972
|
+
async updatePhoneSession(userId: string, secret: string): Promise<Models.Session> {
|
|
973
|
+
if (typeof userId === 'undefined') {
|
|
974
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
if (typeof secret === 'undefined') {
|
|
978
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const apiPath = '/account/sessions/phone';
|
|
982
|
+
const payload: Payload = {};
|
|
983
|
+
|
|
984
|
+
if (typeof userId !== 'undefined') {
|
|
985
|
+
payload['userId'] = userId;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
if (typeof secret !== 'undefined') {
|
|
989
|
+
payload['secret'] = secret;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
993
|
+
return await this.client.call('put', uri, {
|
|
994
|
+
'content-type': 'application/json',
|
|
995
|
+
}, payload);
|
|
996
|
+
}
|
|
997
|
+
|
|
881
998
|
/**
|
|
882
999
|
* Create session
|
|
883
1000
|
*
|
|
@@ -941,10 +1058,11 @@ export class Account extends Service {
|
|
|
941
1058
|
}
|
|
942
1059
|
|
|
943
1060
|
/**
|
|
944
|
-
* Update
|
|
1061
|
+
* Update session
|
|
945
1062
|
*
|
|
946
|
-
*
|
|
947
|
-
* useful when session
|
|
1063
|
+
* Use this endpoint to extend a session's length. Extending a session is
|
|
1064
|
+
* useful when session expiry is short. If the session was created using an
|
|
1065
|
+
* OAuth provider, this endpoint refreshes the access token from the provider.
|
|
948
1066
|
*
|
|
949
1067
|
* @param {string} sessionId
|
|
950
1068
|
* @throws {AppwriteException}
|
|
@@ -1012,7 +1130,7 @@ export class Account extends Service {
|
|
|
1012
1130
|
}
|
|
1013
1131
|
|
|
1014
1132
|
/**
|
|
1015
|
-
* Create
|
|
1133
|
+
* Create push target
|
|
1016
1134
|
*
|
|
1017
1135
|
*
|
|
1018
1136
|
* @param {string} targetId
|
|
@@ -1052,7 +1170,7 @@ export class Account extends Service {
|
|
|
1052
1170
|
}
|
|
1053
1171
|
|
|
1054
1172
|
/**
|
|
1055
|
-
* Update
|
|
1173
|
+
* Update push target
|
|
1056
1174
|
*
|
|
1057
1175
|
*
|
|
1058
1176
|
* @param {string} targetId
|
|
@@ -1082,6 +1200,28 @@ export class Account extends Service {
|
|
|
1082
1200
|
}, payload);
|
|
1083
1201
|
}
|
|
1084
1202
|
|
|
1203
|
+
/**
|
|
1204
|
+
* Delete push target
|
|
1205
|
+
*
|
|
1206
|
+
*
|
|
1207
|
+
* @param {string} targetId
|
|
1208
|
+
* @throws {AppwriteException}
|
|
1209
|
+
* @returns {Promise}
|
|
1210
|
+
*/
|
|
1211
|
+
async deletePushTarget(targetId: string): Promise<{}> {
|
|
1212
|
+
if (typeof targetId === 'undefined') {
|
|
1213
|
+
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1217
|
+
const payload: Payload = {};
|
|
1218
|
+
|
|
1219
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1220
|
+
return await this.client.call('delete', uri, {
|
|
1221
|
+
'content-type': 'application/json',
|
|
1222
|
+
}, payload);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1085
1225
|
/**
|
|
1086
1226
|
* Create email token (OTP)
|
|
1087
1227
|
*
|
|
@@ -1098,11 +1238,11 @@ export class Account extends Service {
|
|
|
1098
1238
|
*
|
|
1099
1239
|
* @param {string} userId
|
|
1100
1240
|
* @param {string} email
|
|
1101
|
-
* @param {boolean}
|
|
1241
|
+
* @param {boolean} phrase
|
|
1102
1242
|
* @throws {AppwriteException}
|
|
1103
1243
|
* @returns {Promise}
|
|
1104
1244
|
*/
|
|
1105
|
-
async createEmailToken(userId: string, email: string,
|
|
1245
|
+
async createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token> {
|
|
1106
1246
|
if (typeof userId === 'undefined') {
|
|
1107
1247
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1108
1248
|
}
|
|
@@ -1122,8 +1262,8 @@ export class Account extends Service {
|
|
|
1122
1262
|
payload['email'] = email;
|
|
1123
1263
|
}
|
|
1124
1264
|
|
|
1125
|
-
if (typeof
|
|
1126
|
-
payload['
|
|
1265
|
+
if (typeof phrase !== 'undefined') {
|
|
1266
|
+
payload['phrase'] = phrase;
|
|
1127
1267
|
}
|
|
1128
1268
|
|
|
1129
1269
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1155,11 +1295,11 @@ export class Account extends Service {
|
|
|
1155
1295
|
* @param {string} userId
|
|
1156
1296
|
* @param {string} email
|
|
1157
1297
|
* @param {string} url
|
|
1158
|
-
* @param {boolean}
|
|
1298
|
+
* @param {boolean} phrase
|
|
1159
1299
|
* @throws {AppwriteException}
|
|
1160
1300
|
* @returns {Promise}
|
|
1161
1301
|
*/
|
|
1162
|
-
async createMagicURLToken(userId: string, email: string, url?: string,
|
|
1302
|
+
async createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token> {
|
|
1163
1303
|
if (typeof userId === 'undefined') {
|
|
1164
1304
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1165
1305
|
}
|
|
@@ -1183,8 +1323,8 @@ export class Account extends Service {
|
|
|
1183
1323
|
payload['url'] = url;
|
|
1184
1324
|
}
|
|
1185
1325
|
|
|
1186
|
-
if (typeof
|
|
1187
|
-
payload['
|
|
1326
|
+
if (typeof phrase !== 'undefined') {
|
|
1327
|
+
payload['phrase'] = phrase;
|
|
1188
1328
|
}
|
|
1189
1329
|
|
|
1190
1330
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1193,6 +1333,65 @@ export class Account extends Service {
|
|
|
1193
1333
|
}, payload);
|
|
1194
1334
|
}
|
|
1195
1335
|
|
|
1336
|
+
/**
|
|
1337
|
+
* Create OAuth2 token
|
|
1338
|
+
*
|
|
1339
|
+
* Allow the user to login to their account using the OAuth2 provider of their
|
|
1340
|
+
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
1341
|
+
* first. Use the success and failure arguments to provide a redirect URL's
|
|
1342
|
+
* back to your app when login is completed.
|
|
1343
|
+
*
|
|
1344
|
+
* If authentication succeeds, `userId` and `secret` of a token will be
|
|
1345
|
+
* appended to the success URL as query parameters. These can be used to
|
|
1346
|
+
* create a new session using the [Create
|
|
1347
|
+
* session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1348
|
+
* endpoint.
|
|
1349
|
+
*
|
|
1350
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1351
|
+
* about session
|
|
1352
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1353
|
+
*
|
|
1354
|
+
* @param {OAuthProvider} provider
|
|
1355
|
+
* @param {string} success
|
|
1356
|
+
* @param {string} failure
|
|
1357
|
+
* @param {string[]} scopes
|
|
1358
|
+
* @throws {AppwriteException}
|
|
1359
|
+
* @returns {void|string}
|
|
1360
|
+
*/
|
|
1361
|
+
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL {
|
|
1362
|
+
if (typeof provider === 'undefined') {
|
|
1363
|
+
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
|
|
1367
|
+
const payload: Payload = {};
|
|
1368
|
+
|
|
1369
|
+
if (typeof success !== 'undefined') {
|
|
1370
|
+
payload['success'] = success;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if (typeof failure !== 'undefined') {
|
|
1374
|
+
payload['failure'] = failure;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
if (typeof scopes !== 'undefined') {
|
|
1378
|
+
payload['scopes'] = scopes;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1382
|
+
payload['project'] = this.client.config.project;
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
|
|
1386
|
+
uri.searchParams.append(key, value);
|
|
1387
|
+
}
|
|
1388
|
+
if (typeof window !== 'undefined' && window?.location) {
|
|
1389
|
+
window.location.href = uri.toString();
|
|
1390
|
+
} else {
|
|
1391
|
+
return uri;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1196
1395
|
/**
|
|
1197
1396
|
* Create phone token
|
|
1198
1397
|
*
|
package/src/services/avatars.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Service } from '../service';
|
|
|
2
2
|
import { AppwriteException, Client } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
import { Browser } from '../enums/browser';
|
|
6
|
+
import { CreditCard } from '../enums/credit-card';
|
|
7
|
+
import { Flag } from '../enums/flag';
|
|
5
8
|
|
|
6
9
|
export class Avatars extends Service {
|
|
7
10
|
|
|
@@ -24,14 +27,14 @@ export class Avatars extends Service {
|
|
|
24
27
|
* image at source quality. If dimensions are not specified, the default size
|
|
25
28
|
* of image returned is 100x100px.
|
|
26
29
|
*
|
|
27
|
-
* @param {
|
|
30
|
+
* @param {Browser} code
|
|
28
31
|
* @param {number} width
|
|
29
32
|
* @param {number} height
|
|
30
33
|
* @param {number} quality
|
|
31
34
|
* @throws {AppwriteException}
|
|
32
35
|
* @returns {URL}
|
|
33
36
|
*/
|
|
34
|
-
getBrowser(code:
|
|
37
|
+
getBrowser(code: Browser, width?: number, height?: number, quality?: number): URL {
|
|
35
38
|
if (typeof code === 'undefined') {
|
|
36
39
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
37
40
|
}
|
|
@@ -74,14 +77,14 @@ export class Avatars extends Service {
|
|
|
74
77
|
* of image returned is 100x100px.
|
|
75
78
|
*
|
|
76
79
|
*
|
|
77
|
-
* @param {
|
|
80
|
+
* @param {CreditCard} code
|
|
78
81
|
* @param {number} width
|
|
79
82
|
* @param {number} height
|
|
80
83
|
* @param {number} quality
|
|
81
84
|
* @throws {AppwriteException}
|
|
82
85
|
* @returns {URL}
|
|
83
86
|
*/
|
|
84
|
-
getCreditCard(code:
|
|
87
|
+
getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): URL {
|
|
85
88
|
if (typeof code === 'undefined') {
|
|
86
89
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
87
90
|
}
|
|
@@ -158,14 +161,14 @@ export class Avatars extends Service {
|
|
|
158
161
|
* of image returned is 100x100px.
|
|
159
162
|
*
|
|
160
163
|
*
|
|
161
|
-
* @param {
|
|
164
|
+
* @param {Flag} code
|
|
162
165
|
* @param {number} width
|
|
163
166
|
* @param {number} height
|
|
164
167
|
* @param {number} quality
|
|
165
168
|
* @throws {AppwriteException}
|
|
166
169
|
* @returns {URL}
|
|
167
170
|
*/
|
|
168
|
-
getFlag(code:
|
|
171
|
+
getFlag(code: Flag, width?: number, height?: number, quality?: number): URL {
|
|
169
172
|
if (typeof code === 'undefined') {
|
|
170
173
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
171
174
|
}
|