node-appwrite 12.0.1 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client.d.mts +131 -0
- package/dist/client.d.ts +131 -0
- package/dist/client.js +302 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +296 -0
- package/dist/client.mjs.map +1 -0
- package/dist/enums/authentication-factor.d.mts +8 -0
- package/dist/enums/authentication-factor.d.ts +8 -0
- package/dist/enums/authentication-factor.js +13 -0
- package/dist/enums/authentication-factor.js.map +1 -0
- package/dist/enums/authentication-factor.mjs +12 -0
- package/dist/enums/authentication-factor.mjs.map +1 -0
- package/dist/enums/authenticator-type.d.mts +5 -0
- package/dist/enums/authenticator-type.d.ts +5 -0
- package/dist/enums/authenticator-type.js +10 -0
- package/dist/enums/authenticator-type.js.map +1 -0
- package/dist/enums/authenticator-type.mjs +9 -0
- package/dist/enums/authenticator-type.mjs.map +1 -0
- package/dist/enums/browser.d.mts +18 -0
- package/dist/enums/browser.d.ts +18 -0
- package/dist/enums/browser.js +23 -0
- package/dist/enums/browser.js.map +1 -0
- package/dist/enums/browser.mjs +22 -0
- package/dist/enums/browser.mjs.map +1 -0
- package/dist/enums/compression.d.mts +7 -0
- package/dist/enums/compression.d.ts +7 -0
- package/dist/enums/compression.js +12 -0
- package/dist/enums/compression.js.map +1 -0
- package/dist/enums/compression.mjs +11 -0
- package/dist/enums/compression.mjs.map +1 -0
- package/dist/enums/credit-card.d.mts +20 -0
- package/dist/enums/credit-card.d.ts +20 -0
- package/dist/enums/credit-card.js +25 -0
- package/dist/enums/credit-card.js.map +1 -0
- package/dist/enums/credit-card.mjs +24 -0
- package/dist/enums/credit-card.mjs.map +1 -0
- package/dist/enums/execution-method.d.mts +10 -0
- package/dist/enums/execution-method.d.ts +10 -0
- package/dist/enums/execution-method.js +15 -0
- package/dist/enums/execution-method.js.map +1 -0
- package/dist/enums/execution-method.mjs +14 -0
- package/dist/enums/execution-method.mjs.map +1 -0
- package/dist/enums/flag.d.mts +199 -0
- package/dist/enums/flag.d.ts +199 -0
- package/dist/enums/flag.js +204 -0
- package/dist/enums/flag.js.map +1 -0
- package/dist/enums/flag.mjs +203 -0
- package/dist/enums/flag.mjs.map +1 -0
- package/dist/enums/image-format.d.mts +9 -0
- package/dist/enums/image-format.d.ts +9 -0
- package/dist/enums/image-format.js +14 -0
- package/dist/enums/image-format.js.map +1 -0
- package/dist/enums/image-format.mjs +13 -0
- package/dist/enums/image-format.mjs.map +1 -0
- package/dist/enums/image-gravity.d.mts +13 -0
- package/dist/enums/image-gravity.d.ts +13 -0
- package/dist/enums/image-gravity.js +18 -0
- package/dist/enums/image-gravity.js.map +1 -0
- package/dist/enums/image-gravity.mjs +17 -0
- package/dist/enums/image-gravity.mjs.map +1 -0
- package/dist/enums/index-type.d.mts +7 -0
- package/dist/enums/index-type.d.ts +7 -0
- package/dist/enums/index-type.js +12 -0
- package/dist/enums/index-type.js.map +1 -0
- package/dist/enums/index-type.mjs +11 -0
- package/dist/enums/index-type.mjs.map +1 -0
- package/dist/enums/messaging-provider-type.d.mts +7 -0
- package/dist/enums/messaging-provider-type.d.ts +7 -0
- package/dist/enums/messaging-provider-type.js +12 -0
- package/dist/enums/messaging-provider-type.js.map +1 -0
- package/dist/enums/messaging-provider-type.mjs +11 -0
- package/dist/enums/messaging-provider-type.mjs.map +1 -0
- package/dist/enums/name.d.mts +16 -0
- package/dist/enums/name.d.ts +16 -0
- package/dist/enums/name.js +21 -0
- package/dist/enums/name.js.map +1 -0
- package/dist/enums/name.mjs +20 -0
- package/dist/enums/name.mjs.map +1 -0
- package/dist/enums/o-auth-provider.d.mts +43 -0
- package/dist/enums/o-auth-provider.d.ts +43 -0
- package/dist/enums/o-auth-provider.js +48 -0
- package/dist/enums/o-auth-provider.js.map +1 -0
- package/dist/enums/o-auth-provider.mjs +47 -0
- package/dist/enums/o-auth-provider.mjs.map +1 -0
- package/dist/enums/password-hash.d.mts +15 -0
- package/dist/enums/password-hash.d.ts +15 -0
- package/dist/enums/password-hash.js +20 -0
- package/dist/enums/password-hash.js.map +1 -0
- package/dist/enums/password-hash.mjs +19 -0
- package/dist/enums/password-hash.mjs.map +1 -0
- package/dist/enums/relation-mutate.d.mts +7 -0
- package/dist/enums/relation-mutate.d.ts +7 -0
- package/dist/enums/relation-mutate.js +12 -0
- package/dist/enums/relation-mutate.js.map +1 -0
- package/dist/enums/relation-mutate.mjs +11 -0
- package/dist/enums/relation-mutate.mjs.map +1 -0
- package/dist/enums/relationship-type.d.mts +8 -0
- package/dist/enums/relationship-type.d.ts +8 -0
- package/dist/enums/relationship-type.js +13 -0
- package/dist/enums/relationship-type.js.map +1 -0
- package/dist/enums/relationship-type.mjs +12 -0
- package/dist/enums/relationship-type.mjs.map +1 -0
- package/dist/enums/runtime.d.mts +49 -0
- package/dist/enums/runtime.d.ts +49 -0
- package/dist/enums/runtime.js +54 -0
- package/dist/enums/runtime.js.map +1 -0
- package/dist/enums/runtime.mjs +53 -0
- package/dist/enums/runtime.mjs.map +1 -0
- package/dist/enums/smtp-encryption.d.mts +7 -0
- package/dist/enums/smtp-encryption.d.ts +7 -0
- package/dist/enums/smtp-encryption.js +12 -0
- package/dist/enums/smtp-encryption.js.map +1 -0
- package/dist/enums/smtp-encryption.mjs +11 -0
- package/dist/enums/smtp-encryption.mjs.map +1 -0
- package/dist/id.d.mts +7 -0
- package/dist/id.d.ts +7 -0
- package/dist/id.js +29 -0
- package/dist/id.js.map +1 -0
- package/dist/id.mjs +28 -0
- package/dist/id.mjs.map +1 -0
- package/dist/index.d.mts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +180 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +35 -0
- package/dist/index.mjs.map +1 -0
- package/dist/inputFile.d.mts +9 -0
- package/dist/inputFile.d.ts +9 -0
- package/dist/inputFile.js +23 -0
- package/dist/inputFile.js.map +1 -0
- package/dist/inputFile.mjs +22 -0
- package/dist/inputFile.mjs.map +1 -0
- package/dist/models.d.mts +2414 -0
- package/dist/models.d.ts +2414 -0
- package/dist/models.js +4 -0
- package/dist/models.js.map +1 -0
- package/dist/models.mjs +3 -0
- package/dist/models.mjs.map +1 -0
- package/dist/permission.d.mts +9 -0
- package/dist/permission.d.ts +9 -0
- package/dist/permission.js +23 -0
- package/dist/permission.js.map +1 -0
- package/dist/permission.mjs +22 -0
- package/dist/permission.mjs.map +1 -0
- package/dist/query.d.mts +35 -0
- package/dist/query.d.ts +35 -0
- package/dist/query.js +49 -0
- package/dist/query.js.map +1 -0
- package/dist/query.mjs +48 -0
- package/dist/query.mjs.map +1 -0
- package/{lib/role.js → dist/role.d.mts} +18 -48
- package/dist/role.d.ts +72 -0
- package/dist/role.js +96 -0
- package/dist/role.js.map +1 -0
- package/dist/role.mjs +95 -0
- package/dist/role.mjs.map +1 -0
- package/dist/services/account.d.mts +478 -0
- package/dist/services/account.d.ts +478 -0
- package/dist/services/account.js +1331 -0
- package/dist/services/account.js.map +1 -0
- package/dist/services/account.mjs +1330 -0
- package/dist/services/account.mjs.map +1 -0
- package/dist/services/avatars.d.mts +118 -0
- package/dist/services/avatars.d.ts +118 -0
- package/dist/services/avatars.js +297 -0
- package/dist/services/avatars.js.map +1 -0
- package/dist/services/avatars.mjs +296 -0
- package/dist/services/avatars.mjs.map +1 -0
- package/dist/services/databases.d.mts +606 -0
- package/dist/services/databases.d.ts +606 -0
- package/dist/services/databases.js +1908 -0
- package/dist/services/databases.js.map +1 -0
- package/dist/services/databases.mjs +1907 -0
- package/dist/services/databases.mjs.map +1 -0
- package/dist/services/functions.d.mts +287 -0
- package/dist/services/functions.d.ts +287 -0
- package/dist/services/functions.js +837 -0
- package/dist/services/functions.js.map +1 -0
- package/dist/services/functions.mjs +836 -0
- package/dist/services/functions.mjs.map +1 -0
- package/dist/services/graphql.d.mts +30 -0
- package/dist/services/graphql.d.ts +30 -0
- package/dist/services/graphql.js +73 -0
- package/dist/services/graphql.js.map +1 -0
- package/dist/services/graphql.mjs +72 -0
- package/dist/services/graphql.mjs.map +1 -0
- package/dist/services/health.d.mts +235 -0
- package/dist/services/health.d.ts +235 -0
- package/dist/services/health.js +584 -0
- package/dist/services/health.js.map +1 -0
- package/dist/services/health.mjs +583 -0
- package/dist/services/health.mjs.map +1 -0
- package/dist/services/locale.d.mts +84 -0
- package/dist/services/locale.d.ts +84 -0
- package/dist/services/locale.js +189 -0
- package/dist/services/locale.js.map +1 -0
- package/dist/services/locale.mjs +188 -0
- package/dist/services/locale.mjs.map +1 -0
- package/dist/services/messaging.d.mts +689 -0
- package/dist/services/messaging.d.ts +689 -0
- package/dist/services/messaging.js +2156 -0
- package/dist/services/messaging.js.map +1 -0
- package/dist/services/messaging.mjs +2155 -0
- package/dist/services/messaging.mjs.map +1 -0
- package/dist/services/storage.d.mts +193 -0
- package/dist/services/storage.d.ts +193 -0
- package/dist/services/storage.js +550 -0
- package/dist/services/storage.js.map +1 -0
- package/dist/services/storage.mjs +549 -0
- package/dist/services/storage.mjs.map +1 -0
- package/dist/services/teams.d.mts +171 -0
- package/dist/services/teams.d.ts +171 -0
- package/dist/services/teams.js +466 -0
- package/dist/services/teams.js.map +1 -0
- package/dist/services/teams.mjs +465 -0
- package/dist/services/teams.mjs.map +1 -0
- package/dist/services/users.d.mts +491 -0
- package/dist/services/users.d.ts +491 -0
- package/dist/services/users.js +1465 -0
- package/dist/services/users.js.map +1 -0
- package/dist/services/users.mjs +1464 -0
- package/dist/services/users.mjs.map +1 -0
- package/package.json +39 -5
- package/.github/ISSUE_TEMPLATE/bug.yaml +0 -82
- package/.github/ISSUE_TEMPLATE/documentation.yaml +0 -32
- package/.github/ISSUE_TEMPLATE/feature.yaml +0 -40
- package/.travis.yml +0 -25
- package/CHANGELOG.md +0 -1
- package/docs/examples/account/create-anonymous-session.md +0 -9
- package/docs/examples/account/create-email-password-session.md +0 -12
- package/docs/examples/account/create-email-token.md +0 -13
- package/docs/examples/account/create-j-w-t.md +0 -9
- package/docs/examples/account/create-magic-u-r-l-token.md +0 -14
- package/docs/examples/account/create-mfa-authenticator.md +0 -12
- package/docs/examples/account/create-mfa-challenge.md +0 -11
- package/docs/examples/account/create-mfa-recovery-codes.md +0 -10
- package/docs/examples/account/create-o-auth2token.md +0 -14
- package/docs/examples/account/create-phone-token.md +0 -12
- package/docs/examples/account/create-phone-verification.md +0 -10
- package/docs/examples/account/create-recovery.md +0 -13
- package/docs/examples/account/create-session.md +0 -12
- package/docs/examples/account/create-verification.md +0 -12
- package/docs/examples/account/create.md +0 -14
- package/docs/examples/account/delete-identity.md +0 -12
- package/docs/examples/account/delete-mfa-authenticator.md +0 -13
- package/docs/examples/account/delete-session.md +0 -12
- package/docs/examples/account/delete-sessions.md +0 -10
- package/docs/examples/account/get-mfa-recovery-codes.md +0 -10
- package/docs/examples/account/get-prefs.md +0 -10
- package/docs/examples/account/get-session.md +0 -12
- package/docs/examples/account/get.md +0 -10
- package/docs/examples/account/list-identities.md +0 -12
- package/docs/examples/account/list-logs.md +0 -12
- package/docs/examples/account/list-mfa-factors.md +0 -10
- package/docs/examples/account/list-sessions.md +0 -10
- package/docs/examples/account/update-email.md +0 -13
- package/docs/examples/account/update-m-f-a.md +0 -12
- package/docs/examples/account/update-magic-u-r-l-session.md +0 -12
- package/docs/examples/account/update-mfa-authenticator.md +0 -13
- package/docs/examples/account/update-mfa-challenge.md +0 -13
- package/docs/examples/account/update-mfa-recovery-codes.md +0 -10
- package/docs/examples/account/update-name.md +0 -12
- package/docs/examples/account/update-password.md +0 -13
- package/docs/examples/account/update-phone-session.md +0 -12
- package/docs/examples/account/update-phone-verification.md +0 -13
- package/docs/examples/account/update-phone.md +0 -13
- package/docs/examples/account/update-prefs.md +0 -12
- package/docs/examples/account/update-recovery.md +0 -14
- package/docs/examples/account/update-session.md +0 -12
- package/docs/examples/account/update-status.md +0 -10
- package/docs/examples/account/update-verification.md +0 -13
- package/docs/examples/avatars/get-browser.md +0 -15
- package/docs/examples/avatars/get-credit-card.md +0 -15
- package/docs/examples/avatars/get-favicon.md +0 -12
- package/docs/examples/avatars/get-flag.md +0 -15
- package/docs/examples/avatars/get-image.md +0 -14
- package/docs/examples/avatars/get-initials.md +0 -15
- package/docs/examples/avatars/get-q-r.md +0 -15
- package/docs/examples/databases/create-boolean-attribute.md +0 -17
- package/docs/examples/databases/create-collection.md +0 -17
- package/docs/examples/databases/create-datetime-attribute.md +0 -17
- package/docs/examples/databases/create-document.md +0 -16
- package/docs/examples/databases/create-email-attribute.md +0 -17
- package/docs/examples/databases/create-enum-attribute.md +0 -18
- package/docs/examples/databases/create-float-attribute.md +0 -19
- package/docs/examples/databases/create-index.md +0 -17
- package/docs/examples/databases/create-integer-attribute.md +0 -19
- package/docs/examples/databases/create-ip-attribute.md +0 -17
- package/docs/examples/databases/create-relationship-attribute.md +0 -19
- package/docs/examples/databases/create-string-attribute.md +0 -19
- package/docs/examples/databases/create-url-attribute.md +0 -17
- package/docs/examples/databases/create.md +0 -14
- package/docs/examples/databases/delete-attribute.md +0 -14
- package/docs/examples/databases/delete-collection.md +0 -13
- package/docs/examples/databases/delete-document.md +0 -14
- package/docs/examples/databases/delete-index.md +0 -14
- package/docs/examples/databases/delete.md +0 -12
- package/docs/examples/databases/get-attribute.md +0 -14
- package/docs/examples/databases/get-collection.md +0 -13
- package/docs/examples/databases/get-document.md +0 -15
- package/docs/examples/databases/get-index.md +0 -14
- package/docs/examples/databases/get.md +0 -12
- package/docs/examples/databases/list-attributes.md +0 -14
- package/docs/examples/databases/list-collections.md +0 -14
- package/docs/examples/databases/list-documents.md +0 -14
- package/docs/examples/databases/list-indexes.md +0 -14
- package/docs/examples/databases/list.md +0 -13
- package/docs/examples/databases/update-boolean-attribute.md +0 -16
- package/docs/examples/databases/update-collection.md +0 -17
- package/docs/examples/databases/update-datetime-attribute.md +0 -16
- package/docs/examples/databases/update-document.md +0 -16
- package/docs/examples/databases/update-email-attribute.md +0 -16
- package/docs/examples/databases/update-enum-attribute.md +0 -17
- package/docs/examples/databases/update-float-attribute.md +0 -18
- package/docs/examples/databases/update-integer-attribute.md +0 -18
- package/docs/examples/databases/update-ip-attribute.md +0 -16
- package/docs/examples/databases/update-relationship-attribute.md +0 -15
- package/docs/examples/databases/update-string-attribute.md +0 -16
- package/docs/examples/databases/update-url-attribute.md +0 -16
- package/docs/examples/databases/update.md +0 -14
- package/docs/examples/functions/create-build.md +0 -14
- package/docs/examples/functions/create-deployment.md +0 -17
- package/docs/examples/functions/create-execution.md +0 -17
- package/docs/examples/functions/create-variable.md +0 -14
- package/docs/examples/functions/create.md +0 -31
- package/docs/examples/functions/delete-deployment.md +0 -13
- package/docs/examples/functions/delete-variable.md +0 -13
- package/docs/examples/functions/delete.md +0 -12
- package/docs/examples/functions/download-deployment.md +0 -13
- package/docs/examples/functions/get-deployment.md +0 -13
- package/docs/examples/functions/get-execution.md +0 -13
- package/docs/examples/functions/get-variable.md +0 -13
- package/docs/examples/functions/get.md +0 -12
- package/docs/examples/functions/list-deployments.md +0 -14
- package/docs/examples/functions/list-executions.md +0 -14
- package/docs/examples/functions/list-runtimes.md +0 -10
- package/docs/examples/functions/list-variables.md +0 -12
- package/docs/examples/functions/list.md +0 -13
- package/docs/examples/functions/update-deployment.md +0 -13
- package/docs/examples/functions/update-variable.md +0 -15
- package/docs/examples/functions/update.md +0 -27
- package/docs/examples/graphql/mutation.md +0 -12
- package/docs/examples/graphql/query.md +0 -12
- package/docs/examples/health/get-antivirus.md +0 -10
- package/docs/examples/health/get-cache.md +0 -10
- package/docs/examples/health/get-certificate.md +0 -12
- package/docs/examples/health/get-d-b.md +0 -10
- package/docs/examples/health/get-failed-jobs.md +0 -13
- package/docs/examples/health/get-pub-sub.md +0 -10
- package/docs/examples/health/get-queue-builds.md +0 -12
- package/docs/examples/health/get-queue-certificates.md +0 -12
- package/docs/examples/health/get-queue-databases.md +0 -13
- package/docs/examples/health/get-queue-deletes.md +0 -12
- package/docs/examples/health/get-queue-functions.md +0 -12
- package/docs/examples/health/get-queue-logs.md +0 -12
- package/docs/examples/health/get-queue-mails.md +0 -12
- package/docs/examples/health/get-queue-messaging.md +0 -12
- package/docs/examples/health/get-queue-migrations.md +0 -12
- package/docs/examples/health/get-queue-usage-dump.md +0 -12
- package/docs/examples/health/get-queue-usage.md +0 -12
- package/docs/examples/health/get-queue-webhooks.md +0 -12
- package/docs/examples/health/get-queue.md +0 -10
- package/docs/examples/health/get-storage-local.md +0 -10
- package/docs/examples/health/get-storage.md +0 -10
- package/docs/examples/health/get-time.md +0 -10
- package/docs/examples/health/get.md +0 -10
- package/docs/examples/locale/get.md +0 -10
- package/docs/examples/locale/list-codes.md +0 -10
- package/docs/examples/locale/list-continents.md +0 -10
- package/docs/examples/locale/list-countries-e-u.md +0 -10
- package/docs/examples/locale/list-countries-phones.md +0 -10
- package/docs/examples/locale/list-countries.md +0 -10
- package/docs/examples/locale/list-currencies.md +0 -10
- package/docs/examples/locale/list-languages.md +0 -10
- package/docs/examples/messaging/create-apns-provider.md +0 -19
- package/docs/examples/messaging/create-email.md +0 -23
- package/docs/examples/messaging/create-fcm-provider.md +0 -15
- package/docs/examples/messaging/create-mailgun-provider.md +0 -21
- package/docs/examples/messaging/create-msg91provider.md +0 -17
- package/docs/examples/messaging/create-push.md +0 -27
- package/docs/examples/messaging/create-sendgrid-provider.md +0 -19
- package/docs/examples/messaging/create-sms.md +0 -18
- package/docs/examples/messaging/create-smtp-provider.md +0 -25
- package/docs/examples/messaging/create-subscriber.md +0 -14
- package/docs/examples/messaging/create-telesign-provider.md +0 -17
- package/docs/examples/messaging/create-textmagic-provider.md +0 -17
- package/docs/examples/messaging/create-topic.md +0 -14
- package/docs/examples/messaging/create-twilio-provider.md +0 -17
- package/docs/examples/messaging/create-vonage-provider.md +0 -17
- package/docs/examples/messaging/delete-provider.md +0 -12
- package/docs/examples/messaging/delete-subscriber.md +0 -13
- package/docs/examples/messaging/delete-topic.md +0 -12
- package/docs/examples/messaging/delete.md +0 -12
- package/docs/examples/messaging/get-message.md +0 -12
- package/docs/examples/messaging/get-provider.md +0 -12
- package/docs/examples/messaging/get-subscriber.md +0 -13
- package/docs/examples/messaging/get-topic.md +0 -12
- package/docs/examples/messaging/list-message-logs.md +0 -13
- package/docs/examples/messaging/list-messages.md +0 -13
- package/docs/examples/messaging/list-provider-logs.md +0 -13
- package/docs/examples/messaging/list-providers.md +0 -13
- package/docs/examples/messaging/list-subscriber-logs.md +0 -13
- package/docs/examples/messaging/list-subscribers.md +0 -14
- package/docs/examples/messaging/list-targets.md +0 -13
- package/docs/examples/messaging/list-topic-logs.md +0 -13
- package/docs/examples/messaging/list-topics.md +0 -13
- package/docs/examples/messaging/update-apns-provider.md +0 -19
- package/docs/examples/messaging/update-email.md +0 -22
- package/docs/examples/messaging/update-fcm-provider.md +0 -15
- package/docs/examples/messaging/update-mailgun-provider.md +0 -21
- package/docs/examples/messaging/update-msg91provider.md +0 -17
- package/docs/examples/messaging/update-push.md +0 -27
- package/docs/examples/messaging/update-sendgrid-provider.md +0 -19
- package/docs/examples/messaging/update-sms.md +0 -18
- package/docs/examples/messaging/update-smtp-provider.md +0 -25
- package/docs/examples/messaging/update-telesign-provider.md +0 -17
- package/docs/examples/messaging/update-textmagic-provider.md +0 -17
- package/docs/examples/messaging/update-topic.md +0 -14
- package/docs/examples/messaging/update-twilio-provider.md +0 -17
- package/docs/examples/messaging/update-vonage-provider.md +0 -17
- package/docs/examples/storage/create-bucket.md +0 -21
- package/docs/examples/storage/create-file.md +0 -16
- package/docs/examples/storage/delete-bucket.md +0 -12
- package/docs/examples/storage/delete-file.md +0 -13
- package/docs/examples/storage/get-bucket.md +0 -12
- package/docs/examples/storage/get-file-download.md +0 -13
- package/docs/examples/storage/get-file-preview.md +0 -24
- package/docs/examples/storage/get-file-view.md +0 -13
- package/docs/examples/storage/get-file.md +0 -13
- package/docs/examples/storage/list-buckets.md +0 -13
- package/docs/examples/storage/list-files.md +0 -14
- package/docs/examples/storage/update-bucket.md +0 -21
- package/docs/examples/storage/update-file.md +0 -15
- package/docs/examples/teams/create-membership.md +0 -18
- package/docs/examples/teams/create.md +0 -14
- package/docs/examples/teams/delete-membership.md +0 -13
- package/docs/examples/teams/delete.md +0 -12
- package/docs/examples/teams/get-membership.md +0 -13
- package/docs/examples/teams/get-prefs.md +0 -12
- package/docs/examples/teams/get.md +0 -12
- package/docs/examples/teams/list-memberships.md +0 -14
- package/docs/examples/teams/list.md +0 -13
- package/docs/examples/teams/update-membership-status.md +0 -15
- package/docs/examples/teams/update-membership.md +0 -14
- package/docs/examples/teams/update-name.md +0 -13
- package/docs/examples/teams/update-prefs.md +0 -13
- package/docs/examples/users/create-argon2user.md +0 -15
- package/docs/examples/users/create-bcrypt-user.md +0 -15
- package/docs/examples/users/create-m-d5user.md +0 -15
- package/docs/examples/users/create-mfa-recovery-codes.md +0 -12
- package/docs/examples/users/create-p-h-pass-user.md +0 -15
- package/docs/examples/users/create-s-h-a-user.md +0 -16
- package/docs/examples/users/create-scrypt-modified-user.md +0 -18
- package/docs/examples/users/create-scrypt-user.md +0 -20
- package/docs/examples/users/create-session.md +0 -12
- package/docs/examples/users/create-target.md +0 -17
- package/docs/examples/users/create-token.md +0 -14
- package/docs/examples/users/create.md +0 -16
- package/docs/examples/users/delete-identity.md +0 -12
- package/docs/examples/users/delete-mfa-authenticator.md +0 -13
- package/docs/examples/users/delete-session.md +0 -13
- package/docs/examples/users/delete-sessions.md +0 -12
- package/docs/examples/users/delete-target.md +0 -13
- package/docs/examples/users/delete.md +0 -12
- package/docs/examples/users/get-mfa-recovery-codes.md +0 -12
- package/docs/examples/users/get-prefs.md +0 -12
- package/docs/examples/users/get-target.md +0 -13
- package/docs/examples/users/get.md +0 -12
- package/docs/examples/users/list-identities.md +0 -13
- package/docs/examples/users/list-logs.md +0 -13
- package/docs/examples/users/list-memberships.md +0 -12
- package/docs/examples/users/list-mfa-factors.md +0 -12
- package/docs/examples/users/list-sessions.md +0 -12
- package/docs/examples/users/list-targets.md +0 -13
- package/docs/examples/users/list.md +0 -13
- package/docs/examples/users/update-email-verification.md +0 -13
- package/docs/examples/users/update-email.md +0 -13
- package/docs/examples/users/update-labels.md +0 -13
- package/docs/examples/users/update-mfa-recovery-codes.md +0 -12
- package/docs/examples/users/update-mfa.md +0 -13
- package/docs/examples/users/update-name.md +0 -13
- package/docs/examples/users/update-password.md +0 -13
- package/docs/examples/users/update-phone-verification.md +0 -13
- package/docs/examples/users/update-phone.md +0 -13
- package/docs/examples/users/update-prefs.md +0 -13
- package/docs/examples/users/update-status.md +0 -13
- package/docs/examples/users/update-target.md +0 -16
- package/index.d.ts +0 -6656
- package/index.js +0 -75
- package/lib/client.js +0 -245
- package/lib/enums/authentication-factor.js +0 -8
- package/lib/enums/authenticator-type.js +0 -5
- package/lib/enums/browser.js +0 -18
- package/lib/enums/compression.js +0 -7
- package/lib/enums/credit-card.js +0 -20
- package/lib/enums/execution-method.js +0 -10
- package/lib/enums/flag.js +0 -198
- package/lib/enums/image-format.js +0 -9
- package/lib/enums/image-gravity.js +0 -13
- package/lib/enums/index-type.js +0 -7
- package/lib/enums/messaging-provider-type.js +0 -7
- package/lib/enums/name.js +0 -17
- package/lib/enums/o-auth-provider.js +0 -43
- package/lib/enums/password-hash.js +0 -15
- package/lib/enums/relation-mutate.js +0 -7
- package/lib/enums/relationship-type.js +0 -8
- package/lib/enums/runtime.js +0 -48
- package/lib/enums/smtp-encryption.js +0 -7
- package/lib/exception.js +0 -10
- package/lib/id.js +0 -32
- package/lib/inputFile.js +0 -117
- package/lib/permission.js +0 -24
- package/lib/query.js +0 -90
- package/lib/service.js +0 -10
- package/lib/services/account.js +0 -1365
- package/lib/services/avatars.js +0 -325
- package/lib/services/databases.js +0 -1987
- package/lib/services/functions.js +0 -930
- package/lib/services/graphql.js +0 -74
- package/lib/services/health.js +0 -513
- package/lib/services/locale.js +0 -169
- package/lib/services/messaging.js +0 -2218
- package/lib/services/storage.js +0 -663
- package/lib/services/teams.js +0 -479
- package/lib/services/users.js +0 -1463
package/lib/services/account.js
DELETED
|
@@ -1,1365 +0,0 @@
|
|
|
1
|
-
const Service = require('../service.js');
|
|
2
|
-
const AppwriteException = require('../exception.js');
|
|
3
|
-
const InputFile = require('../inputFile.js');
|
|
4
|
-
const client = require('../client.js');
|
|
5
|
-
const Stream = require('stream');
|
|
6
|
-
const { promisify } = require('util');
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const { File } = require('undici');
|
|
9
|
-
const Query = require('../query.js');
|
|
10
|
-
|
|
11
|
-
class Account extends Service {
|
|
12
|
-
|
|
13
|
-
constructor(client)
|
|
14
|
-
{
|
|
15
|
-
super(client);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Get account
|
|
21
|
-
*
|
|
22
|
-
* Get the currently logged in user.
|
|
23
|
-
*
|
|
24
|
-
* @throws {AppwriteException}
|
|
25
|
-
* @returns {Promise}
|
|
26
|
-
*/
|
|
27
|
-
async get() {
|
|
28
|
-
const apiPath = '/account';
|
|
29
|
-
let payload = {};
|
|
30
|
-
|
|
31
|
-
return await this.client.call('get', apiPath, {
|
|
32
|
-
'content-type': 'application/json',
|
|
33
|
-
}, payload);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create account
|
|
38
|
-
*
|
|
39
|
-
* Use this endpoint to allow a new user to register a new account in your
|
|
40
|
-
* project. After the user registration completes successfully, you can use
|
|
41
|
-
* the
|
|
42
|
-
* [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
|
|
43
|
-
* route to start verifying the user email address. To allow the new user to
|
|
44
|
-
* login to their new account, you need to create a new [account
|
|
45
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
46
|
-
*
|
|
47
|
-
* @param {string} userId
|
|
48
|
-
* @param {string} email
|
|
49
|
-
* @param {string} password
|
|
50
|
-
* @param {string} name
|
|
51
|
-
* @throws {AppwriteException}
|
|
52
|
-
* @returns {Promise}
|
|
53
|
-
*/
|
|
54
|
-
async create(userId, email, password, name) {
|
|
55
|
-
const apiPath = '/account';
|
|
56
|
-
let payload = {};
|
|
57
|
-
if (typeof userId === 'undefined') {
|
|
58
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (typeof email === 'undefined') {
|
|
62
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (typeof password === 'undefined') {
|
|
66
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (typeof userId !== 'undefined') {
|
|
71
|
-
payload['userId'] = userId;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (typeof email !== 'undefined') {
|
|
75
|
-
payload['email'] = email;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (typeof password !== 'undefined') {
|
|
79
|
-
payload['password'] = password;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (typeof name !== 'undefined') {
|
|
83
|
-
payload['name'] = name;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return await this.client.call('post', apiPath, {
|
|
87
|
-
'content-type': 'application/json',
|
|
88
|
-
}, payload);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Update email
|
|
93
|
-
*
|
|
94
|
-
* Update currently logged in user account email address. After changing user
|
|
95
|
-
* address, the user confirmation status will get reset. A new confirmation
|
|
96
|
-
* email is not sent automatically however you can use the send confirmation
|
|
97
|
-
* email endpoint again to send the confirmation email. For security measures,
|
|
98
|
-
* user password is required to complete this request.
|
|
99
|
-
* This endpoint can also be used to convert an anonymous account to a normal
|
|
100
|
-
* one, by passing an email address and a new password.
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* @param {string} email
|
|
104
|
-
* @param {string} password
|
|
105
|
-
* @throws {AppwriteException}
|
|
106
|
-
* @returns {Promise}
|
|
107
|
-
*/
|
|
108
|
-
async updateEmail(email, password) {
|
|
109
|
-
const apiPath = '/account/email';
|
|
110
|
-
let payload = {};
|
|
111
|
-
if (typeof email === 'undefined') {
|
|
112
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (typeof password === 'undefined') {
|
|
116
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (typeof email !== 'undefined') {
|
|
121
|
-
payload['email'] = email;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (typeof password !== 'undefined') {
|
|
125
|
-
payload['password'] = password;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return await this.client.call('patch', apiPath, {
|
|
129
|
-
'content-type': 'application/json',
|
|
130
|
-
}, payload);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* List Identities
|
|
135
|
-
*
|
|
136
|
-
* Get the list of identities for the currently logged in user.
|
|
137
|
-
*
|
|
138
|
-
* @param {string[]} queries
|
|
139
|
-
* @throws {AppwriteException}
|
|
140
|
-
* @returns {Promise}
|
|
141
|
-
*/
|
|
142
|
-
async listIdentities(queries) {
|
|
143
|
-
const apiPath = '/account/identities';
|
|
144
|
-
let payload = {};
|
|
145
|
-
|
|
146
|
-
if (typeof queries !== 'undefined') {
|
|
147
|
-
payload['queries'] = queries;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return await this.client.call('get', apiPath, {
|
|
151
|
-
'content-type': 'application/json',
|
|
152
|
-
}, payload);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Delete identity
|
|
157
|
-
*
|
|
158
|
-
* Delete an identity by its unique ID.
|
|
159
|
-
*
|
|
160
|
-
* @param {string} identityId
|
|
161
|
-
* @throws {AppwriteException}
|
|
162
|
-
* @returns {Promise}
|
|
163
|
-
*/
|
|
164
|
-
async deleteIdentity(identityId) {
|
|
165
|
-
const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
|
|
166
|
-
let payload = {};
|
|
167
|
-
if (typeof identityId === 'undefined') {
|
|
168
|
-
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return await this.client.call('delete', apiPath, {
|
|
173
|
-
'content-type': 'application/json',
|
|
174
|
-
}, payload);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Create JWT
|
|
179
|
-
*
|
|
180
|
-
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT
|
|
181
|
-
* to authenticate on behalf of the current user when working with the
|
|
182
|
-
* Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
|
|
183
|
-
* from its creation and will be invalid if the user will logout in that time
|
|
184
|
-
* frame.
|
|
185
|
-
*
|
|
186
|
-
* @throws {AppwriteException}
|
|
187
|
-
* @returns {Promise}
|
|
188
|
-
*/
|
|
189
|
-
async createJWT() {
|
|
190
|
-
const apiPath = '/account/jwt';
|
|
191
|
-
let payload = {};
|
|
192
|
-
|
|
193
|
-
return await this.client.call('post', apiPath, {
|
|
194
|
-
'content-type': 'application/json',
|
|
195
|
-
}, payload);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* List logs
|
|
200
|
-
*
|
|
201
|
-
* Get the list of latest security activity logs for the currently logged in
|
|
202
|
-
* user. Each log returns user IP address, location and date and time of log.
|
|
203
|
-
*
|
|
204
|
-
* @param {string[]} queries
|
|
205
|
-
* @throws {AppwriteException}
|
|
206
|
-
* @returns {Promise}
|
|
207
|
-
*/
|
|
208
|
-
async listLogs(queries) {
|
|
209
|
-
const apiPath = '/account/logs';
|
|
210
|
-
let payload = {};
|
|
211
|
-
|
|
212
|
-
if (typeof queries !== 'undefined') {
|
|
213
|
-
payload['queries'] = queries;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return await this.client.call('get', apiPath, {
|
|
217
|
-
'content-type': 'application/json',
|
|
218
|
-
}, payload);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Update MFA
|
|
223
|
-
*
|
|
224
|
-
* Enable or disable MFA on an account.
|
|
225
|
-
*
|
|
226
|
-
* @param {boolean} mfa
|
|
227
|
-
* @throws {AppwriteException}
|
|
228
|
-
* @returns {Promise}
|
|
229
|
-
*/
|
|
230
|
-
async updateMFA(mfa) {
|
|
231
|
-
const apiPath = '/account/mfa';
|
|
232
|
-
let payload = {};
|
|
233
|
-
if (typeof mfa === 'undefined') {
|
|
234
|
-
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (typeof mfa !== 'undefined') {
|
|
239
|
-
payload['mfa'] = mfa;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return await this.client.call('patch', apiPath, {
|
|
243
|
-
'content-type': 'application/json',
|
|
244
|
-
}, payload);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Add Authenticator
|
|
249
|
-
*
|
|
250
|
-
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
251
|
-
* authenticator using the [verify
|
|
252
|
-
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
|
|
253
|
-
* method.
|
|
254
|
-
*
|
|
255
|
-
* @param {AuthenticatorType} type
|
|
256
|
-
* @throws {AppwriteException}
|
|
257
|
-
* @returns {Promise}
|
|
258
|
-
*/
|
|
259
|
-
async createMfaAuthenticator(type) {
|
|
260
|
-
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
261
|
-
let payload = {};
|
|
262
|
-
if (typeof type === 'undefined') {
|
|
263
|
-
throw new AppwriteException('Missing required parameter: "type"');
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return await this.client.call('post', apiPath, {
|
|
268
|
-
'content-type': 'application/json',
|
|
269
|
-
}, payload);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Verify Authenticator
|
|
274
|
-
*
|
|
275
|
-
* Verify an authenticator app after adding it using the [add
|
|
276
|
-
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
|
|
277
|
-
* method.
|
|
278
|
-
*
|
|
279
|
-
* @param {AuthenticatorType} type
|
|
280
|
-
* @param {string} otp
|
|
281
|
-
* @throws {AppwriteException}
|
|
282
|
-
* @returns {Promise}
|
|
283
|
-
*/
|
|
284
|
-
async updateMfaAuthenticator(type, otp) {
|
|
285
|
-
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
286
|
-
let payload = {};
|
|
287
|
-
if (typeof type === 'undefined') {
|
|
288
|
-
throw new AppwriteException('Missing required parameter: "type"');
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (typeof otp === 'undefined') {
|
|
292
|
-
throw new AppwriteException('Missing required parameter: "otp"');
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (typeof otp !== 'undefined') {
|
|
297
|
-
payload['otp'] = otp;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return await this.client.call('put', apiPath, {
|
|
301
|
-
'content-type': 'application/json',
|
|
302
|
-
}, payload);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Delete Authenticator
|
|
307
|
-
*
|
|
308
|
-
* Delete an authenticator for a user by ID.
|
|
309
|
-
*
|
|
310
|
-
* @param {AuthenticatorType} type
|
|
311
|
-
* @param {string} otp
|
|
312
|
-
* @throws {AppwriteException}
|
|
313
|
-
* @returns {Promise}
|
|
314
|
-
*/
|
|
315
|
-
async deleteMfaAuthenticator(type, otp) {
|
|
316
|
-
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
317
|
-
let payload = {};
|
|
318
|
-
if (typeof type === 'undefined') {
|
|
319
|
-
throw new AppwriteException('Missing required parameter: "type"');
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (typeof otp === 'undefined') {
|
|
323
|
-
throw new AppwriteException('Missing required parameter: "otp"');
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (typeof otp !== 'undefined') {
|
|
328
|
-
payload['otp'] = otp;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return await this.client.call('delete', apiPath, {
|
|
332
|
-
'content-type': 'application/json',
|
|
333
|
-
}, payload);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Create 2FA Challenge
|
|
338
|
-
*
|
|
339
|
-
* Begin the process of MFA verification after sign-in. Finish the flow with
|
|
340
|
-
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
|
|
341
|
-
* method.
|
|
342
|
-
*
|
|
343
|
-
* @param {AuthenticationFactor} factor
|
|
344
|
-
* @throws {AppwriteException}
|
|
345
|
-
* @returns {Promise}
|
|
346
|
-
*/
|
|
347
|
-
async createMfaChallenge(factor) {
|
|
348
|
-
const apiPath = '/account/mfa/challenge';
|
|
349
|
-
let payload = {};
|
|
350
|
-
if (typeof factor === 'undefined') {
|
|
351
|
-
throw new AppwriteException('Missing required parameter: "factor"');
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (typeof factor !== 'undefined') {
|
|
356
|
-
payload['factor'] = factor;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return await this.client.call('post', apiPath, {
|
|
360
|
-
'content-type': 'application/json',
|
|
361
|
-
}, payload);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Create MFA Challenge (confirmation)
|
|
366
|
-
*
|
|
367
|
-
* Complete the MFA challenge by providing the one-time password. Finish the
|
|
368
|
-
* process of MFA verification by providing the one-time password. To begin
|
|
369
|
-
* the flow, use
|
|
370
|
-
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
371
|
-
* method.
|
|
372
|
-
*
|
|
373
|
-
* @param {string} challengeId
|
|
374
|
-
* @param {string} otp
|
|
375
|
-
* @throws {AppwriteException}
|
|
376
|
-
* @returns {Promise}
|
|
377
|
-
*/
|
|
378
|
-
async updateMfaChallenge(challengeId, otp) {
|
|
379
|
-
const apiPath = '/account/mfa/challenge';
|
|
380
|
-
let payload = {};
|
|
381
|
-
if (typeof challengeId === 'undefined') {
|
|
382
|
-
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (typeof otp === 'undefined') {
|
|
386
|
-
throw new AppwriteException('Missing required parameter: "otp"');
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
if (typeof challengeId !== 'undefined') {
|
|
391
|
-
payload['challengeId'] = challengeId;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (typeof otp !== 'undefined') {
|
|
395
|
-
payload['otp'] = otp;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
return await this.client.call('put', apiPath, {
|
|
399
|
-
'content-type': 'application/json',
|
|
400
|
-
}, payload);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* List Factors
|
|
405
|
-
*
|
|
406
|
-
* List the factors available on the account to be used as a MFA challange.
|
|
407
|
-
*
|
|
408
|
-
* @throws {AppwriteException}
|
|
409
|
-
* @returns {Promise}
|
|
410
|
-
*/
|
|
411
|
-
async listMfaFactors() {
|
|
412
|
-
const apiPath = '/account/mfa/factors';
|
|
413
|
-
let payload = {};
|
|
414
|
-
|
|
415
|
-
return await this.client.call('get', apiPath, {
|
|
416
|
-
'content-type': 'application/json',
|
|
417
|
-
}, payload);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Get MFA Recovery Codes
|
|
422
|
-
*
|
|
423
|
-
* Get recovery codes that can be used as backup for MFA flow. Before getting
|
|
424
|
-
* codes, they must be generated using
|
|
425
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
426
|
-
* method. An OTP challenge is required to read recovery codes.
|
|
427
|
-
*
|
|
428
|
-
* @throws {AppwriteException}
|
|
429
|
-
* @returns {Promise}
|
|
430
|
-
*/
|
|
431
|
-
async getMfaRecoveryCodes() {
|
|
432
|
-
const apiPath = '/account/mfa/recovery-codes';
|
|
433
|
-
let payload = {};
|
|
434
|
-
|
|
435
|
-
return await this.client.call('get', apiPath, {
|
|
436
|
-
'content-type': 'application/json',
|
|
437
|
-
}, payload);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Create MFA Recovery Codes
|
|
442
|
-
*
|
|
443
|
-
* Generate recovery codes as backup for MFA flow. It's recommended to
|
|
444
|
-
* generate and show then immediately after user successfully adds their
|
|
445
|
-
* authehticator. Recovery codes can be used as a MFA verification type in
|
|
446
|
-
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
447
|
-
* method.
|
|
448
|
-
*
|
|
449
|
-
* @throws {AppwriteException}
|
|
450
|
-
* @returns {Promise}
|
|
451
|
-
*/
|
|
452
|
-
async createMfaRecoveryCodes() {
|
|
453
|
-
const apiPath = '/account/mfa/recovery-codes';
|
|
454
|
-
let payload = {};
|
|
455
|
-
|
|
456
|
-
return await this.client.call('post', apiPath, {
|
|
457
|
-
'content-type': 'application/json',
|
|
458
|
-
}, payload);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Regenerate MFA Recovery Codes
|
|
463
|
-
*
|
|
464
|
-
* Regenerate recovery codes that can be used as backup for MFA flow. Before
|
|
465
|
-
* regenerating codes, they must be first generated using
|
|
466
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
467
|
-
* method. An OTP challenge is required to regenreate recovery codes.
|
|
468
|
-
*
|
|
469
|
-
* @throws {AppwriteException}
|
|
470
|
-
* @returns {Promise}
|
|
471
|
-
*/
|
|
472
|
-
async updateMfaRecoveryCodes() {
|
|
473
|
-
const apiPath = '/account/mfa/recovery-codes';
|
|
474
|
-
let payload = {};
|
|
475
|
-
|
|
476
|
-
return await this.client.call('patch', apiPath, {
|
|
477
|
-
'content-type': 'application/json',
|
|
478
|
-
}, payload);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Update name
|
|
483
|
-
*
|
|
484
|
-
* Update currently logged in user account name.
|
|
485
|
-
*
|
|
486
|
-
* @param {string} name
|
|
487
|
-
* @throws {AppwriteException}
|
|
488
|
-
* @returns {Promise}
|
|
489
|
-
*/
|
|
490
|
-
async updateName(name) {
|
|
491
|
-
const apiPath = '/account/name';
|
|
492
|
-
let payload = {};
|
|
493
|
-
if (typeof name === 'undefined') {
|
|
494
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
if (typeof name !== 'undefined') {
|
|
499
|
-
payload['name'] = name;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
return await this.client.call('patch', apiPath, {
|
|
503
|
-
'content-type': 'application/json',
|
|
504
|
-
}, payload);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Update password
|
|
509
|
-
*
|
|
510
|
-
* Update currently logged in user password. For validation, user is required
|
|
511
|
-
* to pass in the new password, and the old password. For users created with
|
|
512
|
-
* OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
513
|
-
*
|
|
514
|
-
* @param {string} password
|
|
515
|
-
* @param {string} oldPassword
|
|
516
|
-
* @throws {AppwriteException}
|
|
517
|
-
* @returns {Promise}
|
|
518
|
-
*/
|
|
519
|
-
async updatePassword(password, oldPassword) {
|
|
520
|
-
const apiPath = '/account/password';
|
|
521
|
-
let payload = {};
|
|
522
|
-
if (typeof password === 'undefined') {
|
|
523
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (typeof password !== 'undefined') {
|
|
528
|
-
payload['password'] = password;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (typeof oldPassword !== 'undefined') {
|
|
532
|
-
payload['oldPassword'] = oldPassword;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return await this.client.call('patch', apiPath, {
|
|
536
|
-
'content-type': 'application/json',
|
|
537
|
-
}, payload);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Update phone
|
|
542
|
-
*
|
|
543
|
-
* Update the currently logged in user's phone number. After updating the
|
|
544
|
-
* phone number, the phone verification status will be reset. A confirmation
|
|
545
|
-
* SMS is not sent automatically, however you can use the [POST
|
|
546
|
-
* /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
|
|
547
|
-
* endpoint to send a confirmation SMS.
|
|
548
|
-
*
|
|
549
|
-
* @param {string} phone
|
|
550
|
-
* @param {string} password
|
|
551
|
-
* @throws {AppwriteException}
|
|
552
|
-
* @returns {Promise}
|
|
553
|
-
*/
|
|
554
|
-
async updatePhone(phone, password) {
|
|
555
|
-
const apiPath = '/account/phone';
|
|
556
|
-
let payload = {};
|
|
557
|
-
if (typeof phone === 'undefined') {
|
|
558
|
-
throw new AppwriteException('Missing required parameter: "phone"');
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
if (typeof password === 'undefined') {
|
|
562
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
if (typeof phone !== 'undefined') {
|
|
567
|
-
payload['phone'] = phone;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
if (typeof password !== 'undefined') {
|
|
571
|
-
payload['password'] = password;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
return await this.client.call('patch', apiPath, {
|
|
575
|
-
'content-type': 'application/json',
|
|
576
|
-
}, payload);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Get account preferences
|
|
581
|
-
*
|
|
582
|
-
* Get the preferences as a key-value object for the currently logged in user.
|
|
583
|
-
*
|
|
584
|
-
* @throws {AppwriteException}
|
|
585
|
-
* @returns {Promise}
|
|
586
|
-
*/
|
|
587
|
-
async getPrefs() {
|
|
588
|
-
const apiPath = '/account/prefs';
|
|
589
|
-
let payload = {};
|
|
590
|
-
|
|
591
|
-
return await this.client.call('get', apiPath, {
|
|
592
|
-
'content-type': 'application/json',
|
|
593
|
-
}, payload);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Update preferences
|
|
598
|
-
*
|
|
599
|
-
* Update currently logged in user account preferences. The object you pass is
|
|
600
|
-
* stored as is, and replaces any previous value. The maximum allowed prefs
|
|
601
|
-
* size is 64kB and throws error if exceeded.
|
|
602
|
-
*
|
|
603
|
-
* @param {object} prefs
|
|
604
|
-
* @throws {AppwriteException}
|
|
605
|
-
* @returns {Promise}
|
|
606
|
-
*/
|
|
607
|
-
async updatePrefs(prefs) {
|
|
608
|
-
const apiPath = '/account/prefs';
|
|
609
|
-
let payload = {};
|
|
610
|
-
if (typeof prefs === 'undefined') {
|
|
611
|
-
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
if (typeof prefs !== 'undefined') {
|
|
616
|
-
payload['prefs'] = prefs;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
return await this.client.call('patch', apiPath, {
|
|
620
|
-
'content-type': 'application/json',
|
|
621
|
-
}, payload);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Create password recovery
|
|
626
|
-
*
|
|
627
|
-
* Sends the user an email with a temporary secret key for password reset.
|
|
628
|
-
* When the user clicks the confirmation link he is redirected back to your
|
|
629
|
-
* app password reset URL with the secret key and email address values
|
|
630
|
-
* attached to the URL query string. Use the query string params to submit a
|
|
631
|
-
* request to the [PUT
|
|
632
|
-
* /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
|
|
633
|
-
* endpoint to complete the process. The verification link sent to the user's
|
|
634
|
-
* email address is valid for 1 hour.
|
|
635
|
-
*
|
|
636
|
-
* @param {string} email
|
|
637
|
-
* @param {string} url
|
|
638
|
-
* @throws {AppwriteException}
|
|
639
|
-
* @returns {Promise}
|
|
640
|
-
*/
|
|
641
|
-
async createRecovery(email, url) {
|
|
642
|
-
const apiPath = '/account/recovery';
|
|
643
|
-
let payload = {};
|
|
644
|
-
if (typeof email === 'undefined') {
|
|
645
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
if (typeof url === 'undefined') {
|
|
649
|
-
throw new AppwriteException('Missing required parameter: "url"');
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
if (typeof email !== 'undefined') {
|
|
654
|
-
payload['email'] = email;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
if (typeof url !== 'undefined') {
|
|
658
|
-
payload['url'] = url;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
return await this.client.call('post', apiPath, {
|
|
662
|
-
'content-type': 'application/json',
|
|
663
|
-
}, payload);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* Create password recovery (confirmation)
|
|
668
|
-
*
|
|
669
|
-
* Use this endpoint to complete the user account password reset. Both the
|
|
670
|
-
* **userId** and **secret** arguments will be passed as query parameters to
|
|
671
|
-
* the redirect URL you have provided when sending your request to the [POST
|
|
672
|
-
* /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
|
|
673
|
-
* endpoint.
|
|
674
|
-
*
|
|
675
|
-
* Please note that in order to avoid a [Redirect
|
|
676
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
|
677
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
678
|
-
* adding your platforms in the console interface.
|
|
679
|
-
*
|
|
680
|
-
* @param {string} userId
|
|
681
|
-
* @param {string} secret
|
|
682
|
-
* @param {string} password
|
|
683
|
-
* @throws {AppwriteException}
|
|
684
|
-
* @returns {Promise}
|
|
685
|
-
*/
|
|
686
|
-
async updateRecovery(userId, secret, password) {
|
|
687
|
-
const apiPath = '/account/recovery';
|
|
688
|
-
let payload = {};
|
|
689
|
-
if (typeof userId === 'undefined') {
|
|
690
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
if (typeof secret === 'undefined') {
|
|
694
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
if (typeof password === 'undefined') {
|
|
698
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
if (typeof userId !== 'undefined') {
|
|
703
|
-
payload['userId'] = userId;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (typeof secret !== 'undefined') {
|
|
707
|
-
payload['secret'] = secret;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (typeof password !== 'undefined') {
|
|
711
|
-
payload['password'] = password;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
return await this.client.call('put', apiPath, {
|
|
715
|
-
'content-type': 'application/json',
|
|
716
|
-
}, payload);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* List sessions
|
|
721
|
-
*
|
|
722
|
-
* Get the list of active sessions across different devices for the currently
|
|
723
|
-
* logged in user.
|
|
724
|
-
*
|
|
725
|
-
* @throws {AppwriteException}
|
|
726
|
-
* @returns {Promise}
|
|
727
|
-
*/
|
|
728
|
-
async listSessions() {
|
|
729
|
-
const apiPath = '/account/sessions';
|
|
730
|
-
let payload = {};
|
|
731
|
-
|
|
732
|
-
return await this.client.call('get', apiPath, {
|
|
733
|
-
'content-type': 'application/json',
|
|
734
|
-
}, payload);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
/**
|
|
738
|
-
* Delete sessions
|
|
739
|
-
*
|
|
740
|
-
* Delete all sessions from the user account and remove any sessions cookies
|
|
741
|
-
* from the end client.
|
|
742
|
-
*
|
|
743
|
-
* @throws {AppwriteException}
|
|
744
|
-
* @returns {Promise}
|
|
745
|
-
*/
|
|
746
|
-
async deleteSessions() {
|
|
747
|
-
const apiPath = '/account/sessions';
|
|
748
|
-
let payload = {};
|
|
749
|
-
|
|
750
|
-
return await this.client.call('delete', apiPath, {
|
|
751
|
-
'content-type': 'application/json',
|
|
752
|
-
}, payload);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* Create anonymous session
|
|
757
|
-
*
|
|
758
|
-
* Use this endpoint to allow a new user to register an anonymous account in
|
|
759
|
-
* your project. This route will also create a new session for the user. To
|
|
760
|
-
* allow the new user to convert an anonymous account to a normal account, you
|
|
761
|
-
* need to update its [email and
|
|
762
|
-
* password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
|
|
763
|
-
* or create an [OAuth2
|
|
764
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
765
|
-
*
|
|
766
|
-
* @throws {AppwriteException}
|
|
767
|
-
* @returns {Promise}
|
|
768
|
-
*/
|
|
769
|
-
async createAnonymousSession() {
|
|
770
|
-
const apiPath = '/account/sessions/anonymous';
|
|
771
|
-
let payload = {};
|
|
772
|
-
|
|
773
|
-
return await this.client.call('post', apiPath, {
|
|
774
|
-
'content-type': 'application/json',
|
|
775
|
-
}, payload);
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* Create email password session
|
|
780
|
-
*
|
|
781
|
-
* Allow the user to login into their account by providing a valid email and
|
|
782
|
-
* password combination. This route will create a new session for the user.
|
|
783
|
-
*
|
|
784
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
785
|
-
* about session
|
|
786
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
787
|
-
*
|
|
788
|
-
* @param {string} email
|
|
789
|
-
* @param {string} password
|
|
790
|
-
* @throws {AppwriteException}
|
|
791
|
-
* @returns {Promise}
|
|
792
|
-
*/
|
|
793
|
-
async createEmailPasswordSession(email, password) {
|
|
794
|
-
const apiPath = '/account/sessions/email';
|
|
795
|
-
let payload = {};
|
|
796
|
-
if (typeof email === 'undefined') {
|
|
797
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
if (typeof password === 'undefined') {
|
|
801
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
if (typeof email !== 'undefined') {
|
|
806
|
-
payload['email'] = email;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
if (typeof password !== 'undefined') {
|
|
810
|
-
payload['password'] = password;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
return await this.client.call('post', apiPath, {
|
|
814
|
-
'content-type': 'application/json',
|
|
815
|
-
}, payload);
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* Update magic URL session
|
|
820
|
-
*
|
|
821
|
-
* Use this endpoint to create a session from token. Provide the **userId**
|
|
822
|
-
* and **secret** parameters from the successful response of authentication
|
|
823
|
-
* flows initiated by token creation. For example, magic URL and phone login.
|
|
824
|
-
*
|
|
825
|
-
* @param {string} userId
|
|
826
|
-
* @param {string} secret
|
|
827
|
-
* @throws {AppwriteException}
|
|
828
|
-
* @returns {Promise}
|
|
829
|
-
*/
|
|
830
|
-
async updateMagicURLSession(userId, secret) {
|
|
831
|
-
const apiPath = '/account/sessions/magic-url';
|
|
832
|
-
let payload = {};
|
|
833
|
-
if (typeof userId === 'undefined') {
|
|
834
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
if (typeof secret === 'undefined') {
|
|
838
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
if (typeof userId !== 'undefined') {
|
|
843
|
-
payload['userId'] = userId;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
if (typeof secret !== 'undefined') {
|
|
847
|
-
payload['secret'] = secret;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
return await this.client.call('put', apiPath, {
|
|
851
|
-
'content-type': 'application/json',
|
|
852
|
-
}, payload);
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* Update phone session
|
|
857
|
-
*
|
|
858
|
-
* Use this endpoint to create a session from token. Provide the **userId**
|
|
859
|
-
* and **secret** parameters from the successful response of authentication
|
|
860
|
-
* flows initiated by token creation. For example, magic URL and phone login.
|
|
861
|
-
*
|
|
862
|
-
* @param {string} userId
|
|
863
|
-
* @param {string} secret
|
|
864
|
-
* @throws {AppwriteException}
|
|
865
|
-
* @returns {Promise}
|
|
866
|
-
*/
|
|
867
|
-
async updatePhoneSession(userId, secret) {
|
|
868
|
-
const apiPath = '/account/sessions/phone';
|
|
869
|
-
let payload = {};
|
|
870
|
-
if (typeof userId === 'undefined') {
|
|
871
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
if (typeof secret === 'undefined') {
|
|
875
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (typeof userId !== 'undefined') {
|
|
880
|
-
payload['userId'] = userId;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
if (typeof secret !== 'undefined') {
|
|
884
|
-
payload['secret'] = secret;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
return await this.client.call('put', apiPath, {
|
|
888
|
-
'content-type': 'application/json',
|
|
889
|
-
}, payload);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Create session
|
|
894
|
-
*
|
|
895
|
-
* Use this endpoint to create a session from token. Provide the **userId**
|
|
896
|
-
* and **secret** parameters from the successful response of authentication
|
|
897
|
-
* flows initiated by token creation. For example, magic URL and phone login.
|
|
898
|
-
*
|
|
899
|
-
* @param {string} userId
|
|
900
|
-
* @param {string} secret
|
|
901
|
-
* @throws {AppwriteException}
|
|
902
|
-
* @returns {Promise}
|
|
903
|
-
*/
|
|
904
|
-
async createSession(userId, secret) {
|
|
905
|
-
const apiPath = '/account/sessions/token';
|
|
906
|
-
let payload = {};
|
|
907
|
-
if (typeof userId === 'undefined') {
|
|
908
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
if (typeof secret === 'undefined') {
|
|
912
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
if (typeof userId !== 'undefined') {
|
|
917
|
-
payload['userId'] = userId;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
if (typeof secret !== 'undefined') {
|
|
921
|
-
payload['secret'] = secret;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
return await this.client.call('post', apiPath, {
|
|
925
|
-
'content-type': 'application/json',
|
|
926
|
-
}, payload);
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Get session
|
|
931
|
-
*
|
|
932
|
-
* Use this endpoint to get a logged in user's session using a Session ID.
|
|
933
|
-
* Inputting 'current' will return the current session being used.
|
|
934
|
-
*
|
|
935
|
-
* @param {string} sessionId
|
|
936
|
-
* @throws {AppwriteException}
|
|
937
|
-
* @returns {Promise}
|
|
938
|
-
*/
|
|
939
|
-
async getSession(sessionId) {
|
|
940
|
-
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
941
|
-
let payload = {};
|
|
942
|
-
if (typeof sessionId === 'undefined') {
|
|
943
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
return await this.client.call('get', apiPath, {
|
|
948
|
-
'content-type': 'application/json',
|
|
949
|
-
}, payload);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* Update session
|
|
954
|
-
*
|
|
955
|
-
* Use this endpoint to extend a session's length. Extending a session is
|
|
956
|
-
* useful when session expiry is short. If the session was created using an
|
|
957
|
-
* OAuth provider, this endpoint refreshes the access token from the provider.
|
|
958
|
-
*
|
|
959
|
-
* @param {string} sessionId
|
|
960
|
-
* @throws {AppwriteException}
|
|
961
|
-
* @returns {Promise}
|
|
962
|
-
*/
|
|
963
|
-
async updateSession(sessionId) {
|
|
964
|
-
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
965
|
-
let payload = {};
|
|
966
|
-
if (typeof sessionId === 'undefined') {
|
|
967
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
return await this.client.call('patch', apiPath, {
|
|
972
|
-
'content-type': 'application/json',
|
|
973
|
-
}, payload);
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
/**
|
|
977
|
-
* Delete session
|
|
978
|
-
*
|
|
979
|
-
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
980
|
-
* use a session ID to logout on another device. If you're looking to logout
|
|
981
|
-
* the user on all devices, use [Delete
|
|
982
|
-
* Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
|
|
983
|
-
* instead.
|
|
984
|
-
*
|
|
985
|
-
* @param {string} sessionId
|
|
986
|
-
* @throws {AppwriteException}
|
|
987
|
-
* @returns {Promise}
|
|
988
|
-
*/
|
|
989
|
-
async deleteSession(sessionId) {
|
|
990
|
-
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
991
|
-
let payload = {};
|
|
992
|
-
if (typeof sessionId === 'undefined') {
|
|
993
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
return await this.client.call('delete', apiPath, {
|
|
998
|
-
'content-type': 'application/json',
|
|
999
|
-
}, payload);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
/**
|
|
1003
|
-
* Update status
|
|
1004
|
-
*
|
|
1005
|
-
* Block the currently logged in user account. Behind the scene, the user
|
|
1006
|
-
* record is not deleted but permanently blocked from any access. To
|
|
1007
|
-
* completely delete a user, use the Users API instead.
|
|
1008
|
-
*
|
|
1009
|
-
* @throws {AppwriteException}
|
|
1010
|
-
* @returns {Promise}
|
|
1011
|
-
*/
|
|
1012
|
-
async updateStatus() {
|
|
1013
|
-
const apiPath = '/account/status';
|
|
1014
|
-
let payload = {};
|
|
1015
|
-
|
|
1016
|
-
return await this.client.call('patch', apiPath, {
|
|
1017
|
-
'content-type': 'application/json',
|
|
1018
|
-
}, payload);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
/**
|
|
1022
|
-
* Create email token (OTP)
|
|
1023
|
-
*
|
|
1024
|
-
* Sends the user an email with a secret key for creating a session. If the
|
|
1025
|
-
* provided user ID has not be registered, a new user will be created. Use the
|
|
1026
|
-
* returned user ID and secret and submit a request to the [POST
|
|
1027
|
-
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1028
|
-
* endpoint to complete the login process. The secret sent to the user's email
|
|
1029
|
-
* is valid for 15 minutes.
|
|
1030
|
-
*
|
|
1031
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1032
|
-
* about session
|
|
1033
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1034
|
-
*
|
|
1035
|
-
* @param {string} userId
|
|
1036
|
-
* @param {string} email
|
|
1037
|
-
* @param {boolean} phrase
|
|
1038
|
-
* @throws {AppwriteException}
|
|
1039
|
-
* @returns {Promise}
|
|
1040
|
-
*/
|
|
1041
|
-
async createEmailToken(userId, email, phrase) {
|
|
1042
|
-
const apiPath = '/account/tokens/email';
|
|
1043
|
-
let payload = {};
|
|
1044
|
-
if (typeof userId === 'undefined') {
|
|
1045
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
if (typeof email === 'undefined') {
|
|
1049
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
if (typeof userId !== 'undefined') {
|
|
1054
|
-
payload['userId'] = userId;
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
if (typeof email !== 'undefined') {
|
|
1058
|
-
payload['email'] = email;
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
if (typeof phrase !== 'undefined') {
|
|
1062
|
-
payload['phrase'] = phrase;
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
return await this.client.call('post', apiPath, {
|
|
1066
|
-
'content-type': 'application/json',
|
|
1067
|
-
}, payload);
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* Create magic URL token
|
|
1072
|
-
*
|
|
1073
|
-
* Sends the user an email with a secret key for creating a session. If the
|
|
1074
|
-
* provided user ID has not been registered, a new user will be created. When
|
|
1075
|
-
* the user clicks the link in the email, the user is redirected back to the
|
|
1076
|
-
* URL you provided with the secret key and userId values attached to the URL
|
|
1077
|
-
* query string. Use the query string parameters to submit a request to the
|
|
1078
|
-
* [POST
|
|
1079
|
-
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1080
|
-
* endpoint to complete the login process. The link sent to the user's email
|
|
1081
|
-
* address is valid for 1 hour. If you are on a mobile device you can leave
|
|
1082
|
-
* the URL parameter empty, so that the login completion will be handled by
|
|
1083
|
-
* your Appwrite instance by default.
|
|
1084
|
-
*
|
|
1085
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1086
|
-
* about session
|
|
1087
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
* @param {string} userId
|
|
1091
|
-
* @param {string} email
|
|
1092
|
-
* @param {string} url
|
|
1093
|
-
* @param {boolean} phrase
|
|
1094
|
-
* @throws {AppwriteException}
|
|
1095
|
-
* @returns {Promise}
|
|
1096
|
-
*/
|
|
1097
|
-
async createMagicURLToken(userId, email, url, phrase) {
|
|
1098
|
-
const apiPath = '/account/tokens/magic-url';
|
|
1099
|
-
let payload = {};
|
|
1100
|
-
if (typeof userId === 'undefined') {
|
|
1101
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
if (typeof email === 'undefined') {
|
|
1105
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
if (typeof userId !== 'undefined') {
|
|
1110
|
-
payload['userId'] = userId;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
if (typeof email !== 'undefined') {
|
|
1114
|
-
payload['email'] = email;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
if (typeof url !== 'undefined') {
|
|
1118
|
-
payload['url'] = url;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
if (typeof phrase !== 'undefined') {
|
|
1122
|
-
payload['phrase'] = phrase;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
return await this.client.call('post', apiPath, {
|
|
1126
|
-
'content-type': 'application/json',
|
|
1127
|
-
}, payload);
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* Create OAuth2 token
|
|
1132
|
-
*
|
|
1133
|
-
* Allow the user to login to their account using the OAuth2 provider of their
|
|
1134
|
-
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
1135
|
-
* first. Use the success and failure arguments to provide a redirect URL's
|
|
1136
|
-
* back to your app when login is completed.
|
|
1137
|
-
*
|
|
1138
|
-
* If authentication succeeds, `userId` and `secret` of a token will be
|
|
1139
|
-
* appended to the success URL as query parameters. These can be used to
|
|
1140
|
-
* create a new session using the [Create
|
|
1141
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1142
|
-
* endpoint.
|
|
1143
|
-
*
|
|
1144
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1145
|
-
* about session
|
|
1146
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1147
|
-
*
|
|
1148
|
-
* @param {OAuthProvider} provider
|
|
1149
|
-
* @param {string} success
|
|
1150
|
-
* @param {string} failure
|
|
1151
|
-
* @param {string[]} scopes
|
|
1152
|
-
* @throws {AppwriteException}
|
|
1153
|
-
* @returns {Promise}
|
|
1154
|
-
*/
|
|
1155
|
-
async createOAuth2Token(provider, success, failure, scopes) {
|
|
1156
|
-
const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
|
|
1157
|
-
let payload = {};
|
|
1158
|
-
if (typeof provider === 'undefined') {
|
|
1159
|
-
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
if (typeof success !== 'undefined') {
|
|
1164
|
-
payload['success'] = success;
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
if (typeof failure !== 'undefined') {
|
|
1168
|
-
payload['failure'] = failure;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
if (typeof scopes !== 'undefined') {
|
|
1172
|
-
payload['scopes'] = scopes;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
return await this.client.call('get', apiPath, {
|
|
1176
|
-
'content-type': 'application/json',
|
|
1177
|
-
}, payload, 'location');
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
/**
|
|
1181
|
-
* Create phone token
|
|
1182
|
-
*
|
|
1183
|
-
* Sends the user an SMS with a secret key for creating a session. If the
|
|
1184
|
-
* provided user ID has not be registered, a new user will be created. Use the
|
|
1185
|
-
* returned user ID and secret and submit a request to the [POST
|
|
1186
|
-
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1187
|
-
* endpoint to complete the login process. The secret sent to the user's phone
|
|
1188
|
-
* is valid for 15 minutes.
|
|
1189
|
-
*
|
|
1190
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1191
|
-
* about session
|
|
1192
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1193
|
-
*
|
|
1194
|
-
* @param {string} userId
|
|
1195
|
-
* @param {string} phone
|
|
1196
|
-
* @throws {AppwriteException}
|
|
1197
|
-
* @returns {Promise}
|
|
1198
|
-
*/
|
|
1199
|
-
async createPhoneToken(userId, phone) {
|
|
1200
|
-
const apiPath = '/account/tokens/phone';
|
|
1201
|
-
let payload = {};
|
|
1202
|
-
if (typeof userId === 'undefined') {
|
|
1203
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
if (typeof phone === 'undefined') {
|
|
1207
|
-
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
if (typeof userId !== 'undefined') {
|
|
1212
|
-
payload['userId'] = userId;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
if (typeof phone !== 'undefined') {
|
|
1216
|
-
payload['phone'] = phone;
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
return await this.client.call('post', apiPath, {
|
|
1220
|
-
'content-type': 'application/json',
|
|
1221
|
-
}, payload);
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* Create email verification
|
|
1226
|
-
*
|
|
1227
|
-
* Use this endpoint to send a verification message to your user email address
|
|
1228
|
-
* to confirm they are the valid owners of that address. Both the **userId**
|
|
1229
|
-
* and **secret** arguments will be passed as query parameters to the URL you
|
|
1230
|
-
* have provided to be attached to the verification email. The provided URL
|
|
1231
|
-
* should redirect the user back to your app and allow you to complete the
|
|
1232
|
-
* verification process by verifying both the **userId** and **secret**
|
|
1233
|
-
* parameters. Learn more about how to [complete the verification
|
|
1234
|
-
* process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
|
|
1235
|
-
* The verification link sent to the user's email address is valid for 7 days.
|
|
1236
|
-
*
|
|
1237
|
-
* Please note that in order to avoid a [Redirect
|
|
1238
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
|
|
1239
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
1240
|
-
* adding your platforms in the console interface.
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
* @param {string} url
|
|
1244
|
-
* @throws {AppwriteException}
|
|
1245
|
-
* @returns {Promise}
|
|
1246
|
-
*/
|
|
1247
|
-
async createVerification(url) {
|
|
1248
|
-
const apiPath = '/account/verification';
|
|
1249
|
-
let payload = {};
|
|
1250
|
-
if (typeof url === 'undefined') {
|
|
1251
|
-
throw new AppwriteException('Missing required parameter: "url"');
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
if (typeof url !== 'undefined') {
|
|
1256
|
-
payload['url'] = url;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
return await this.client.call('post', apiPath, {
|
|
1260
|
-
'content-type': 'application/json',
|
|
1261
|
-
}, payload);
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
/**
|
|
1265
|
-
* Create email verification (confirmation)
|
|
1266
|
-
*
|
|
1267
|
-
* Use this endpoint to complete the user email verification process. Use both
|
|
1268
|
-
* the **userId** and **secret** parameters that were attached to your app URL
|
|
1269
|
-
* to verify the user email ownership. If confirmed this route will return a
|
|
1270
|
-
* 200 status code.
|
|
1271
|
-
*
|
|
1272
|
-
* @param {string} userId
|
|
1273
|
-
* @param {string} secret
|
|
1274
|
-
* @throws {AppwriteException}
|
|
1275
|
-
* @returns {Promise}
|
|
1276
|
-
*/
|
|
1277
|
-
async updateVerification(userId, secret) {
|
|
1278
|
-
const apiPath = '/account/verification';
|
|
1279
|
-
let payload = {};
|
|
1280
|
-
if (typeof userId === 'undefined') {
|
|
1281
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
if (typeof secret === 'undefined') {
|
|
1285
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
if (typeof userId !== 'undefined') {
|
|
1290
|
-
payload['userId'] = userId;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
if (typeof secret !== 'undefined') {
|
|
1294
|
-
payload['secret'] = secret;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
return await this.client.call('put', apiPath, {
|
|
1298
|
-
'content-type': 'application/json',
|
|
1299
|
-
}, payload);
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
/**
|
|
1303
|
-
* Create phone verification
|
|
1304
|
-
*
|
|
1305
|
-
* Use this endpoint to send a verification SMS to the currently logged in
|
|
1306
|
-
* user. This endpoint is meant for use after updating a user's phone number
|
|
1307
|
-
* using the
|
|
1308
|
-
* [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
|
|
1309
|
-
* endpoint. Learn more about how to [complete the verification
|
|
1310
|
-
* process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
|
|
1311
|
-
* The verification code sent to the user's phone number is valid for 15
|
|
1312
|
-
* minutes.
|
|
1313
|
-
*
|
|
1314
|
-
* @throws {AppwriteException}
|
|
1315
|
-
* @returns {Promise}
|
|
1316
|
-
*/
|
|
1317
|
-
async createPhoneVerification() {
|
|
1318
|
-
const apiPath = '/account/verification/phone';
|
|
1319
|
-
let payload = {};
|
|
1320
|
-
|
|
1321
|
-
return await this.client.call('post', apiPath, {
|
|
1322
|
-
'content-type': 'application/json',
|
|
1323
|
-
}, payload);
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* Create phone verification (confirmation)
|
|
1328
|
-
*
|
|
1329
|
-
* Use this endpoint to complete the user phone verification process. Use the
|
|
1330
|
-
* **userId** and **secret** that were sent to your user's phone number to
|
|
1331
|
-
* verify the user email ownership. If confirmed this route will return a 200
|
|
1332
|
-
* status code.
|
|
1333
|
-
*
|
|
1334
|
-
* @param {string} userId
|
|
1335
|
-
* @param {string} secret
|
|
1336
|
-
* @throws {AppwriteException}
|
|
1337
|
-
* @returns {Promise}
|
|
1338
|
-
*/
|
|
1339
|
-
async updatePhoneVerification(userId, secret) {
|
|
1340
|
-
const apiPath = '/account/verification/phone';
|
|
1341
|
-
let payload = {};
|
|
1342
|
-
if (typeof userId === 'undefined') {
|
|
1343
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
if (typeof secret === 'undefined') {
|
|
1347
|
-
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
if (typeof userId !== 'undefined') {
|
|
1352
|
-
payload['userId'] = userId;
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
if (typeof secret !== 'undefined') {
|
|
1356
|
-
payload['secret'] = secret;
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
return await this.client.call('put', apiPath, {
|
|
1360
|
-
'content-type': 'application/json',
|
|
1361
|
-
}, payload);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
module.exports = Account;
|