@appwrite.io/console 0.6.4 → 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/README.md +3 -3
- package/dist/cjs/sdk.js +2508 -2351
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +2508 -2351
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +2508 -2351
- package/docs/examples/account/create-anonymous-session.md +1 -1
- package/docs/examples/account/create-email-password-session.md +1 -1
- package/docs/examples/account/create-email-token.md +1 -1
- package/docs/examples/account/create-j-w-t.md +1 -1
- package/docs/examples/account/create-magic-u-r-l-token.md +1 -1
- package/docs/examples/account/create-mfa-authenticator.md +1 -1
- package/docs/examples/account/create-mfa-challenge.md +1 -1
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/create-phone-token.md +1 -1
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-push-target.md +1 -1
- package/docs/examples/account/create-recovery.md +1 -1
- package/docs/examples/account/create-session.md +1 -1
- package/docs/examples/account/create-verification.md +1 -1
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/delete-identity.md +1 -1
- package/docs/examples/account/delete-mfa-authenticator.md +2 -3
- package/docs/examples/account/delete-push-target.md +1 -1
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/delete.md +1 -1
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/get.md +1 -1
- package/docs/examples/account/list-identities.md +1 -1
- package/docs/examples/account/list-logs.md +1 -1
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +1 -1
- package/docs/examples/account/update-m-f-a.md +1 -1
- package/docs/examples/account/update-magic-u-r-l-session.md +1 -1
- package/docs/examples/account/update-mfa-authenticator.md +1 -1
- package/docs/examples/account/update-mfa-challenge.md +1 -1
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-password.md +1 -1
- package/docs/examples/account/update-phone-session.md +1 -1
- package/docs/examples/account/update-phone-verification.md +1 -1
- package/docs/examples/account/update-phone.md +1 -1
- package/docs/examples/account/update-prefs.md +1 -1
- package/docs/examples/account/update-push-target.md +1 -1
- package/docs/examples/account/update-recovery.md +1 -1
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +1 -1
- package/docs/examples/assistant/chat.md +1 -1
- package/docs/examples/console/variables.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +1 -1
- package/docs/examples/databases/create-collection.md +1 -1
- package/docs/examples/databases/create-datetime-attribute.md +1 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/create-email-attribute.md +1 -1
- package/docs/examples/databases/create-enum-attribute.md +1 -1
- package/docs/examples/databases/create-float-attribute.md +1 -1
- package/docs/examples/databases/create-index.md +1 -1
- package/docs/examples/databases/create-integer-attribute.md +1 -1
- package/docs/examples/databases/create-ip-attribute.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +1 -1
- package/docs/examples/databases/create-string-attribute.md +1 -1
- package/docs/examples/databases/create-url-attribute.md +1 -1
- package/docs/examples/databases/create.md +1 -1
- package/docs/examples/databases/delete-attribute.md +1 -1
- package/docs/examples/databases/delete-collection.md +1 -1
- package/docs/examples/databases/delete-document.md +1 -1
- package/docs/examples/databases/delete-index.md +1 -1
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +1 -1
- package/docs/examples/databases/get-collection-usage.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-database-usage.md +1 -1
- package/docs/examples/databases/get-document.md +1 -1
- package/docs/examples/databases/get-index.md +1 -1
- package/docs/examples/databases/get-usage.md +1 -1
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +1 -1
- package/docs/examples/databases/list-collection-logs.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-document-logs.md +1 -1
- package/docs/examples/databases/list-documents.md +1 -1
- package/docs/examples/databases/list-indexes.md +1 -1
- package/docs/examples/databases/list-logs.md +1 -1
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +1 -1
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +1 -1
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +1 -1
- package/docs/examples/databases/update-enum-attribute.md +1 -1
- package/docs/examples/databases/update-float-attribute.md +1 -1
- package/docs/examples/databases/update-integer-attribute.md +1 -1
- package/docs/examples/databases/update-ip-attribute.md +1 -1
- package/docs/examples/databases/update-relationship-attribute.md +1 -1
- package/docs/examples/databases/update-string-attribute.md +1 -1
- package/docs/examples/databases/update-url-attribute.md +1 -1
- package/docs/examples/databases/update.md +1 -1
- package/docs/examples/functions/create-build.md +2 -2
- package/docs/examples/functions/create-deployment.md +1 -1
- package/docs/examples/functions/create-execution.md +3 -2
- package/docs/examples/functions/create-variable.md +1 -1
- package/docs/examples/functions/create.md +3 -3
- package/docs/examples/functions/delete-deployment.md +1 -1
- package/docs/examples/functions/delete-execution.md +14 -0
- package/docs/examples/functions/delete-variable.md +1 -1
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +1 -1
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-function-usage.md +1 -1
- package/docs/examples/functions/{get-specifications.md → get-template.md} +4 -2
- package/docs/examples/functions/get-usage.md +1 -1
- package/docs/examples/functions/get-variable.md +1 -1
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-templates.md +16 -0
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/list.md +1 -1
- package/docs/examples/functions/update-deployment-build.md +14 -0
- package/docs/examples/functions/update-deployment.md +1 -1
- package/docs/examples/functions/update-variable.md +1 -1
- package/docs/examples/functions/update.md +3 -3
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-certificate.md +1 -1
- package/docs/examples/health/get-d-b.md +1 -1
- package/docs/examples/health/get-failed-jobs.md +1 -1
- package/docs/examples/health/get-pub-sub.md +1 -1
- package/docs/examples/health/get-queue-builds.md +1 -1
- package/docs/examples/health/get-queue-certificates.md +1 -1
- package/docs/examples/health/get-queue-databases.md +1 -1
- package/docs/examples/health/get-queue-deletes.md +1 -1
- package/docs/examples/health/get-queue-functions.md +1 -1
- package/docs/examples/health/get-queue-logs.md +1 -1
- package/docs/examples/health/get-queue-mails.md +1 -1
- package/docs/examples/health/get-queue-messaging.md +1 -1
- package/docs/examples/health/get-queue-migrations.md +1 -1
- package/docs/examples/health/get-queue-usage-dump.md +1 -1
- package/docs/examples/health/get-queue-usage.md +1 -1
- package/docs/examples/health/get-queue-webhooks.md +1 -1
- package/docs/examples/health/get-queue.md +1 -1
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-storage.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/health/get.md +1 -1
- package/docs/examples/locale/get.md +1 -1
- package/docs/examples/locale/list-codes.md +1 -1
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-e-u.md +1 -1
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/messaging/create-apns-provider.md +1 -1
- package/docs/examples/messaging/create-email.md +1 -1
- package/docs/examples/messaging/create-fcm-provider.md +1 -1
- package/docs/examples/messaging/create-mailgun-provider.md +1 -1
- package/docs/examples/messaging/create-msg91provider.md +1 -1
- package/docs/examples/messaging/create-push.md +1 -1
- package/docs/examples/messaging/create-sendgrid-provider.md +1 -1
- package/docs/examples/messaging/create-sms.md +1 -1
- package/docs/examples/messaging/create-smtp-provider.md +1 -1
- package/docs/examples/messaging/create-subscriber.md +1 -1
- package/docs/examples/messaging/create-telesign-provider.md +1 -1
- package/docs/examples/messaging/create-textmagic-provider.md +1 -1
- package/docs/examples/messaging/create-topic.md +1 -1
- package/docs/examples/messaging/create-twilio-provider.md +1 -1
- package/docs/examples/messaging/create-vonage-provider.md +1 -1
- package/docs/examples/messaging/delete-provider.md +1 -1
- package/docs/examples/messaging/delete-subscriber.md +1 -1
- package/docs/examples/messaging/delete-topic.md +1 -1
- package/docs/examples/messaging/delete.md +1 -1
- package/docs/examples/messaging/get-message.md +1 -1
- package/docs/examples/messaging/get-provider.md +1 -1
- package/docs/examples/messaging/get-subscriber.md +1 -1
- package/docs/examples/messaging/get-topic.md +1 -1
- package/docs/examples/messaging/list-message-logs.md +1 -1
- package/docs/examples/messaging/list-messages.md +1 -1
- package/docs/examples/messaging/list-provider-logs.md +1 -1
- package/docs/examples/messaging/list-providers.md +1 -1
- package/docs/examples/messaging/list-subscriber-logs.md +1 -1
- package/docs/examples/messaging/list-subscribers.md +1 -1
- package/docs/examples/messaging/list-targets.md +1 -1
- package/docs/examples/messaging/list-topic-logs.md +1 -1
- package/docs/examples/messaging/list-topics.md +1 -1
- package/docs/examples/messaging/update-apns-provider.md +1 -1
- package/docs/examples/messaging/update-email.md +1 -1
- package/docs/examples/messaging/update-fcm-provider.md +1 -1
- package/docs/examples/messaging/update-mailgun-provider.md +1 -1
- package/docs/examples/messaging/update-msg91provider.md +1 -1
- package/docs/examples/messaging/update-push.md +1 -1
- package/docs/examples/messaging/update-sendgrid-provider.md +1 -1
- package/docs/examples/messaging/update-sms.md +1 -1
- package/docs/examples/messaging/update-smtp-provider.md +1 -1
- package/docs/examples/messaging/update-telesign-provider.md +1 -1
- package/docs/examples/messaging/update-textmagic-provider.md +1 -1
- package/docs/examples/messaging/update-topic.md +1 -1
- package/docs/examples/messaging/update-twilio-provider.md +1 -1
- package/docs/examples/messaging/update-vonage-provider.md +1 -1
- package/docs/examples/migrations/create-appwrite-migration.md +1 -1
- package/docs/examples/migrations/create-firebase-migration.md +1 -1
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
- package/docs/examples/migrations/create-n-host-migration.md +1 -1
- package/docs/examples/migrations/create-supabase-migration.md +1 -1
- package/docs/examples/migrations/delete-firebase-auth.md +1 -1
- package/docs/examples/migrations/delete.md +1 -1
- package/docs/examples/migrations/get-appwrite-report.md +1 -1
- package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
- package/docs/examples/migrations/get-firebase-report.md +1 -1
- package/docs/examples/migrations/get-n-host-report.md +1 -1
- package/docs/examples/migrations/get-supabase-report.md +1 -1
- package/docs/examples/migrations/get.md +1 -1
- package/docs/examples/migrations/list-firebase-projects.md +1 -1
- package/docs/examples/migrations/list.md +1 -1
- package/docs/examples/migrations/retry.md +1 -1
- package/docs/examples/project/create-variable.md +1 -1
- package/docs/examples/project/delete-variable.md +1 -1
- package/docs/examples/project/get-usage.md +1 -1
- package/docs/examples/project/get-variable.md +1 -1
- package/docs/examples/project/list-variables.md +1 -1
- package/docs/examples/project/update-variable.md +1 -1
- package/docs/examples/projects/create-j-w-t.md +15 -0
- package/docs/examples/projects/create-key.md +1 -1
- package/docs/examples/projects/create-platform.md +1 -1
- package/docs/examples/projects/create-smtp-test.md +1 -1
- package/docs/examples/projects/create-webhook.md +1 -1
- package/docs/examples/projects/create.md +1 -1
- package/docs/examples/projects/delete-email-template.md +1 -1
- package/docs/examples/projects/delete-key.md +1 -1
- package/docs/examples/projects/delete-platform.md +1 -1
- package/docs/examples/projects/delete-sms-template.md +1 -1
- package/docs/examples/projects/delete-webhook.md +1 -1
- package/docs/examples/projects/delete.md +1 -1
- package/docs/examples/projects/get-email-template.md +1 -1
- package/docs/examples/projects/get-key.md +1 -1
- package/docs/examples/projects/get-platform.md +1 -1
- package/docs/examples/projects/get-sms-template.md +1 -1
- package/docs/examples/projects/get-webhook.md +1 -1
- package/docs/examples/projects/get.md +1 -1
- package/docs/examples/projects/list-keys.md +1 -1
- package/docs/examples/projects/list-platforms.md +1 -1
- package/docs/examples/projects/list-webhooks.md +1 -1
- package/docs/examples/projects/list.md +1 -1
- package/docs/examples/projects/update-api-status-all.md +1 -1
- package/docs/examples/projects/update-api-status.md +1 -1
- package/docs/examples/projects/update-auth-duration.md +1 -1
- package/docs/examples/projects/update-auth-limit.md +1 -1
- package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
- package/docs/examples/projects/update-auth-password-history.md +1 -1
- package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
- package/docs/examples/projects/update-auth-status.md +1 -1
- package/docs/examples/projects/update-email-template.md +1 -1
- package/docs/examples/projects/update-key.md +1 -1
- package/docs/examples/projects/update-mock-numbers.md +14 -0
- package/docs/examples/projects/update-o-auth2.md +1 -1
- package/docs/examples/projects/update-personal-data-check.md +1 -1
- package/docs/examples/projects/update-platform.md +1 -1
- package/docs/examples/projects/update-service-status-all.md +1 -1
- package/docs/examples/projects/update-service-status.md +1 -1
- package/docs/examples/projects/update-session-alerts.md +14 -0
- package/docs/examples/projects/update-sms-template.md +1 -1
- package/docs/examples/projects/update-smtp.md +1 -1
- package/docs/examples/projects/update-team.md +1 -1
- package/docs/examples/projects/update-webhook-signature.md +1 -1
- package/docs/examples/projects/update-webhook.md +1 -1
- package/docs/examples/projects/update.md +1 -1
- package/docs/examples/proxy/create-rule.md +1 -1
- package/docs/examples/proxy/delete-rule.md +1 -1
- package/docs/examples/proxy/get-rule.md +1 -1
- package/docs/examples/proxy/list-rules.md +1 -1
- package/docs/examples/proxy/update-rule-verification.md +1 -1
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +1 -1
- package/docs/examples/storage/get-bucket-usage.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file.md +1 -1
- package/docs/examples/storage/get-usage.md +1 -1
- package/docs/examples/storage/list-buckets.md +1 -1
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/teams/create-membership.md +1 -1
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/delete-membership.md +1 -1
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +1 -1
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-logs.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/list.md +1 -1
- package/docs/examples/teams/update-membership-status.md +1 -1
- package/docs/examples/teams/update-membership.md +1 -1
- package/docs/examples/teams/update-name.md +1 -1
- package/docs/examples/teams/update-prefs.md +1 -1
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-j-w-t.md +15 -0
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +1 -1
- package/docs/examples/users/create-scrypt-user.md +1 -1
- package/docs/examples/users/create-session.md +1 -1
- package/docs/examples/users/create-target.md +1 -1
- package/docs/examples/users/create-token.md +1 -1
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +1 -1
- package/docs/examples/users/delete-mfa-authenticator.md +1 -1
- package/docs/examples/users/delete-session.md +1 -1
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete-target.md +1 -1
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get-target.md +1 -1
- package/docs/examples/users/get-usage.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +1 -1
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-mfa-factors.md +1 -1
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list-targets.md +1 -1
- package/docs/examples/users/list.md +1 -1
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +1 -1
- package/docs/examples/users/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/users/update-mfa.md +1 -1
- package/docs/examples/users/update-name.md +1 -1
- package/docs/examples/users/update-password.md +1 -1
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/docs/examples/users/update-target.md +1 -1
- package/docs/examples/vcs/create-repository-detection.md +1 -1
- package/docs/examples/vcs/create-repository.md +1 -1
- package/docs/examples/vcs/delete-installation.md +1 -1
- package/docs/examples/vcs/get-installation.md +1 -1
- package/docs/examples/vcs/get-repository-contents.md +15 -0
- package/docs/examples/vcs/get-repository.md +1 -1
- package/docs/examples/vcs/list-installations.md +1 -1
- package/docs/examples/vcs/list-repositories.md +1 -1
- package/docs/examples/vcs/list-repository-branches.md +1 -1
- package/docs/examples/vcs/update-external-deployments.md +1 -1
- package/package.json +1 -1
- package/src/client.ts +119 -68
- package/src/enums/email-template-type.ts +2 -0
- package/src/enums/platform-type.ts +2 -0
- package/src/enums/runtime.ts +1 -0
- package/src/index.ts +1 -1
- package/src/models.ts +230 -28
- package/src/services/account.ts +651 -644
- package/src/services/assistant.ts +19 -16
- package/src/services/avatars.ts +111 -152
- package/src/services/console.ts +19 -14
- package/src/services/databases.ts +628 -638
- package/src/services/functions.ts +435 -339
- package/src/services/graphql.ts +31 -24
- package/src/services/health.ts +299 -199
- package/src/services/locale.ts +113 -77
- package/src/services/messaging.ts +568 -583
- package/src/services/migrations.ts +199 -197
- package/src/services/project.ts +82 -65
- package/src/services/projects.ts +615 -459
- package/src/services/proxy.ts +68 -50
- package/src/services/storage.ts +198 -253
- package/src/services/teams.ts +198 -188
- package/src/services/users.ts +568 -478
- package/src/services/vcs.ts +149 -83
- package/types/client.d.ts +13 -17
- package/types/enums/email-template-type.d.ts +3 -1
- package/types/enums/platform-type.d.ts +3 -1
- package/types/enums/runtime.d.ts +2 -1
- package/types/index.d.ts +1 -1
- package/types/models.d.ts +230 -28
- package/types/services/account.d.ts +162 -317
- package/types/services/assistant.d.ts +4 -4
- package/types/services/avatars.d.ts +50 -84
- package/types/services/console.d.ts +4 -4
- package/types/services/databases.d.ts +143 -173
- package/types/services/functions.d.ts +112 -97
- package/types/services/graphql.d.ts +6 -6
- package/types/services/health.d.ts +64 -85
- package/types/services/locale.d.ts +28 -39
- package/types/services/messaging.d.ts +103 -104
- package/types/services/migrations.d.ts +34 -34
- package/types/services/project.d.ts +17 -20
- package/types/services/projects.d.ts +118 -87
- package/types/services/proxy.d.ts +13 -14
- package/types/services/storage.d.ts +53 -78
- package/types/services/teams.d.ts +53 -83
- package/types/services/users.d.ts +120 -157
- package/types/services/vcs.d.ts +31 -20
package/src/services/users.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 { PasswordHash } from '../enums/password-hash';
|
|
6
4
|
import { UserUsageRange } from '../enums/user-usage-range';
|
|
7
5
|
import { AuthenticatorType } from '../enums/authenticator-type';
|
|
8
6
|
import { MessagingProviderType } from '../enums/messaging-provider-type';
|
|
9
7
|
|
|
10
|
-
export class Users
|
|
8
|
+
export class Users {
|
|
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 users
|
|
19
17
|
*
|
|
20
|
-
* Get a list of all the project
|
|
21
|
-
* filter your results.
|
|
18
|
+
* Get a list of all the project's users. 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.UserList<Preferences>>}
|
|
24
|
+
*/
|
|
28
25
|
async list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.UserList<Preferences>> {
|
|
29
26
|
const apiPath = '/users';
|
|
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 user
|
|
48
49
|
*
|
|
@@ -54,148 +55,140 @@ export class Users extends Service {
|
|
|
54
55
|
* @param {string} password
|
|
55
56
|
* @param {string} name
|
|
56
57
|
* @throws {AppwriteException}
|
|
57
|
-
* @returns {Promise}
|
|
58
|
-
|
|
58
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
59
|
+
*/
|
|
59
60
|
async create<Preferences extends Models.Preferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>> {
|
|
60
61
|
if (typeof userId === 'undefined') {
|
|
61
62
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
62
63
|
}
|
|
63
|
-
|
|
64
64
|
const apiPath = '/users';
|
|
65
65
|
const payload: Payload = {};
|
|
66
|
-
|
|
67
66
|
if (typeof userId !== 'undefined') {
|
|
68
67
|
payload['userId'] = userId;
|
|
69
68
|
}
|
|
70
|
-
|
|
71
69
|
if (typeof email !== 'undefined') {
|
|
72
70
|
payload['email'] = email;
|
|
73
71
|
}
|
|
74
|
-
|
|
75
72
|
if (typeof phone !== 'undefined') {
|
|
76
73
|
payload['phone'] = phone;
|
|
77
74
|
}
|
|
78
|
-
|
|
79
75
|
if (typeof password !== 'undefined') {
|
|
80
76
|
payload['password'] = password;
|
|
81
77
|
}
|
|
82
|
-
|
|
83
78
|
if (typeof name !== 'undefined') {
|
|
84
79
|
payload['name'] = name;
|
|
85
80
|
}
|
|
86
|
-
|
|
87
81
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
88
|
-
|
|
82
|
+
|
|
83
|
+
const apiHeaders: { [header: string]: string } = {
|
|
89
84
|
'content-type': 'application/json',
|
|
90
|
-
}
|
|
91
|
-
}
|
|
85
|
+
}
|
|
92
86
|
|
|
87
|
+
return await this.client.call(
|
|
88
|
+
'post',
|
|
89
|
+
uri,
|
|
90
|
+
apiHeaders,
|
|
91
|
+
payload
|
|
92
|
+
);
|
|
93
|
+
}
|
|
93
94
|
/**
|
|
94
95
|
* Create user with Argon2 password
|
|
95
96
|
*
|
|
96
|
-
* Create a new user. Password provided must be hashed with the
|
|
97
|
-
* [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST
|
|
98
|
-
* /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to
|
|
99
|
-
* create users with a plain text password.
|
|
97
|
+
* Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
100
98
|
*
|
|
101
99
|
* @param {string} userId
|
|
102
100
|
* @param {string} email
|
|
103
101
|
* @param {string} password
|
|
104
102
|
* @param {string} name
|
|
105
103
|
* @throws {AppwriteException}
|
|
106
|
-
* @returns {Promise}
|
|
107
|
-
|
|
104
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
105
|
+
*/
|
|
108
106
|
async createArgon2User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
109
107
|
if (typeof userId === 'undefined') {
|
|
110
108
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
111
109
|
}
|
|
112
|
-
|
|
113
110
|
if (typeof email === 'undefined') {
|
|
114
111
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
115
112
|
}
|
|
116
|
-
|
|
117
113
|
if (typeof password === 'undefined') {
|
|
118
114
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
119
115
|
}
|
|
120
|
-
|
|
121
116
|
const apiPath = '/users/argon2';
|
|
122
117
|
const payload: Payload = {};
|
|
123
|
-
|
|
124
118
|
if (typeof userId !== 'undefined') {
|
|
125
119
|
payload['userId'] = userId;
|
|
126
120
|
}
|
|
127
|
-
|
|
128
121
|
if (typeof email !== 'undefined') {
|
|
129
122
|
payload['email'] = email;
|
|
130
123
|
}
|
|
131
|
-
|
|
132
124
|
if (typeof password !== 'undefined') {
|
|
133
125
|
payload['password'] = password;
|
|
134
126
|
}
|
|
135
|
-
|
|
136
127
|
if (typeof name !== 'undefined') {
|
|
137
128
|
payload['name'] = name;
|
|
138
129
|
}
|
|
139
|
-
|
|
140
130
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
141
|
-
|
|
131
|
+
|
|
132
|
+
const apiHeaders: { [header: string]: string } = {
|
|
142
133
|
'content-type': 'application/json',
|
|
143
|
-
}
|
|
144
|
-
}
|
|
134
|
+
}
|
|
145
135
|
|
|
136
|
+
return await this.client.call(
|
|
137
|
+
'post',
|
|
138
|
+
uri,
|
|
139
|
+
apiHeaders,
|
|
140
|
+
payload
|
|
141
|
+
);
|
|
142
|
+
}
|
|
146
143
|
/**
|
|
147
144
|
* Create user with bcrypt password
|
|
148
145
|
*
|
|
149
|
-
* Create a new user. Password provided must be hashed with the
|
|
150
|
-
* [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST
|
|
151
|
-
* /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to
|
|
152
|
-
* create users with a plain text password.
|
|
146
|
+
* Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
153
147
|
*
|
|
154
148
|
* @param {string} userId
|
|
155
149
|
* @param {string} email
|
|
156
150
|
* @param {string} password
|
|
157
151
|
* @param {string} name
|
|
158
152
|
* @throws {AppwriteException}
|
|
159
|
-
* @returns {Promise}
|
|
160
|
-
|
|
153
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
154
|
+
*/
|
|
161
155
|
async createBcryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
162
156
|
if (typeof userId === 'undefined') {
|
|
163
157
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
164
158
|
}
|
|
165
|
-
|
|
166
159
|
if (typeof email === 'undefined') {
|
|
167
160
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
168
161
|
}
|
|
169
|
-
|
|
170
162
|
if (typeof password === 'undefined') {
|
|
171
163
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
172
164
|
}
|
|
173
|
-
|
|
174
165
|
const apiPath = '/users/bcrypt';
|
|
175
166
|
const payload: Payload = {};
|
|
176
|
-
|
|
177
167
|
if (typeof userId !== 'undefined') {
|
|
178
168
|
payload['userId'] = userId;
|
|
179
169
|
}
|
|
180
|
-
|
|
181
170
|
if (typeof email !== 'undefined') {
|
|
182
171
|
payload['email'] = email;
|
|
183
172
|
}
|
|
184
|
-
|
|
185
173
|
if (typeof password !== 'undefined') {
|
|
186
174
|
payload['password'] = password;
|
|
187
175
|
}
|
|
188
|
-
|
|
189
176
|
if (typeof name !== 'undefined') {
|
|
190
177
|
payload['name'] = name;
|
|
191
178
|
}
|
|
192
|
-
|
|
193
179
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
194
|
-
|
|
180
|
+
|
|
181
|
+
const apiHeaders: { [header: string]: string } = {
|
|
195
182
|
'content-type': 'application/json',
|
|
196
|
-
}
|
|
197
|
-
}
|
|
183
|
+
}
|
|
198
184
|
|
|
185
|
+
return await this.client.call(
|
|
186
|
+
'post',
|
|
187
|
+
uri,
|
|
188
|
+
apiHeaders,
|
|
189
|
+
payload
|
|
190
|
+
);
|
|
191
|
+
}
|
|
199
192
|
/**
|
|
200
193
|
* List Identities
|
|
201
194
|
*
|
|
@@ -204,26 +197,30 @@ export class Users extends Service {
|
|
|
204
197
|
* @param {string[]} queries
|
|
205
198
|
* @param {string} search
|
|
206
199
|
* @throws {AppwriteException}
|
|
207
|
-
* @returns {Promise}
|
|
208
|
-
|
|
200
|
+
* @returns {Promise<Models.IdentityList>}
|
|
201
|
+
*/
|
|
209
202
|
async listIdentities(queries?: string[], search?: string): Promise<Models.IdentityList> {
|
|
210
203
|
const apiPath = '/users/identities';
|
|
211
204
|
const payload: Payload = {};
|
|
212
|
-
|
|
213
205
|
if (typeof queries !== 'undefined') {
|
|
214
206
|
payload['queries'] = queries;
|
|
215
207
|
}
|
|
216
|
-
|
|
217
208
|
if (typeof search !== 'undefined') {
|
|
218
209
|
payload['search'] = search;
|
|
219
210
|
}
|
|
220
|
-
|
|
221
211
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
222
|
-
|
|
212
|
+
|
|
213
|
+
const apiHeaders: { [header: string]: string } = {
|
|
223
214
|
'content-type': 'application/json',
|
|
224
|
-
}
|
|
225
|
-
}
|
|
215
|
+
}
|
|
226
216
|
|
|
217
|
+
return await this.client.call(
|
|
218
|
+
'get',
|
|
219
|
+
uri,
|
|
220
|
+
apiHeaders,
|
|
221
|
+
payload
|
|
222
|
+
);
|
|
223
|
+
}
|
|
227
224
|
/**
|
|
228
225
|
* Delete identity
|
|
229
226
|
*
|
|
@@ -231,135 +228,129 @@ export class Users extends Service {
|
|
|
231
228
|
*
|
|
232
229
|
* @param {string} identityId
|
|
233
230
|
* @throws {AppwriteException}
|
|
234
|
-
* @returns {Promise}
|
|
235
|
-
|
|
231
|
+
* @returns {Promise<{}>}
|
|
232
|
+
*/
|
|
236
233
|
async deleteIdentity(identityId: string): Promise<{}> {
|
|
237
234
|
if (typeof identityId === 'undefined') {
|
|
238
235
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
239
236
|
}
|
|
240
|
-
|
|
241
237
|
const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId);
|
|
242
238
|
const payload: Payload = {};
|
|
243
|
-
|
|
244
239
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
245
|
-
|
|
240
|
+
|
|
241
|
+
const apiHeaders: { [header: string]: string } = {
|
|
246
242
|
'content-type': 'application/json',
|
|
247
|
-
}
|
|
248
|
-
}
|
|
243
|
+
}
|
|
249
244
|
|
|
245
|
+
return await this.client.call(
|
|
246
|
+
'delete',
|
|
247
|
+
uri,
|
|
248
|
+
apiHeaders,
|
|
249
|
+
payload
|
|
250
|
+
);
|
|
251
|
+
}
|
|
250
252
|
/**
|
|
251
253
|
* Create user with MD5 password
|
|
252
254
|
*
|
|
253
|
-
* Create a new user. Password provided must be hashed with the
|
|
254
|
-
* [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST
|
|
255
|
-
* /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to
|
|
256
|
-
* create users with a plain text password.
|
|
255
|
+
* Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
257
256
|
*
|
|
258
257
|
* @param {string} userId
|
|
259
258
|
* @param {string} email
|
|
260
259
|
* @param {string} password
|
|
261
260
|
* @param {string} name
|
|
262
261
|
* @throws {AppwriteException}
|
|
263
|
-
* @returns {Promise}
|
|
264
|
-
|
|
262
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
263
|
+
*/
|
|
265
264
|
async createMD5User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
266
265
|
if (typeof userId === 'undefined') {
|
|
267
266
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
268
267
|
}
|
|
269
|
-
|
|
270
268
|
if (typeof email === 'undefined') {
|
|
271
269
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
272
270
|
}
|
|
273
|
-
|
|
274
271
|
if (typeof password === 'undefined') {
|
|
275
272
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
276
273
|
}
|
|
277
|
-
|
|
278
274
|
const apiPath = '/users/md5';
|
|
279
275
|
const payload: Payload = {};
|
|
280
|
-
|
|
281
276
|
if (typeof userId !== 'undefined') {
|
|
282
277
|
payload['userId'] = userId;
|
|
283
278
|
}
|
|
284
|
-
|
|
285
279
|
if (typeof email !== 'undefined') {
|
|
286
280
|
payload['email'] = email;
|
|
287
281
|
}
|
|
288
|
-
|
|
289
282
|
if (typeof password !== 'undefined') {
|
|
290
283
|
payload['password'] = password;
|
|
291
284
|
}
|
|
292
|
-
|
|
293
285
|
if (typeof name !== 'undefined') {
|
|
294
286
|
payload['name'] = name;
|
|
295
287
|
}
|
|
296
|
-
|
|
297
288
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
298
|
-
|
|
289
|
+
|
|
290
|
+
const apiHeaders: { [header: string]: string } = {
|
|
299
291
|
'content-type': 'application/json',
|
|
300
|
-
}
|
|
301
|
-
}
|
|
292
|
+
}
|
|
302
293
|
|
|
294
|
+
return await this.client.call(
|
|
295
|
+
'post',
|
|
296
|
+
uri,
|
|
297
|
+
apiHeaders,
|
|
298
|
+
payload
|
|
299
|
+
);
|
|
300
|
+
}
|
|
303
301
|
/**
|
|
304
302
|
* Create user with PHPass password
|
|
305
303
|
*
|
|
306
|
-
* Create a new user. Password provided must be hashed with the
|
|
307
|
-
* [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST
|
|
308
|
-
* /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to
|
|
309
|
-
* create users with a plain text password.
|
|
304
|
+
* Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
310
305
|
*
|
|
311
306
|
* @param {string} userId
|
|
312
307
|
* @param {string} email
|
|
313
308
|
* @param {string} password
|
|
314
309
|
* @param {string} name
|
|
315
310
|
* @throws {AppwriteException}
|
|
316
|
-
* @returns {Promise}
|
|
317
|
-
|
|
311
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
312
|
+
*/
|
|
318
313
|
async createPHPassUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
319
314
|
if (typeof userId === 'undefined') {
|
|
320
315
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
321
316
|
}
|
|
322
|
-
|
|
323
317
|
if (typeof email === 'undefined') {
|
|
324
318
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
325
319
|
}
|
|
326
|
-
|
|
327
320
|
if (typeof password === 'undefined') {
|
|
328
321
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
329
322
|
}
|
|
330
|
-
|
|
331
323
|
const apiPath = '/users/phpass';
|
|
332
324
|
const payload: Payload = {};
|
|
333
|
-
|
|
334
325
|
if (typeof userId !== 'undefined') {
|
|
335
326
|
payload['userId'] = userId;
|
|
336
327
|
}
|
|
337
|
-
|
|
338
328
|
if (typeof email !== 'undefined') {
|
|
339
329
|
payload['email'] = email;
|
|
340
330
|
}
|
|
341
|
-
|
|
342
331
|
if (typeof password !== 'undefined') {
|
|
343
332
|
payload['password'] = password;
|
|
344
333
|
}
|
|
345
|
-
|
|
346
334
|
if (typeof name !== 'undefined') {
|
|
347
335
|
payload['name'] = name;
|
|
348
336
|
}
|
|
349
|
-
|
|
350
337
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
351
|
-
|
|
338
|
+
|
|
339
|
+
const apiHeaders: { [header: string]: string } = {
|
|
352
340
|
'content-type': 'application/json',
|
|
353
|
-
}
|
|
354
|
-
}
|
|
341
|
+
}
|
|
355
342
|
|
|
343
|
+
return await this.client.call(
|
|
344
|
+
'post',
|
|
345
|
+
uri,
|
|
346
|
+
apiHeaders,
|
|
347
|
+
payload
|
|
348
|
+
);
|
|
349
|
+
}
|
|
356
350
|
/**
|
|
357
351
|
* Create user with Scrypt password
|
|
358
352
|
*
|
|
359
|
-
* Create a new user. Password provided must be hashed with the
|
|
360
|
-
* [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST
|
|
361
|
-
* /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to
|
|
362
|
-
* create users with a plain text password.
|
|
353
|
+
* Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
363
354
|
*
|
|
364
355
|
* @param {string} userId
|
|
365
356
|
* @param {string} email
|
|
@@ -371,94 +362,79 @@ export class Users extends Service {
|
|
|
371
362
|
* @param {number} passwordLength
|
|
372
363
|
* @param {string} name
|
|
373
364
|
* @throws {AppwriteException}
|
|
374
|
-
* @returns {Promise}
|
|
375
|
-
|
|
365
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
366
|
+
*/
|
|
376
367
|
async createScryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>> {
|
|
377
368
|
if (typeof userId === 'undefined') {
|
|
378
369
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
379
370
|
}
|
|
380
|
-
|
|
381
371
|
if (typeof email === 'undefined') {
|
|
382
372
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
383
373
|
}
|
|
384
|
-
|
|
385
374
|
if (typeof password === 'undefined') {
|
|
386
375
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
387
376
|
}
|
|
388
|
-
|
|
389
377
|
if (typeof passwordSalt === 'undefined') {
|
|
390
378
|
throw new AppwriteException('Missing required parameter: "passwordSalt"');
|
|
391
379
|
}
|
|
392
|
-
|
|
393
380
|
if (typeof passwordCpu === 'undefined') {
|
|
394
381
|
throw new AppwriteException('Missing required parameter: "passwordCpu"');
|
|
395
382
|
}
|
|
396
|
-
|
|
397
383
|
if (typeof passwordMemory === 'undefined') {
|
|
398
384
|
throw new AppwriteException('Missing required parameter: "passwordMemory"');
|
|
399
385
|
}
|
|
400
|
-
|
|
401
386
|
if (typeof passwordParallel === 'undefined') {
|
|
402
387
|
throw new AppwriteException('Missing required parameter: "passwordParallel"');
|
|
403
388
|
}
|
|
404
|
-
|
|
405
389
|
if (typeof passwordLength === 'undefined') {
|
|
406
390
|
throw new AppwriteException('Missing required parameter: "passwordLength"');
|
|
407
391
|
}
|
|
408
|
-
|
|
409
392
|
const apiPath = '/users/scrypt';
|
|
410
393
|
const payload: Payload = {};
|
|
411
|
-
|
|
412
394
|
if (typeof userId !== 'undefined') {
|
|
413
395
|
payload['userId'] = userId;
|
|
414
396
|
}
|
|
415
|
-
|
|
416
397
|
if (typeof email !== 'undefined') {
|
|
417
398
|
payload['email'] = email;
|
|
418
399
|
}
|
|
419
|
-
|
|
420
400
|
if (typeof password !== 'undefined') {
|
|
421
401
|
payload['password'] = password;
|
|
422
402
|
}
|
|
423
|
-
|
|
424
403
|
if (typeof passwordSalt !== 'undefined') {
|
|
425
404
|
payload['passwordSalt'] = passwordSalt;
|
|
426
405
|
}
|
|
427
|
-
|
|
428
406
|
if (typeof passwordCpu !== 'undefined') {
|
|
429
407
|
payload['passwordCpu'] = passwordCpu;
|
|
430
408
|
}
|
|
431
|
-
|
|
432
409
|
if (typeof passwordMemory !== 'undefined') {
|
|
433
410
|
payload['passwordMemory'] = passwordMemory;
|
|
434
411
|
}
|
|
435
|
-
|
|
436
412
|
if (typeof passwordParallel !== 'undefined') {
|
|
437
413
|
payload['passwordParallel'] = passwordParallel;
|
|
438
414
|
}
|
|
439
|
-
|
|
440
415
|
if (typeof passwordLength !== 'undefined') {
|
|
441
416
|
payload['passwordLength'] = passwordLength;
|
|
442
417
|
}
|
|
443
|
-
|
|
444
418
|
if (typeof name !== 'undefined') {
|
|
445
419
|
payload['name'] = name;
|
|
446
420
|
}
|
|
447
|
-
|
|
448
421
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
449
|
-
|
|
422
|
+
|
|
423
|
+
const apiHeaders: { [header: string]: string } = {
|
|
450
424
|
'content-type': 'application/json',
|
|
451
|
-
}
|
|
452
|
-
}
|
|
425
|
+
}
|
|
453
426
|
|
|
427
|
+
return await this.client.call(
|
|
428
|
+
'post',
|
|
429
|
+
uri,
|
|
430
|
+
apiHeaders,
|
|
431
|
+
payload
|
|
432
|
+
);
|
|
433
|
+
}
|
|
454
434
|
/**
|
|
455
435
|
* Create user with Scrypt modified password
|
|
456
436
|
*
|
|
457
|
-
* Create a new user. Password provided must be hashed with the [Scrypt
|
|
458
|
-
* Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc)
|
|
459
|
-
* algorithm. Use the [POST
|
|
460
|
-
* /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to
|
|
461
|
-
* create users with a plain text password.
|
|
437
|
+
* Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
462
438
|
*
|
|
463
439
|
* @param {string} userId
|
|
464
440
|
* @param {string} email
|
|
@@ -468,77 +444,67 @@ export class Users extends Service {
|
|
|
468
444
|
* @param {string} passwordSignerKey
|
|
469
445
|
* @param {string} name
|
|
470
446
|
* @throws {AppwriteException}
|
|
471
|
-
* @returns {Promise}
|
|
472
|
-
|
|
447
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
448
|
+
*/
|
|
473
449
|
async createScryptModifiedUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>> {
|
|
474
450
|
if (typeof userId === 'undefined') {
|
|
475
451
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
476
452
|
}
|
|
477
|
-
|
|
478
453
|
if (typeof email === 'undefined') {
|
|
479
454
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
480
455
|
}
|
|
481
|
-
|
|
482
456
|
if (typeof password === 'undefined') {
|
|
483
457
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
484
458
|
}
|
|
485
|
-
|
|
486
459
|
if (typeof passwordSalt === 'undefined') {
|
|
487
460
|
throw new AppwriteException('Missing required parameter: "passwordSalt"');
|
|
488
461
|
}
|
|
489
|
-
|
|
490
462
|
if (typeof passwordSaltSeparator === 'undefined') {
|
|
491
463
|
throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"');
|
|
492
464
|
}
|
|
493
|
-
|
|
494
465
|
if (typeof passwordSignerKey === 'undefined') {
|
|
495
466
|
throw new AppwriteException('Missing required parameter: "passwordSignerKey"');
|
|
496
467
|
}
|
|
497
|
-
|
|
498
468
|
const apiPath = '/users/scrypt-modified';
|
|
499
469
|
const payload: Payload = {};
|
|
500
|
-
|
|
501
470
|
if (typeof userId !== 'undefined') {
|
|
502
471
|
payload['userId'] = userId;
|
|
503
472
|
}
|
|
504
|
-
|
|
505
473
|
if (typeof email !== 'undefined') {
|
|
506
474
|
payload['email'] = email;
|
|
507
475
|
}
|
|
508
|
-
|
|
509
476
|
if (typeof password !== 'undefined') {
|
|
510
477
|
payload['password'] = password;
|
|
511
478
|
}
|
|
512
|
-
|
|
513
479
|
if (typeof passwordSalt !== 'undefined') {
|
|
514
480
|
payload['passwordSalt'] = passwordSalt;
|
|
515
481
|
}
|
|
516
|
-
|
|
517
482
|
if (typeof passwordSaltSeparator !== 'undefined') {
|
|
518
483
|
payload['passwordSaltSeparator'] = passwordSaltSeparator;
|
|
519
484
|
}
|
|
520
|
-
|
|
521
485
|
if (typeof passwordSignerKey !== 'undefined') {
|
|
522
486
|
payload['passwordSignerKey'] = passwordSignerKey;
|
|
523
487
|
}
|
|
524
|
-
|
|
525
488
|
if (typeof name !== 'undefined') {
|
|
526
489
|
payload['name'] = name;
|
|
527
490
|
}
|
|
528
|
-
|
|
529
491
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
530
|
-
|
|
492
|
+
|
|
493
|
+
const apiHeaders: { [header: string]: string } = {
|
|
531
494
|
'content-type': 'application/json',
|
|
532
|
-
}
|
|
533
|
-
}
|
|
495
|
+
}
|
|
534
496
|
|
|
497
|
+
return await this.client.call(
|
|
498
|
+
'post',
|
|
499
|
+
uri,
|
|
500
|
+
apiHeaders,
|
|
501
|
+
payload
|
|
502
|
+
);
|
|
503
|
+
}
|
|
535
504
|
/**
|
|
536
505
|
* Create user with SHA password
|
|
537
506
|
*
|
|
538
|
-
* Create a new user. Password provided must be hashed with the
|
|
539
|
-
* [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use
|
|
540
|
-
* the [POST /users](https://appwrite.io/docs/server/users#usersCreate)
|
|
541
|
-
* endpoint to create users with a plain text password.
|
|
507
|
+
* Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
542
508
|
*
|
|
543
509
|
* @param {string} userId
|
|
544
510
|
* @param {string} email
|
|
@@ -546,72 +512,75 @@ export class Users extends Service {
|
|
|
546
512
|
* @param {PasswordHash} passwordVersion
|
|
547
513
|
* @param {string} name
|
|
548
514
|
* @throws {AppwriteException}
|
|
549
|
-
* @returns {Promise}
|
|
550
|
-
|
|
515
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
516
|
+
*/
|
|
551
517
|
async createSHAUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise<Models.User<Preferences>> {
|
|
552
518
|
if (typeof userId === 'undefined') {
|
|
553
519
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
554
520
|
}
|
|
555
|
-
|
|
556
521
|
if (typeof email === 'undefined') {
|
|
557
522
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
558
523
|
}
|
|
559
|
-
|
|
560
524
|
if (typeof password === 'undefined') {
|
|
561
525
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
562
526
|
}
|
|
563
|
-
|
|
564
527
|
const apiPath = '/users/sha';
|
|
565
528
|
const payload: Payload = {};
|
|
566
|
-
|
|
567
529
|
if (typeof userId !== 'undefined') {
|
|
568
530
|
payload['userId'] = userId;
|
|
569
531
|
}
|
|
570
|
-
|
|
571
532
|
if (typeof email !== 'undefined') {
|
|
572
533
|
payload['email'] = email;
|
|
573
534
|
}
|
|
574
|
-
|
|
575
535
|
if (typeof password !== 'undefined') {
|
|
576
536
|
payload['password'] = password;
|
|
577
537
|
}
|
|
578
|
-
|
|
579
538
|
if (typeof passwordVersion !== 'undefined') {
|
|
580
539
|
payload['passwordVersion'] = passwordVersion;
|
|
581
540
|
}
|
|
582
|
-
|
|
583
541
|
if (typeof name !== 'undefined') {
|
|
584
542
|
payload['name'] = name;
|
|
585
543
|
}
|
|
586
|
-
|
|
587
544
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
588
|
-
|
|
545
|
+
|
|
546
|
+
const apiHeaders: { [header: string]: string } = {
|
|
589
547
|
'content-type': 'application/json',
|
|
590
|
-
}
|
|
591
|
-
}
|
|
548
|
+
}
|
|
592
549
|
|
|
550
|
+
return await this.client.call(
|
|
551
|
+
'post',
|
|
552
|
+
uri,
|
|
553
|
+
apiHeaders,
|
|
554
|
+
payload
|
|
555
|
+
);
|
|
556
|
+
}
|
|
593
557
|
/**
|
|
594
558
|
* Get users usage stats
|
|
595
559
|
*
|
|
596
560
|
*
|
|
597
561
|
* @param {UserUsageRange} range
|
|
598
562
|
* @throws {AppwriteException}
|
|
599
|
-
* @returns {Promise}
|
|
600
|
-
|
|
563
|
+
* @returns {Promise<Models.UsageUsers>}
|
|
564
|
+
*/
|
|
601
565
|
async getUsage(range?: UserUsageRange): Promise<Models.UsageUsers> {
|
|
602
566
|
const apiPath = '/users/usage';
|
|
603
567
|
const payload: Payload = {};
|
|
604
|
-
|
|
605
568
|
if (typeof range !== 'undefined') {
|
|
606
569
|
payload['range'] = range;
|
|
607
570
|
}
|
|
608
|
-
|
|
609
571
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
610
|
-
|
|
572
|
+
|
|
573
|
+
const apiHeaders: { [header: string]: string } = {
|
|
611
574
|
'content-type': 'application/json',
|
|
612
|
-
}
|
|
613
|
-
}
|
|
575
|
+
}
|
|
614
576
|
|
|
577
|
+
return await this.client.call(
|
|
578
|
+
'get',
|
|
579
|
+
uri,
|
|
580
|
+
apiHeaders,
|
|
581
|
+
payload
|
|
582
|
+
);
|
|
583
|
+
}
|
|
615
584
|
/**
|
|
616
585
|
* Get user
|
|
617
586
|
*
|
|
@@ -619,50 +588,55 @@ export class Users extends Service {
|
|
|
619
588
|
*
|
|
620
589
|
* @param {string} userId
|
|
621
590
|
* @throws {AppwriteException}
|
|
622
|
-
* @returns {Promise}
|
|
623
|
-
|
|
591
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
592
|
+
*/
|
|
624
593
|
async get<Preferences extends Models.Preferences>(userId: string): Promise<Models.User<Preferences>> {
|
|
625
594
|
if (typeof userId === 'undefined') {
|
|
626
595
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
627
596
|
}
|
|
628
|
-
|
|
629
597
|
const apiPath = '/users/{userId}'.replace('{userId}', userId);
|
|
630
598
|
const payload: Payload = {};
|
|
631
|
-
|
|
632
599
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
633
|
-
|
|
600
|
+
|
|
601
|
+
const apiHeaders: { [header: string]: string } = {
|
|
634
602
|
'content-type': 'application/json',
|
|
635
|
-
}
|
|
636
|
-
}
|
|
603
|
+
}
|
|
637
604
|
|
|
605
|
+
return await this.client.call(
|
|
606
|
+
'get',
|
|
607
|
+
uri,
|
|
608
|
+
apiHeaders,
|
|
609
|
+
payload
|
|
610
|
+
);
|
|
611
|
+
}
|
|
638
612
|
/**
|
|
639
613
|
* Delete user
|
|
640
614
|
*
|
|
641
|
-
* Delete a user by its unique ID, thereby releasing it
|
|
642
|
-
* released and can be reused, all user-related resources like documents or
|
|
643
|
-
* storage files should be deleted before user deletion. If you want to keep
|
|
644
|
-
* ID reserved, use the
|
|
645
|
-
* [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus)
|
|
646
|
-
* endpoint instead.
|
|
615
|
+
* Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.
|
|
647
616
|
*
|
|
648
617
|
* @param {string} userId
|
|
649
618
|
* @throws {AppwriteException}
|
|
650
|
-
* @returns {Promise}
|
|
651
|
-
|
|
619
|
+
* @returns {Promise<{}>}
|
|
620
|
+
*/
|
|
652
621
|
async delete(userId: string): Promise<{}> {
|
|
653
622
|
if (typeof userId === 'undefined') {
|
|
654
623
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
655
624
|
}
|
|
656
|
-
|
|
657
625
|
const apiPath = '/users/{userId}'.replace('{userId}', userId);
|
|
658
626
|
const payload: Payload = {};
|
|
659
|
-
|
|
660
627
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
661
|
-
|
|
628
|
+
|
|
629
|
+
const apiHeaders: { [header: string]: string } = {
|
|
662
630
|
'content-type': 'application/json',
|
|
663
|
-
}
|
|
664
|
-
}
|
|
631
|
+
}
|
|
665
632
|
|
|
633
|
+
return await this.client.call(
|
|
634
|
+
'delete',
|
|
635
|
+
uri,
|
|
636
|
+
apiHeaders,
|
|
637
|
+
payload
|
|
638
|
+
);
|
|
639
|
+
}
|
|
666
640
|
/**
|
|
667
641
|
* Update email
|
|
668
642
|
*
|
|
@@ -671,67 +645,106 @@ export class Users extends Service {
|
|
|
671
645
|
* @param {string} userId
|
|
672
646
|
* @param {string} email
|
|
673
647
|
* @throws {AppwriteException}
|
|
674
|
-
* @returns {Promise}
|
|
675
|
-
|
|
648
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
649
|
+
*/
|
|
676
650
|
async updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>> {
|
|
677
651
|
if (typeof userId === 'undefined') {
|
|
678
652
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
679
653
|
}
|
|
680
|
-
|
|
681
654
|
if (typeof email === 'undefined') {
|
|
682
655
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
683
656
|
}
|
|
684
|
-
|
|
685
657
|
const apiPath = '/users/{userId}/email'.replace('{userId}', userId);
|
|
686
658
|
const payload: Payload = {};
|
|
687
|
-
|
|
688
659
|
if (typeof email !== 'undefined') {
|
|
689
660
|
payload['email'] = email;
|
|
690
661
|
}
|
|
691
|
-
|
|
692
662
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
693
|
-
|
|
663
|
+
|
|
664
|
+
const apiHeaders: { [header: string]: string } = {
|
|
694
665
|
'content-type': 'application/json',
|
|
695
|
-
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
return await this.client.call(
|
|
669
|
+
'patch',
|
|
670
|
+
uri,
|
|
671
|
+
apiHeaders,
|
|
672
|
+
payload
|
|
673
|
+
);
|
|
696
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* Create user JWT
|
|
677
|
+
*
|
|
678
|
+
* Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.
|
|
679
|
+
*
|
|
680
|
+
* @param {string} userId
|
|
681
|
+
* @param {string} sessionId
|
|
682
|
+
* @param {number} duration
|
|
683
|
+
* @throws {AppwriteException}
|
|
684
|
+
* @returns {Promise<Models.Jwt>}
|
|
685
|
+
*/
|
|
686
|
+
async createJWT(userId: string, sessionId?: string, duration?: number): Promise<Models.Jwt> {
|
|
687
|
+
if (typeof userId === 'undefined') {
|
|
688
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
689
|
+
}
|
|
690
|
+
const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId);
|
|
691
|
+
const payload: Payload = {};
|
|
692
|
+
if (typeof sessionId !== 'undefined') {
|
|
693
|
+
payload['sessionId'] = sessionId;
|
|
694
|
+
}
|
|
695
|
+
if (typeof duration !== 'undefined') {
|
|
696
|
+
payload['duration'] = duration;
|
|
697
|
+
}
|
|
698
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
699
|
+
|
|
700
|
+
const apiHeaders: { [header: string]: string } = {
|
|
701
|
+
'content-type': 'application/json',
|
|
702
|
+
}
|
|
697
703
|
|
|
704
|
+
return await this.client.call(
|
|
705
|
+
'post',
|
|
706
|
+
uri,
|
|
707
|
+
apiHeaders,
|
|
708
|
+
payload
|
|
709
|
+
);
|
|
710
|
+
}
|
|
698
711
|
/**
|
|
699
712
|
* Update user labels
|
|
700
713
|
*
|
|
701
714
|
* Update the user labels by its unique ID.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
* user's to share access to a resource, labels can be defined by the
|
|
705
|
-
* developer to grant access without an invitation. See the [Permissions
|
|
706
|
-
* docs](https://appwrite.io/docs/permissions) for more info.
|
|
715
|
+
|
|
716
|
+
Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.
|
|
707
717
|
*
|
|
708
718
|
* @param {string} userId
|
|
709
719
|
* @param {string[]} labels
|
|
710
720
|
* @throws {AppwriteException}
|
|
711
|
-
* @returns {Promise}
|
|
712
|
-
|
|
721
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
722
|
+
*/
|
|
713
723
|
async updateLabels<Preferences extends Models.Preferences>(userId: string, labels: string[]): Promise<Models.User<Preferences>> {
|
|
714
724
|
if (typeof userId === 'undefined') {
|
|
715
725
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
716
726
|
}
|
|
717
|
-
|
|
718
727
|
if (typeof labels === 'undefined') {
|
|
719
728
|
throw new AppwriteException('Missing required parameter: "labels"');
|
|
720
729
|
}
|
|
721
|
-
|
|
722
730
|
const apiPath = '/users/{userId}/labels'.replace('{userId}', userId);
|
|
723
731
|
const payload: Payload = {};
|
|
724
|
-
|
|
725
732
|
if (typeof labels !== 'undefined') {
|
|
726
733
|
payload['labels'] = labels;
|
|
727
734
|
}
|
|
728
|
-
|
|
729
735
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
730
|
-
|
|
736
|
+
|
|
737
|
+
const apiHeaders: { [header: string]: string } = {
|
|
731
738
|
'content-type': 'application/json',
|
|
732
|
-
}
|
|
733
|
-
}
|
|
739
|
+
}
|
|
734
740
|
|
|
741
|
+
return await this.client.call(
|
|
742
|
+
'put',
|
|
743
|
+
uri,
|
|
744
|
+
apiHeaders,
|
|
745
|
+
payload
|
|
746
|
+
);
|
|
747
|
+
}
|
|
735
748
|
/**
|
|
736
749
|
* List user logs
|
|
737
750
|
*
|
|
@@ -740,26 +753,30 @@ export class Users extends Service {
|
|
|
740
753
|
* @param {string} userId
|
|
741
754
|
* @param {string[]} queries
|
|
742
755
|
* @throws {AppwriteException}
|
|
743
|
-
* @returns {Promise}
|
|
744
|
-
|
|
756
|
+
* @returns {Promise<Models.LogList>}
|
|
757
|
+
*/
|
|
745
758
|
async listLogs(userId: string, queries?: string[]): Promise<Models.LogList> {
|
|
746
759
|
if (typeof userId === 'undefined') {
|
|
747
760
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
748
761
|
}
|
|
749
|
-
|
|
750
762
|
const apiPath = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
751
763
|
const payload: Payload = {};
|
|
752
|
-
|
|
753
764
|
if (typeof queries !== 'undefined') {
|
|
754
765
|
payload['queries'] = queries;
|
|
755
766
|
}
|
|
756
|
-
|
|
757
767
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
758
|
-
|
|
768
|
+
|
|
769
|
+
const apiHeaders: { [header: string]: string } = {
|
|
759
770
|
'content-type': 'application/json',
|
|
760
|
-
}
|
|
761
|
-
}
|
|
771
|
+
}
|
|
762
772
|
|
|
773
|
+
return await this.client.call(
|
|
774
|
+
'get',
|
|
775
|
+
uri,
|
|
776
|
+
apiHeaders,
|
|
777
|
+
payload
|
|
778
|
+
);
|
|
779
|
+
}
|
|
763
780
|
/**
|
|
764
781
|
* List user memberships
|
|
765
782
|
*
|
|
@@ -767,22 +784,27 @@ export class Users extends Service {
|
|
|
767
784
|
*
|
|
768
785
|
* @param {string} userId
|
|
769
786
|
* @throws {AppwriteException}
|
|
770
|
-
* @returns {Promise}
|
|
771
|
-
|
|
787
|
+
* @returns {Promise<Models.MembershipList>}
|
|
788
|
+
*/
|
|
772
789
|
async listMemberships(userId: string): Promise<Models.MembershipList> {
|
|
773
790
|
if (typeof userId === 'undefined') {
|
|
774
791
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
775
792
|
}
|
|
776
|
-
|
|
777
793
|
const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
778
794
|
const payload: Payload = {};
|
|
779
|
-
|
|
780
795
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
781
|
-
|
|
796
|
+
|
|
797
|
+
const apiHeaders: { [header: string]: string } = {
|
|
782
798
|
'content-type': 'application/json',
|
|
783
|
-
}
|
|
784
|
-
}
|
|
799
|
+
}
|
|
785
800
|
|
|
801
|
+
return await this.client.call(
|
|
802
|
+
'get',
|
|
803
|
+
uri,
|
|
804
|
+
apiHeaders,
|
|
805
|
+
payload
|
|
806
|
+
);
|
|
807
|
+
}
|
|
786
808
|
/**
|
|
787
809
|
* Update MFA
|
|
788
810
|
*
|
|
@@ -791,30 +813,33 @@ export class Users extends Service {
|
|
|
791
813
|
* @param {string} userId
|
|
792
814
|
* @param {boolean} mfa
|
|
793
815
|
* @throws {AppwriteException}
|
|
794
|
-
* @returns {Promise}
|
|
795
|
-
|
|
816
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
817
|
+
*/
|
|
796
818
|
async updateMfa<Preferences extends Models.Preferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>> {
|
|
797
819
|
if (typeof userId === 'undefined') {
|
|
798
820
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
799
821
|
}
|
|
800
|
-
|
|
801
822
|
if (typeof mfa === 'undefined') {
|
|
802
823
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
803
824
|
}
|
|
804
|
-
|
|
805
825
|
const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId);
|
|
806
826
|
const payload: Payload = {};
|
|
807
|
-
|
|
808
827
|
if (typeof mfa !== 'undefined') {
|
|
809
828
|
payload['mfa'] = mfa;
|
|
810
829
|
}
|
|
811
|
-
|
|
812
830
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
813
|
-
|
|
831
|
+
|
|
832
|
+
const apiHeaders: { [header: string]: string } = {
|
|
814
833
|
'content-type': 'application/json',
|
|
815
|
-
}
|
|
816
|
-
}
|
|
834
|
+
}
|
|
817
835
|
|
|
836
|
+
return await this.client.call(
|
|
837
|
+
'patch',
|
|
838
|
+
uri,
|
|
839
|
+
apiHeaders,
|
|
840
|
+
payload
|
|
841
|
+
);
|
|
842
|
+
}
|
|
818
843
|
/**
|
|
819
844
|
* Delete Authenticator
|
|
820
845
|
*
|
|
@@ -823,26 +848,30 @@ export class Users extends Service {
|
|
|
823
848
|
* @param {string} userId
|
|
824
849
|
* @param {AuthenticatorType} type
|
|
825
850
|
* @throws {AppwriteException}
|
|
826
|
-
* @returns {Promise}
|
|
827
|
-
|
|
851
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
852
|
+
*/
|
|
828
853
|
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(userId: string, type: AuthenticatorType): Promise<Models.User<Preferences>> {
|
|
829
854
|
if (typeof userId === 'undefined') {
|
|
830
855
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
831
856
|
}
|
|
832
|
-
|
|
833
857
|
if (typeof type === 'undefined') {
|
|
834
858
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
835
859
|
}
|
|
836
|
-
|
|
837
860
|
const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type);
|
|
838
861
|
const payload: Payload = {};
|
|
839
|
-
|
|
840
862
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
841
|
-
|
|
863
|
+
|
|
864
|
+
const apiHeaders: { [header: string]: string } = {
|
|
842
865
|
'content-type': 'application/json',
|
|
843
|
-
}
|
|
844
|
-
}
|
|
866
|
+
}
|
|
845
867
|
|
|
868
|
+
return await this.client.call(
|
|
869
|
+
'delete',
|
|
870
|
+
uri,
|
|
871
|
+
apiHeaders,
|
|
872
|
+
payload
|
|
873
|
+
);
|
|
874
|
+
}
|
|
846
875
|
/**
|
|
847
876
|
* List Factors
|
|
848
877
|
*
|
|
@@ -850,100 +879,111 @@ export class Users extends Service {
|
|
|
850
879
|
*
|
|
851
880
|
* @param {string} userId
|
|
852
881
|
* @throws {AppwriteException}
|
|
853
|
-
* @returns {Promise}
|
|
854
|
-
|
|
882
|
+
* @returns {Promise<Models.MfaFactors>}
|
|
883
|
+
*/
|
|
855
884
|
async listMfaFactors(userId: string): Promise<Models.MfaFactors> {
|
|
856
885
|
if (typeof userId === 'undefined') {
|
|
857
886
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
858
887
|
}
|
|
859
|
-
|
|
860
888
|
const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId);
|
|
861
889
|
const payload: Payload = {};
|
|
862
|
-
|
|
863
890
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
864
|
-
|
|
891
|
+
|
|
892
|
+
const apiHeaders: { [header: string]: string } = {
|
|
865
893
|
'content-type': 'application/json',
|
|
866
|
-
}
|
|
867
|
-
}
|
|
894
|
+
}
|
|
868
895
|
|
|
896
|
+
return await this.client.call(
|
|
897
|
+
'get',
|
|
898
|
+
uri,
|
|
899
|
+
apiHeaders,
|
|
900
|
+
payload
|
|
901
|
+
);
|
|
902
|
+
}
|
|
869
903
|
/**
|
|
870
904
|
* Get MFA Recovery Codes
|
|
871
905
|
*
|
|
872
|
-
* Get recovery codes that can be used as backup for MFA flow by User ID.
|
|
873
|
-
* Before getting codes, they must be generated using
|
|
874
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
875
|
-
* method.
|
|
906
|
+
* Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
|
|
876
907
|
*
|
|
877
908
|
* @param {string} userId
|
|
878
909
|
* @throws {AppwriteException}
|
|
879
|
-
* @returns {Promise}
|
|
880
|
-
|
|
910
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
911
|
+
*/
|
|
881
912
|
async getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
|
|
882
913
|
if (typeof userId === 'undefined') {
|
|
883
914
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
884
915
|
}
|
|
885
|
-
|
|
886
916
|
const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
|
|
887
917
|
const payload: Payload = {};
|
|
888
|
-
|
|
889
918
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
890
|
-
|
|
919
|
+
|
|
920
|
+
const apiHeaders: { [header: string]: string } = {
|
|
891
921
|
'content-type': 'application/json',
|
|
892
|
-
}
|
|
893
|
-
}
|
|
922
|
+
}
|
|
894
923
|
|
|
924
|
+
return await this.client.call(
|
|
925
|
+
'get',
|
|
926
|
+
uri,
|
|
927
|
+
apiHeaders,
|
|
928
|
+
payload
|
|
929
|
+
);
|
|
930
|
+
}
|
|
895
931
|
/**
|
|
896
932
|
* Regenerate MFA Recovery Codes
|
|
897
933
|
*
|
|
898
|
-
* Regenerate recovery codes that can be used as backup for MFA flow by User
|
|
899
|
-
* ID. Before regenerating codes, they must be first generated using
|
|
900
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
901
|
-
* method.
|
|
934
|
+
* Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
|
|
902
935
|
*
|
|
903
936
|
* @param {string} userId
|
|
904
937
|
* @throws {AppwriteException}
|
|
905
|
-
* @returns {Promise}
|
|
906
|
-
|
|
938
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
939
|
+
*/
|
|
907
940
|
async updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
|
|
908
941
|
if (typeof userId === 'undefined') {
|
|
909
942
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
910
943
|
}
|
|
911
|
-
|
|
912
944
|
const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
|
|
913
945
|
const payload: Payload = {};
|
|
914
|
-
|
|
915
946
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
916
|
-
|
|
947
|
+
|
|
948
|
+
const apiHeaders: { [header: string]: string } = {
|
|
917
949
|
'content-type': 'application/json',
|
|
918
|
-
}
|
|
919
|
-
}
|
|
950
|
+
}
|
|
920
951
|
|
|
952
|
+
return await this.client.call(
|
|
953
|
+
'put',
|
|
954
|
+
uri,
|
|
955
|
+
apiHeaders,
|
|
956
|
+
payload
|
|
957
|
+
);
|
|
958
|
+
}
|
|
921
959
|
/**
|
|
922
960
|
* Create MFA Recovery Codes
|
|
923
961
|
*
|
|
924
|
-
* Generate recovery codes used as backup for MFA flow for User ID. Recovery
|
|
925
|
-
* codes can be used as a MFA verification type in
|
|
926
|
-
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
927
|
-
* method by client SDK.
|
|
962
|
+
* Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.
|
|
928
963
|
*
|
|
929
964
|
* @param {string} userId
|
|
930
965
|
* @throws {AppwriteException}
|
|
931
|
-
* @returns {Promise}
|
|
932
|
-
|
|
966
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
967
|
+
*/
|
|
933
968
|
async createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
|
|
934
969
|
if (typeof userId === 'undefined') {
|
|
935
970
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
936
971
|
}
|
|
937
|
-
|
|
938
972
|
const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
|
|
939
973
|
const payload: Payload = {};
|
|
940
|
-
|
|
941
974
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
942
|
-
|
|
975
|
+
|
|
976
|
+
const apiHeaders: { [header: string]: string } = {
|
|
943
977
|
'content-type': 'application/json',
|
|
944
|
-
}
|
|
945
|
-
}
|
|
978
|
+
}
|
|
946
979
|
|
|
980
|
+
return await this.client.call(
|
|
981
|
+
'patch',
|
|
982
|
+
uri,
|
|
983
|
+
apiHeaders,
|
|
984
|
+
payload
|
|
985
|
+
);
|
|
986
|
+
}
|
|
947
987
|
/**
|
|
948
988
|
* Update name
|
|
949
989
|
*
|
|
@@ -952,30 +992,33 @@ export class Users extends Service {
|
|
|
952
992
|
* @param {string} userId
|
|
953
993
|
* @param {string} name
|
|
954
994
|
* @throws {AppwriteException}
|
|
955
|
-
* @returns {Promise}
|
|
956
|
-
|
|
995
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
996
|
+
*/
|
|
957
997
|
async updateName<Preferences extends Models.Preferences>(userId: string, name: string): Promise<Models.User<Preferences>> {
|
|
958
998
|
if (typeof userId === 'undefined') {
|
|
959
999
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
960
1000
|
}
|
|
961
|
-
|
|
962
1001
|
if (typeof name === 'undefined') {
|
|
963
1002
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
964
1003
|
}
|
|
965
|
-
|
|
966
1004
|
const apiPath = '/users/{userId}/name'.replace('{userId}', userId);
|
|
967
1005
|
const payload: Payload = {};
|
|
968
|
-
|
|
969
1006
|
if (typeof name !== 'undefined') {
|
|
970
1007
|
payload['name'] = name;
|
|
971
1008
|
}
|
|
972
|
-
|
|
973
1009
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
974
|
-
|
|
1010
|
+
|
|
1011
|
+
const apiHeaders: { [header: string]: string } = {
|
|
975
1012
|
'content-type': 'application/json',
|
|
976
|
-
}
|
|
977
|
-
}
|
|
1013
|
+
}
|
|
978
1014
|
|
|
1015
|
+
return await this.client.call(
|
|
1016
|
+
'patch',
|
|
1017
|
+
uri,
|
|
1018
|
+
apiHeaders,
|
|
1019
|
+
payload
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
979
1022
|
/**
|
|
980
1023
|
* Update password
|
|
981
1024
|
*
|
|
@@ -984,30 +1027,33 @@ export class Users extends Service {
|
|
|
984
1027
|
* @param {string} userId
|
|
985
1028
|
* @param {string} password
|
|
986
1029
|
* @throws {AppwriteException}
|
|
987
|
-
* @returns {Promise}
|
|
988
|
-
|
|
1030
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1031
|
+
*/
|
|
989
1032
|
async updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>> {
|
|
990
1033
|
if (typeof userId === 'undefined') {
|
|
991
1034
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
992
1035
|
}
|
|
993
|
-
|
|
994
1036
|
if (typeof password === 'undefined') {
|
|
995
1037
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
996
1038
|
}
|
|
997
|
-
|
|
998
1039
|
const apiPath = '/users/{userId}/password'.replace('{userId}', userId);
|
|
999
1040
|
const payload: Payload = {};
|
|
1000
|
-
|
|
1001
1041
|
if (typeof password !== 'undefined') {
|
|
1002
1042
|
payload['password'] = password;
|
|
1003
1043
|
}
|
|
1004
|
-
|
|
1005
1044
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1006
|
-
|
|
1045
|
+
|
|
1046
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1007
1047
|
'content-type': 'application/json',
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1048
|
+
}
|
|
1010
1049
|
|
|
1050
|
+
return await this.client.call(
|
|
1051
|
+
'patch',
|
|
1052
|
+
uri,
|
|
1053
|
+
apiHeaders,
|
|
1054
|
+
payload
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1011
1057
|
/**
|
|
1012
1058
|
* Update phone
|
|
1013
1059
|
*
|
|
@@ -1016,30 +1062,33 @@ export class Users extends Service {
|
|
|
1016
1062
|
* @param {string} userId
|
|
1017
1063
|
* @param {string} number
|
|
1018
1064
|
* @throws {AppwriteException}
|
|
1019
|
-
* @returns {Promise}
|
|
1020
|
-
|
|
1065
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1066
|
+
*/
|
|
1021
1067
|
async updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>> {
|
|
1022
1068
|
if (typeof userId === 'undefined') {
|
|
1023
1069
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1024
1070
|
}
|
|
1025
|
-
|
|
1026
1071
|
if (typeof number === 'undefined') {
|
|
1027
1072
|
throw new AppwriteException('Missing required parameter: "number"');
|
|
1028
1073
|
}
|
|
1029
|
-
|
|
1030
1074
|
const apiPath = '/users/{userId}/phone'.replace('{userId}', userId);
|
|
1031
1075
|
const payload: Payload = {};
|
|
1032
|
-
|
|
1033
1076
|
if (typeof number !== 'undefined') {
|
|
1034
1077
|
payload['number'] = number;
|
|
1035
1078
|
}
|
|
1036
|
-
|
|
1037
1079
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1038
|
-
|
|
1080
|
+
|
|
1081
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1039
1082
|
'content-type': 'application/json',
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1083
|
+
}
|
|
1042
1084
|
|
|
1085
|
+
return await this.client.call(
|
|
1086
|
+
'patch',
|
|
1087
|
+
uri,
|
|
1088
|
+
apiHeaders,
|
|
1089
|
+
payload
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1043
1092
|
/**
|
|
1044
1093
|
* Get user preferences
|
|
1045
1094
|
*
|
|
@@ -1047,56 +1096,62 @@ export class Users extends Service {
|
|
|
1047
1096
|
*
|
|
1048
1097
|
* @param {string} userId
|
|
1049
1098
|
* @throws {AppwriteException}
|
|
1050
|
-
* @returns {Promise}
|
|
1051
|
-
|
|
1099
|
+
* @returns {Promise<Preferences>}
|
|
1100
|
+
*/
|
|
1052
1101
|
async getPrefs<Preferences extends Models.Preferences>(userId: string): Promise<Preferences> {
|
|
1053
1102
|
if (typeof userId === 'undefined') {
|
|
1054
1103
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1055
1104
|
}
|
|
1056
|
-
|
|
1057
1105
|
const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
1058
1106
|
const payload: Payload = {};
|
|
1059
|
-
|
|
1060
1107
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1061
|
-
|
|
1108
|
+
|
|
1109
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1062
1110
|
'content-type': 'application/json',
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1111
|
+
}
|
|
1065
1112
|
|
|
1113
|
+
return await this.client.call(
|
|
1114
|
+
'get',
|
|
1115
|
+
uri,
|
|
1116
|
+
apiHeaders,
|
|
1117
|
+
payload
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1066
1120
|
/**
|
|
1067
1121
|
* Update user preferences
|
|
1068
1122
|
*
|
|
1069
|
-
* Update the user preferences by its unique ID. The object you pass is stored
|
|
1070
|
-
* as is, and replaces any previous value. The maximum allowed prefs size is
|
|
1071
|
-
* 64kB and throws error if exceeded.
|
|
1123
|
+
* Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
|
1072
1124
|
*
|
|
1073
1125
|
* @param {string} userId
|
|
1074
1126
|
* @param {object} prefs
|
|
1075
1127
|
* @throws {AppwriteException}
|
|
1076
|
-
* @returns {Promise}
|
|
1077
|
-
|
|
1128
|
+
* @returns {Promise<Preferences>}
|
|
1129
|
+
*/
|
|
1078
1130
|
async updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences> {
|
|
1079
1131
|
if (typeof userId === 'undefined') {
|
|
1080
1132
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1081
1133
|
}
|
|
1082
|
-
|
|
1083
1134
|
if (typeof prefs === 'undefined') {
|
|
1084
1135
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
1085
1136
|
}
|
|
1086
|
-
|
|
1087
1137
|
const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
1088
1138
|
const payload: Payload = {};
|
|
1089
|
-
|
|
1090
1139
|
if (typeof prefs !== 'undefined') {
|
|
1091
1140
|
payload['prefs'] = prefs;
|
|
1092
1141
|
}
|
|
1093
|
-
|
|
1094
1142
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1095
|
-
|
|
1143
|
+
|
|
1144
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1096
1145
|
'content-type': 'application/json',
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1146
|
+
}
|
|
1099
1147
|
|
|
1148
|
+
return await this.client.call(
|
|
1149
|
+
'patch',
|
|
1150
|
+
uri,
|
|
1151
|
+
apiHeaders,
|
|
1152
|
+
payload
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1100
1155
|
/**
|
|
1101
1156
|
* List user sessions
|
|
1102
1157
|
*
|
|
@@ -1104,73 +1159,85 @@ export class Users extends Service {
|
|
|
1104
1159
|
*
|
|
1105
1160
|
* @param {string} userId
|
|
1106
1161
|
* @throws {AppwriteException}
|
|
1107
|
-
* @returns {Promise}
|
|
1108
|
-
|
|
1162
|
+
* @returns {Promise<Models.SessionList>}
|
|
1163
|
+
*/
|
|
1109
1164
|
async listSessions(userId: string): Promise<Models.SessionList> {
|
|
1110
1165
|
if (typeof userId === 'undefined') {
|
|
1111
1166
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1112
1167
|
}
|
|
1113
|
-
|
|
1114
1168
|
const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
1115
1169
|
const payload: Payload = {};
|
|
1116
|
-
|
|
1117
1170
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1118
|
-
|
|
1171
|
+
|
|
1172
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1119
1173
|
'content-type': 'application/json',
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1174
|
+
}
|
|
1122
1175
|
|
|
1176
|
+
return await this.client.call(
|
|
1177
|
+
'get',
|
|
1178
|
+
uri,
|
|
1179
|
+
apiHeaders,
|
|
1180
|
+
payload
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1123
1183
|
/**
|
|
1124
1184
|
* Create session
|
|
1125
1185
|
*
|
|
1126
1186
|
* Creates a session for a user. Returns an immediately usable session object.
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
* [POST
|
|
1130
|
-
* /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken)
|
|
1131
|
-
* endpoint.
|
|
1187
|
+
|
|
1188
|
+
If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint.
|
|
1132
1189
|
*
|
|
1133
1190
|
* @param {string} userId
|
|
1134
1191
|
* @throws {AppwriteException}
|
|
1135
|
-
* @returns {Promise}
|
|
1136
|
-
|
|
1192
|
+
* @returns {Promise<Models.Session>}
|
|
1193
|
+
*/
|
|
1137
1194
|
async createSession(userId: string): Promise<Models.Session> {
|
|
1138
1195
|
if (typeof userId === 'undefined') {
|
|
1139
1196
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1140
1197
|
}
|
|
1141
|
-
|
|
1142
1198
|
const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
1143
1199
|
const payload: Payload = {};
|
|
1144
|
-
|
|
1145
1200
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1146
|
-
|
|
1201
|
+
|
|
1202
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1147
1203
|
'content-type': 'application/json',
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1204
|
+
}
|
|
1150
1205
|
|
|
1206
|
+
return await this.client.call(
|
|
1207
|
+
'post',
|
|
1208
|
+
uri,
|
|
1209
|
+
apiHeaders,
|
|
1210
|
+
payload
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1151
1213
|
/**
|
|
1152
1214
|
* Delete user sessions
|
|
1153
1215
|
*
|
|
1154
|
-
* Delete all user
|
|
1216
|
+
* Delete all user's sessions by using the user's unique ID.
|
|
1155
1217
|
*
|
|
1156
1218
|
* @param {string} userId
|
|
1157
1219
|
* @throws {AppwriteException}
|
|
1158
|
-
* @returns {Promise}
|
|
1159
|
-
|
|
1220
|
+
* @returns {Promise<{}>}
|
|
1221
|
+
*/
|
|
1160
1222
|
async deleteSessions(userId: string): Promise<{}> {
|
|
1161
1223
|
if (typeof userId === 'undefined') {
|
|
1162
1224
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1163
1225
|
}
|
|
1164
|
-
|
|
1165
1226
|
const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
1166
1227
|
const payload: Payload = {};
|
|
1167
|
-
|
|
1168
1228
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1169
|
-
|
|
1229
|
+
|
|
1230
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1170
1231
|
'content-type': 'application/json',
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1232
|
+
}
|
|
1173
1233
|
|
|
1234
|
+
return await this.client.call(
|
|
1235
|
+
'delete',
|
|
1236
|
+
uri,
|
|
1237
|
+
apiHeaders,
|
|
1238
|
+
payload
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1174
1241
|
/**
|
|
1175
1242
|
* Delete user session
|
|
1176
1243
|
*
|
|
@@ -1179,59 +1246,65 @@ export class Users extends Service {
|
|
|
1179
1246
|
* @param {string} userId
|
|
1180
1247
|
* @param {string} sessionId
|
|
1181
1248
|
* @throws {AppwriteException}
|
|
1182
|
-
* @returns {Promise}
|
|
1183
|
-
|
|
1249
|
+
* @returns {Promise<{}>}
|
|
1250
|
+
*/
|
|
1184
1251
|
async deleteSession(userId: string, sessionId: string): Promise<{}> {
|
|
1185
1252
|
if (typeof userId === 'undefined') {
|
|
1186
1253
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1187
1254
|
}
|
|
1188
|
-
|
|
1189
1255
|
if (typeof sessionId === 'undefined') {
|
|
1190
1256
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1191
1257
|
}
|
|
1192
|
-
|
|
1193
1258
|
const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
|
|
1194
1259
|
const payload: Payload = {};
|
|
1195
|
-
|
|
1196
1260
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1197
|
-
|
|
1261
|
+
|
|
1262
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1198
1263
|
'content-type': 'application/json',
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1264
|
+
}
|
|
1201
1265
|
|
|
1266
|
+
return await this.client.call(
|
|
1267
|
+
'delete',
|
|
1268
|
+
uri,
|
|
1269
|
+
apiHeaders,
|
|
1270
|
+
payload
|
|
1271
|
+
);
|
|
1272
|
+
}
|
|
1202
1273
|
/**
|
|
1203
1274
|
* Update user status
|
|
1204
1275
|
*
|
|
1205
|
-
* Update the user status by its unique ID. Use this endpoint as an
|
|
1206
|
-
* alternative to deleting a user if you want to keep user's ID reserved.
|
|
1276
|
+
* Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.
|
|
1207
1277
|
*
|
|
1208
1278
|
* @param {string} userId
|
|
1209
1279
|
* @param {boolean} status
|
|
1210
1280
|
* @throws {AppwriteException}
|
|
1211
|
-
* @returns {Promise}
|
|
1212
|
-
|
|
1281
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1282
|
+
*/
|
|
1213
1283
|
async updateStatus<Preferences extends Models.Preferences>(userId: string, status: boolean): Promise<Models.User<Preferences>> {
|
|
1214
1284
|
if (typeof userId === 'undefined') {
|
|
1215
1285
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1216
1286
|
}
|
|
1217
|
-
|
|
1218
1287
|
if (typeof status === 'undefined') {
|
|
1219
1288
|
throw new AppwriteException('Missing required parameter: "status"');
|
|
1220
1289
|
}
|
|
1221
|
-
|
|
1222
1290
|
const apiPath = '/users/{userId}/status'.replace('{userId}', userId);
|
|
1223
1291
|
const payload: Payload = {};
|
|
1224
|
-
|
|
1225
1292
|
if (typeof status !== 'undefined') {
|
|
1226
1293
|
payload['status'] = status;
|
|
1227
1294
|
}
|
|
1228
|
-
|
|
1229
1295
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1230
|
-
|
|
1296
|
+
|
|
1297
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1231
1298
|
'content-type': 'application/json',
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1299
|
+
}
|
|
1234
1300
|
|
|
1301
|
+
return await this.client.call(
|
|
1302
|
+
'patch',
|
|
1303
|
+
uri,
|
|
1304
|
+
apiHeaders,
|
|
1305
|
+
payload
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1235
1308
|
/**
|
|
1236
1309
|
* List User Targets
|
|
1237
1310
|
*
|
|
@@ -1240,26 +1313,30 @@ export class Users extends Service {
|
|
|
1240
1313
|
* @param {string} userId
|
|
1241
1314
|
* @param {string[]} queries
|
|
1242
1315
|
* @throws {AppwriteException}
|
|
1243
|
-
* @returns {Promise}
|
|
1244
|
-
|
|
1316
|
+
* @returns {Promise<Models.TargetList>}
|
|
1317
|
+
*/
|
|
1245
1318
|
async listTargets(userId: string, queries?: string[]): Promise<Models.TargetList> {
|
|
1246
1319
|
if (typeof userId === 'undefined') {
|
|
1247
1320
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1248
1321
|
}
|
|
1249
|
-
|
|
1250
1322
|
const apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
|
|
1251
1323
|
const payload: Payload = {};
|
|
1252
|
-
|
|
1253
1324
|
if (typeof queries !== 'undefined') {
|
|
1254
1325
|
payload['queries'] = queries;
|
|
1255
1326
|
}
|
|
1256
|
-
|
|
1257
1327
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1258
|
-
|
|
1328
|
+
|
|
1329
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1259
1330
|
'content-type': 'application/json',
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1331
|
+
}
|
|
1262
1332
|
|
|
1333
|
+
return await this.client.call(
|
|
1334
|
+
'get',
|
|
1335
|
+
uri,
|
|
1336
|
+
apiHeaders,
|
|
1337
|
+
payload
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1263
1340
|
/**
|
|
1264
1341
|
* Create User Target
|
|
1265
1342
|
*
|
|
@@ -1272,82 +1349,83 @@ export class Users extends Service {
|
|
|
1272
1349
|
* @param {string} providerId
|
|
1273
1350
|
* @param {string} name
|
|
1274
1351
|
* @throws {AppwriteException}
|
|
1275
|
-
* @returns {Promise}
|
|
1276
|
-
|
|
1352
|
+
* @returns {Promise<Models.Target>}
|
|
1353
|
+
*/
|
|
1277
1354
|
async createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise<Models.Target> {
|
|
1278
1355
|
if (typeof userId === 'undefined') {
|
|
1279
1356
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1280
1357
|
}
|
|
1281
|
-
|
|
1282
1358
|
if (typeof targetId === 'undefined') {
|
|
1283
1359
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1284
1360
|
}
|
|
1285
|
-
|
|
1286
1361
|
if (typeof providerType === 'undefined') {
|
|
1287
1362
|
throw new AppwriteException('Missing required parameter: "providerType"');
|
|
1288
1363
|
}
|
|
1289
|
-
|
|
1290
1364
|
if (typeof identifier === 'undefined') {
|
|
1291
1365
|
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1292
1366
|
}
|
|
1293
|
-
|
|
1294
1367
|
const apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
|
|
1295
1368
|
const payload: Payload = {};
|
|
1296
|
-
|
|
1297
1369
|
if (typeof targetId !== 'undefined') {
|
|
1298
1370
|
payload['targetId'] = targetId;
|
|
1299
1371
|
}
|
|
1300
|
-
|
|
1301
1372
|
if (typeof providerType !== 'undefined') {
|
|
1302
1373
|
payload['providerType'] = providerType;
|
|
1303
1374
|
}
|
|
1304
|
-
|
|
1305
1375
|
if (typeof identifier !== 'undefined') {
|
|
1306
1376
|
payload['identifier'] = identifier;
|
|
1307
1377
|
}
|
|
1308
|
-
|
|
1309
1378
|
if (typeof providerId !== 'undefined') {
|
|
1310
1379
|
payload['providerId'] = providerId;
|
|
1311
1380
|
}
|
|
1312
|
-
|
|
1313
1381
|
if (typeof name !== 'undefined') {
|
|
1314
1382
|
payload['name'] = name;
|
|
1315
1383
|
}
|
|
1316
|
-
|
|
1317
1384
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1318
|
-
|
|
1385
|
+
|
|
1386
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1319
1387
|
'content-type': 'application/json',
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1388
|
+
}
|
|
1322
1389
|
|
|
1390
|
+
return await this.client.call(
|
|
1391
|
+
'post',
|
|
1392
|
+
uri,
|
|
1393
|
+
apiHeaders,
|
|
1394
|
+
payload
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1323
1397
|
/**
|
|
1324
1398
|
* Get User Target
|
|
1325
1399
|
*
|
|
1326
|
-
* Get a user
|
|
1400
|
+
* Get a user's push notification target by ID.
|
|
1327
1401
|
*
|
|
1328
1402
|
* @param {string} userId
|
|
1329
1403
|
* @param {string} targetId
|
|
1330
1404
|
* @throws {AppwriteException}
|
|
1331
|
-
* @returns {Promise}
|
|
1332
|
-
|
|
1405
|
+
* @returns {Promise<Models.Target>}
|
|
1406
|
+
*/
|
|
1333
1407
|
async getTarget(userId: string, targetId: string): Promise<Models.Target> {
|
|
1334
1408
|
if (typeof userId === 'undefined') {
|
|
1335
1409
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1336
1410
|
}
|
|
1337
|
-
|
|
1338
1411
|
if (typeof targetId === 'undefined') {
|
|
1339
1412
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1340
1413
|
}
|
|
1341
|
-
|
|
1342
1414
|
const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
|
|
1343
1415
|
const payload: Payload = {};
|
|
1344
|
-
|
|
1345
1416
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1346
|
-
|
|
1417
|
+
|
|
1418
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1347
1419
|
'content-type': 'application/json',
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1420
|
+
}
|
|
1350
1421
|
|
|
1422
|
+
return await this.client.call(
|
|
1423
|
+
'get',
|
|
1424
|
+
uri,
|
|
1425
|
+
apiHeaders,
|
|
1426
|
+
payload
|
|
1427
|
+
);
|
|
1428
|
+
}
|
|
1351
1429
|
/**
|
|
1352
1430
|
* Update User target
|
|
1353
1431
|
*
|
|
@@ -1359,38 +1437,39 @@ export class Users extends Service {
|
|
|
1359
1437
|
* @param {string} providerId
|
|
1360
1438
|
* @param {string} name
|
|
1361
1439
|
* @throws {AppwriteException}
|
|
1362
|
-
* @returns {Promise}
|
|
1363
|
-
|
|
1440
|
+
* @returns {Promise<Models.Target>}
|
|
1441
|
+
*/
|
|
1364
1442
|
async updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise<Models.Target> {
|
|
1365
1443
|
if (typeof userId === 'undefined') {
|
|
1366
1444
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1367
1445
|
}
|
|
1368
|
-
|
|
1369
1446
|
if (typeof targetId === 'undefined') {
|
|
1370
1447
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1371
1448
|
}
|
|
1372
|
-
|
|
1373
1449
|
const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
|
|
1374
1450
|
const payload: Payload = {};
|
|
1375
|
-
|
|
1376
1451
|
if (typeof identifier !== 'undefined') {
|
|
1377
1452
|
payload['identifier'] = identifier;
|
|
1378
1453
|
}
|
|
1379
|
-
|
|
1380
1454
|
if (typeof providerId !== 'undefined') {
|
|
1381
1455
|
payload['providerId'] = providerId;
|
|
1382
1456
|
}
|
|
1383
|
-
|
|
1384
1457
|
if (typeof name !== 'undefined') {
|
|
1385
1458
|
payload['name'] = name;
|
|
1386
1459
|
}
|
|
1387
|
-
|
|
1388
1460
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1389
|
-
|
|
1461
|
+
|
|
1462
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1390
1463
|
'content-type': 'application/json',
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1464
|
+
}
|
|
1393
1465
|
|
|
1466
|
+
return await this.client.call(
|
|
1467
|
+
'patch',
|
|
1468
|
+
uri,
|
|
1469
|
+
apiHeaders,
|
|
1470
|
+
payload
|
|
1471
|
+
);
|
|
1472
|
+
}
|
|
1394
1473
|
/**
|
|
1395
1474
|
* Delete user target
|
|
1396
1475
|
*
|
|
@@ -1399,63 +1478,67 @@ export class Users extends Service {
|
|
|
1399
1478
|
* @param {string} userId
|
|
1400
1479
|
* @param {string} targetId
|
|
1401
1480
|
* @throws {AppwriteException}
|
|
1402
|
-
* @returns {Promise}
|
|
1403
|
-
|
|
1481
|
+
* @returns {Promise<{}>}
|
|
1482
|
+
*/
|
|
1404
1483
|
async deleteTarget(userId: string, targetId: string): Promise<{}> {
|
|
1405
1484
|
if (typeof userId === 'undefined') {
|
|
1406
1485
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1407
1486
|
}
|
|
1408
|
-
|
|
1409
1487
|
if (typeof targetId === 'undefined') {
|
|
1410
1488
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1411
1489
|
}
|
|
1412
|
-
|
|
1413
1490
|
const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
|
|
1414
1491
|
const payload: Payload = {};
|
|
1415
|
-
|
|
1416
1492
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1417
|
-
|
|
1493
|
+
|
|
1494
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1418
1495
|
'content-type': 'application/json',
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1496
|
+
}
|
|
1421
1497
|
|
|
1498
|
+
return await this.client.call(
|
|
1499
|
+
'delete',
|
|
1500
|
+
uri,
|
|
1501
|
+
apiHeaders,
|
|
1502
|
+
payload
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1422
1505
|
/**
|
|
1423
1506
|
* Create token
|
|
1424
1507
|
*
|
|
1425
|
-
* Returns a token with a secret key for creating a session. Use the user ID
|
|
1426
|
-
|
|
1427
|
-
* /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1428
|
-
* endpoint to complete the login process.
|
|
1429
|
-
*
|
|
1508
|
+
* Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
|
|
1509
|
+
|
|
1430
1510
|
*
|
|
1431
1511
|
* @param {string} userId
|
|
1432
1512
|
* @param {number} length
|
|
1433
1513
|
* @param {number} expire
|
|
1434
1514
|
* @throws {AppwriteException}
|
|
1435
|
-
* @returns {Promise}
|
|
1436
|
-
|
|
1515
|
+
* @returns {Promise<Models.Token>}
|
|
1516
|
+
*/
|
|
1437
1517
|
async createToken(userId: string, length?: number, expire?: number): Promise<Models.Token> {
|
|
1438
1518
|
if (typeof userId === 'undefined') {
|
|
1439
1519
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1440
1520
|
}
|
|
1441
|
-
|
|
1442
1521
|
const apiPath = '/users/{userId}/tokens'.replace('{userId}', userId);
|
|
1443
1522
|
const payload: Payload = {};
|
|
1444
|
-
|
|
1445
1523
|
if (typeof length !== 'undefined') {
|
|
1446
1524
|
payload['length'] = length;
|
|
1447
1525
|
}
|
|
1448
|
-
|
|
1449
1526
|
if (typeof expire !== 'undefined') {
|
|
1450
1527
|
payload['expire'] = expire;
|
|
1451
1528
|
}
|
|
1452
|
-
|
|
1453
1529
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1454
|
-
|
|
1530
|
+
|
|
1531
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1455
1532
|
'content-type': 'application/json',
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1533
|
+
}
|
|
1458
1534
|
|
|
1535
|
+
return await this.client.call(
|
|
1536
|
+
'post',
|
|
1537
|
+
uri,
|
|
1538
|
+
apiHeaders,
|
|
1539
|
+
payload
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1459
1542
|
/**
|
|
1460
1543
|
* Update email verification
|
|
1461
1544
|
*
|
|
@@ -1464,30 +1547,33 @@ export class Users extends Service {
|
|
|
1464
1547
|
* @param {string} userId
|
|
1465
1548
|
* @param {boolean} emailVerification
|
|
1466
1549
|
* @throws {AppwriteException}
|
|
1467
|
-
* @returns {Promise}
|
|
1468
|
-
|
|
1550
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1551
|
+
*/
|
|
1469
1552
|
async updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>> {
|
|
1470
1553
|
if (typeof userId === 'undefined') {
|
|
1471
1554
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1472
1555
|
}
|
|
1473
|
-
|
|
1474
1556
|
if (typeof emailVerification === 'undefined') {
|
|
1475
1557
|
throw new AppwriteException('Missing required parameter: "emailVerification"');
|
|
1476
1558
|
}
|
|
1477
|
-
|
|
1478
1559
|
const apiPath = '/users/{userId}/verification'.replace('{userId}', userId);
|
|
1479
1560
|
const payload: Payload = {};
|
|
1480
|
-
|
|
1481
1561
|
if (typeof emailVerification !== 'undefined') {
|
|
1482
1562
|
payload['emailVerification'] = emailVerification;
|
|
1483
1563
|
}
|
|
1484
|
-
|
|
1485
1564
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1486
|
-
|
|
1565
|
+
|
|
1566
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1487
1567
|
'content-type': 'application/json',
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1568
|
+
}
|
|
1490
1569
|
|
|
1570
|
+
return await this.client.call(
|
|
1571
|
+
'patch',
|
|
1572
|
+
uri,
|
|
1573
|
+
apiHeaders,
|
|
1574
|
+
payload
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1491
1577
|
/**
|
|
1492
1578
|
* Update phone verification
|
|
1493
1579
|
*
|
|
@@ -1496,27 +1582,31 @@ export class Users extends Service {
|
|
|
1496
1582
|
* @param {string} userId
|
|
1497
1583
|
* @param {boolean} phoneVerification
|
|
1498
1584
|
* @throws {AppwriteException}
|
|
1499
|
-
* @returns {Promise}
|
|
1500
|
-
|
|
1585
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1586
|
+
*/
|
|
1501
1587
|
async updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>> {
|
|
1502
1588
|
if (typeof userId === 'undefined') {
|
|
1503
1589
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1504
1590
|
}
|
|
1505
|
-
|
|
1506
1591
|
if (typeof phoneVerification === 'undefined') {
|
|
1507
1592
|
throw new AppwriteException('Missing required parameter: "phoneVerification"');
|
|
1508
1593
|
}
|
|
1509
|
-
|
|
1510
1594
|
const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId);
|
|
1511
1595
|
const payload: Payload = {};
|
|
1512
|
-
|
|
1513
1596
|
if (typeof phoneVerification !== 'undefined') {
|
|
1514
1597
|
payload['phoneVerification'] = phoneVerification;
|
|
1515
1598
|
}
|
|
1516
|
-
|
|
1517
1599
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1518
|
-
|
|
1600
|
+
|
|
1601
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1519
1602
|
'content-type': 'application/json',
|
|
1520
|
-
}
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
return await this.client.call(
|
|
1606
|
+
'patch',
|
|
1607
|
+
uri,
|
|
1608
|
+
apiHeaders,
|
|
1609
|
+
payload
|
|
1610
|
+
);
|
|
1521
1611
|
}
|
|
1522
|
-
}
|
|
1612
|
+
}
|