@appwrite.io/console 1.10.0 → 2.1.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/.github/workflows/publish.yml +9 -8
- package/CHANGELOG.md +10 -0
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/dist/cjs/sdk.js +15258 -6062
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +15256 -6063
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +15258 -6062
- package/docs/examples/account/create-billing-address.md +8 -8
- package/docs/examples/account/create-email-password-session.md +4 -4
- package/docs/examples/account/create-email-token.md +5 -5
- package/docs/examples/account/{update-magic-u-r-l-session.md → create-email-verification.md} +3 -4
- package/docs/examples/account/{update-m-f-a.md → create-jwt.md} +3 -3
- package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
- package/docs/examples/account/create-mfa-authenticator.md +3 -3
- package/docs/examples/account/create-mfa-challenge.md +3 -3
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
- package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
- package/docs/examples/account/create-phone-token.md +4 -4
- package/docs/examples/account/create-push-target.md +5 -5
- package/docs/examples/account/create-recovery.md +4 -4
- package/docs/examples/account/create-session.md +4 -4
- package/docs/examples/account/create-verification.md +3 -3
- package/docs/examples/account/create.md +6 -6
- package/docs/examples/account/delete-billing-address.md +3 -3
- package/docs/examples/account/delete-identity.md +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +3 -3
- package/docs/examples/account/delete-payment-method.md +3 -3
- package/docs/examples/account/delete-push-target.md +3 -3
- package/docs/examples/account/delete-session.md +3 -3
- package/docs/examples/account/get-billing-address.md +3 -3
- package/docs/examples/account/get-coupon.md +3 -3
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-payment-method.md +3 -3
- package/docs/examples/account/get-session.md +3 -3
- package/docs/examples/account/list-billing-addresses.md +3 -3
- package/docs/examples/account/list-identities.md +4 -3
- package/docs/examples/account/list-invoices.md +3 -3
- package/docs/examples/account/list-logs.md +4 -3
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/list-payment-methods.md +3 -3
- package/docs/examples/account/update-billing-address.md +9 -9
- package/docs/examples/account/update-email-verification.md +14 -0
- package/docs/examples/account/update-email.md +4 -4
- package/docs/examples/account/update-magic-url-session.md +14 -0
- package/docs/examples/account/update-mfa-authenticator.md +4 -4
- package/docs/examples/account/update-mfa-challenge.md +4 -4
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-j-w-t.md → update-mfa.md} +3 -1
- package/docs/examples/account/update-name.md +3 -3
- package/docs/examples/account/update-password.md +4 -4
- package/docs/examples/account/update-payment-method-mandate-options.md +3 -3
- package/docs/examples/account/update-payment-method-provider.md +6 -5
- package/docs/examples/account/update-payment-method.md +6 -5
- package/docs/examples/account/update-phone-session.md +4 -4
- package/docs/examples/account/update-phone-verification.md +4 -4
- package/docs/examples/account/update-phone.md +4 -4
- package/docs/examples/account/update-prefs.md +7 -3
- package/docs/examples/account/update-push-target.md +4 -4
- package/docs/examples/account/update-recovery.md +5 -5
- package/docs/examples/account/update-session.md +3 -3
- package/docs/examples/account/update-verification.md +4 -4
- package/docs/examples/assistant/chat.md +3 -3
- package/docs/examples/avatars/get-browser.md +6 -6
- package/docs/examples/avatars/get-credit-card.md +6 -6
- package/docs/examples/avatars/get-favicon.md +3 -3
- package/docs/examples/avatars/get-flag.md +6 -6
- package/docs/examples/avatars/get-image.md +5 -5
- package/docs/examples/avatars/get-initials.md +6 -6
- package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
- package/docs/examples/avatars/get-screenshot.md +35 -0
- package/docs/examples/backups/create-archive.md +4 -4
- package/docs/examples/backups/create-policy.md +9 -9
- package/docs/examples/backups/create-restoration.md +6 -6
- package/docs/examples/backups/delete-archive.md +3 -3
- package/docs/examples/backups/delete-policy.md +3 -3
- package/docs/examples/backups/get-archive.md +3 -3
- package/docs/examples/backups/get-policy.md +3 -3
- package/docs/examples/backups/get-restoration.md +3 -3
- package/docs/examples/backups/list-archives.md +3 -3
- package/docs/examples/backups/list-policies.md +3 -3
- package/docs/examples/backups/list-restorations.md +3 -3
- package/docs/examples/backups/update-policy.md +7 -7
- package/docs/examples/console/create-program-membership.md +3 -3
- package/docs/examples/console/create-source.md +7 -7
- package/docs/examples/console/get-campaign.md +3 -3
- package/docs/examples/console/get-coupon.md +3 -3
- package/docs/examples/console/{plans.md → get-plan.md} +3 -1
- package/docs/examples/console/get-plans.md +13 -0
- package/docs/examples/console/{regions.md → get-program.md} +3 -1
- package/docs/examples/console/get-regions.md +13 -0
- package/docs/examples/console/get-resource.md +4 -4
- package/docs/examples/console/suggest-columns.md +17 -0
- package/docs/examples/console/suggest-indexes.md +16 -0
- package/docs/examples/databases/create-boolean-attribute.md +8 -8
- package/docs/examples/databases/create-collection.md +11 -9
- package/docs/examples/databases/create-datetime-attribute.md +8 -8
- package/docs/examples/databases/create-document.md +15 -8
- package/docs/examples/databases/create-documents.md +6 -5
- package/docs/examples/databases/create-email-attribute.md +8 -8
- package/docs/examples/databases/create-enum-attribute.md +9 -9
- package/docs/examples/databases/create-float-attribute.md +10 -10
- package/docs/examples/databases/create-index.md +9 -9
- package/docs/examples/databases/create-integer-attribute.md +10 -10
- package/docs/examples/databases/create-ip-attribute.md +8 -8
- package/docs/examples/databases/create-line-attribute.md +17 -0
- package/docs/examples/databases/create-operations.md +24 -0
- package/docs/examples/databases/create-point-attribute.md +17 -0
- package/docs/examples/databases/create-polygon-attribute.md +17 -0
- package/docs/examples/databases/create-relationship-attribute.md +10 -10
- package/docs/examples/databases/create-string-attribute.md +10 -10
- package/docs/examples/databases/create-transaction.md +13 -0
- package/docs/examples/databases/create-url-attribute.md +8 -8
- package/docs/examples/databases/create.md +5 -5
- package/docs/examples/databases/decrement-document-attribute.md +9 -8
- package/docs/examples/databases/delete-attribute.md +5 -5
- package/docs/examples/databases/delete-collection.md +4 -4
- package/docs/examples/databases/delete-document.md +6 -5
- package/docs/examples/databases/delete-documents.md +6 -5
- package/docs/examples/databases/delete-index.md +5 -5
- package/docs/examples/databases/{get-database-usage.md → delete-transaction.md} +4 -5
- package/docs/examples/databases/delete.md +3 -3
- package/docs/examples/databases/get-attribute.md +5 -5
- package/docs/examples/databases/get-collection-usage.md +6 -6
- package/docs/examples/databases/get-collection.md +4 -4
- package/docs/examples/databases/get-document.md +7 -6
- package/docs/examples/databases/get-index.md +5 -5
- package/docs/examples/databases/get-transaction.md +13 -0
- package/docs/examples/databases/get-usage.md +5 -4
- package/docs/examples/databases/get.md +3 -3
- package/docs/examples/databases/increment-document-attribute.md +9 -8
- package/docs/examples/databases/list-attributes.md +6 -5
- package/docs/examples/databases/list-collection-logs.md +5 -5
- package/docs/examples/databases/list-collections.md +6 -5
- package/docs/examples/databases/list-document-logs.md +6 -6
- package/docs/examples/databases/list-documents.md +7 -5
- package/docs/examples/databases/list-indexes.md +6 -5
- package/docs/examples/databases/list-logs.md +4 -4
- package/docs/examples/databases/list-transactions.md +13 -0
- package/docs/examples/databases/list-usage.md +13 -0
- package/docs/examples/databases/list.md +5 -4
- package/docs/examples/databases/update-boolean-attribute.md +8 -8
- package/docs/examples/databases/update-collection.md +9 -9
- package/docs/examples/databases/update-datetime-attribute.md +8 -8
- package/docs/examples/databases/update-document.md +15 -8
- package/docs/examples/databases/update-documents.md +13 -6
- package/docs/examples/databases/update-email-attribute.md +8 -8
- package/docs/examples/databases/update-enum-attribute.md +9 -9
- package/docs/examples/databases/update-float-attribute.md +10 -10
- package/docs/examples/databases/update-integer-attribute.md +10 -10
- package/docs/examples/databases/update-ip-attribute.md +8 -8
- package/docs/examples/databases/update-line-attribute.md +18 -0
- package/docs/examples/databases/update-point-attribute.md +18 -0
- package/docs/examples/databases/update-polygon-attribute.md +18 -0
- package/docs/examples/databases/update-relationship-attribute.md +7 -7
- package/docs/examples/databases/update-string-attribute.md +9 -9
- package/docs/examples/databases/update-transaction.md +15 -0
- package/docs/examples/databases/update-url-attribute.md +8 -8
- package/docs/examples/databases/update.md +5 -5
- package/docs/examples/databases/upsert-document.md +15 -8
- package/docs/examples/databases/upsert-documents.md +6 -5
- package/docs/examples/domains/create-preset-google-workspace.md +3 -3
- package/docs/examples/domains/create-preset-i-cloud.md +3 -3
- package/docs/examples/domains/create-preset-mailgun.md +3 -3
- package/docs/examples/domains/create-preset-outlook.md +3 -3
- package/docs/examples/domains/create-preset-proton-mail.md +3 -3
- package/docs/examples/domains/create-preset-zoho.md +3 -3
- package/docs/examples/domains/create-record-a.md +7 -7
- package/docs/examples/domains/{create-record-a-a-a-a.md → create-record-aaaa.md} +7 -7
- package/docs/examples/domains/create-record-alias.md +7 -7
- package/docs/examples/domains/{create-record-n-s.md → create-record-caa.md} +7 -7
- package/docs/examples/domains/{create-record-c-a-a.md → create-record-cname.md} +7 -7
- package/docs/examples/domains/{create-record-h-t-t-p-s.md → create-record-https.md} +7 -7
- package/docs/examples/domains/create-record-mx.md +18 -0
- package/docs/examples/domains/create-record-ns.md +17 -0
- package/docs/examples/domains/create-record-srv.md +20 -0
- package/docs/examples/domains/{create-record-c-n-a-m-e.md → create-record-txt.md} +7 -7
- package/docs/examples/domains/create.md +4 -4
- package/docs/examples/domains/delete-record.md +4 -4
- package/docs/examples/domains/delete.md +3 -3
- package/docs/examples/domains/get-preset-google-workspace.md +3 -3
- package/docs/examples/domains/get-preset-i-cloud.md +3 -3
- package/docs/examples/domains/get-preset-mailgun.md +3 -3
- package/docs/examples/domains/get-preset-outlook.md +3 -3
- package/docs/examples/domains/get-preset-proton-mail.md +3 -3
- package/docs/examples/domains/get-preset-zoho.md +3 -3
- package/docs/examples/domains/get-record.md +4 -4
- package/docs/examples/domains/get-zone.md +3 -3
- package/docs/examples/domains/get.md +3 -3
- package/docs/examples/domains/list-records.md +4 -4
- package/docs/examples/domains/list.md +4 -4
- package/docs/examples/domains/update-nameservers.md +3 -3
- package/docs/examples/domains/update-record-a.md +8 -8
- package/docs/examples/domains/update-record-aaaa.md +18 -0
- package/docs/examples/domains/update-record-alias.md +8 -8
- package/docs/examples/domains/update-record-caa.md +18 -0
- package/docs/examples/domains/update-record-cname.md +18 -0
- package/docs/examples/domains/update-record-https.md +18 -0
- package/docs/examples/domains/update-record-mx.md +19 -0
- package/docs/examples/domains/update-record-ns.md +18 -0
- package/docs/examples/domains/update-record-srv.md +21 -0
- package/docs/examples/domains/update-record-txt.md +18 -0
- package/docs/examples/domains/update-team.md +4 -4
- package/docs/examples/domains/update-zone.md +4 -4
- package/docs/examples/functions/create-deployment.md +7 -7
- package/docs/examples/functions/create-duplicate-deployment.md +5 -5
- package/docs/examples/functions/create-execution.md +9 -9
- package/docs/examples/functions/create-template-deployment.md +10 -9
- package/docs/examples/functions/create-variable.md +6 -6
- package/docs/examples/functions/create-vcs-deployment.md +7 -7
- package/docs/examples/functions/create.md +21 -21
- package/docs/examples/functions/delete-deployment.md +4 -4
- package/docs/examples/functions/delete-execution.md +4 -4
- package/docs/examples/functions/delete-variable.md +4 -4
- package/docs/examples/functions/delete.md +3 -3
- package/docs/examples/functions/get-deployment-download.md +5 -5
- package/docs/examples/functions/get-deployment.md +4 -4
- package/docs/examples/functions/get-execution.md +4 -4
- package/docs/examples/functions/get-template.md +3 -3
- package/docs/examples/functions/get-usage.md +5 -5
- package/docs/examples/functions/get-variable.md +4 -4
- package/docs/examples/functions/get.md +3 -3
- package/docs/examples/functions/list-deployments.md +6 -5
- package/docs/examples/functions/list-executions.md +5 -4
- package/docs/examples/functions/list-templates.md +7 -6
- package/docs/examples/functions/list-usage.md +4 -4
- package/docs/examples/functions/list-variables.md +3 -3
- package/docs/examples/functions/list.md +5 -4
- package/docs/examples/functions/update-deployment-status.md +4 -4
- package/docs/examples/functions/update-function-deployment.md +4 -4
- package/docs/examples/functions/update-variable.md +7 -7
- package/docs/examples/functions/update.md +21 -21
- package/docs/examples/graphql/mutation.md +3 -3
- package/docs/examples/graphql/query.md +3 -3
- package/docs/examples/health/get-certificate.md +3 -3
- package/docs/examples/health/get-failed-jobs.md +5 -5
- package/docs/examples/health/get-queue-billing-project-aggregation.md +3 -3
- package/docs/examples/health/get-queue-billing-team-aggregation.md +3 -3
- package/docs/examples/health/get-queue-builds.md +3 -3
- package/docs/examples/health/get-queue-certificates.md +3 -3
- package/docs/examples/health/get-queue-databases.md +4 -4
- package/docs/examples/health/get-queue-deletes.md +3 -3
- package/docs/examples/health/get-queue-functions.md +3 -3
- package/docs/examples/health/get-queue-logs.md +3 -3
- package/docs/examples/health/get-queue-mails.md +3 -3
- package/docs/examples/health/get-queue-messaging.md +3 -3
- package/docs/examples/health/get-queue-migrations.md +3 -3
- package/docs/examples/health/get-queue-priority-builds.md +3 -3
- package/docs/examples/health/get-queue-region-manager.md +3 -3
- package/docs/examples/health/get-queue-stats-resources.md +3 -3
- package/docs/examples/health/get-queue-threats.md +13 -0
- package/docs/examples/health/get-queue-usage.md +3 -3
- package/docs/examples/health/get-queue-webhooks.md +3 -3
- package/docs/examples/messaging/create-apns-provider.md +10 -10
- package/docs/examples/messaging/create-email.md +14 -14
- package/docs/examples/messaging/create-fcm-provider.md +6 -6
- package/docs/examples/messaging/create-mailgun-provider.md +12 -12
- package/docs/examples/messaging/{create-msg91provider.md → create-msg-91-provider.md} +8 -8
- package/docs/examples/messaging/create-push.md +21 -21
- package/docs/examples/messaging/create-resend-provider.md +20 -0
- package/docs/examples/messaging/create-sendgrid-provider.md +10 -10
- package/docs/examples/messaging/create-sms.md +9 -9
- package/docs/examples/messaging/create-smtp-provider.md +16 -16
- package/docs/examples/messaging/create-subscriber.md +5 -5
- package/docs/examples/messaging/create-telesign-provider.md +8 -8
- package/docs/examples/messaging/create-textmagic-provider.md +8 -8
- package/docs/examples/messaging/create-topic.md +5 -5
- package/docs/examples/messaging/create-twilio-provider.md +8 -8
- package/docs/examples/messaging/create-vonage-provider.md +8 -8
- package/docs/examples/messaging/delete-provider.md +3 -3
- package/docs/examples/messaging/delete-subscriber.md +4 -4
- package/docs/examples/messaging/delete-topic.md +3 -3
- package/docs/examples/messaging/delete.md +3 -3
- package/docs/examples/messaging/get-message.md +3 -3
- package/docs/examples/messaging/get-provider.md +3 -3
- package/docs/examples/messaging/get-subscriber.md +4 -4
- package/docs/examples/messaging/get-topic.md +3 -3
- package/docs/examples/messaging/list-message-logs.md +5 -4
- package/docs/examples/messaging/list-messages.md +5 -4
- package/docs/examples/messaging/list-provider-logs.md +5 -4
- package/docs/examples/messaging/list-providers.md +5 -4
- package/docs/examples/messaging/list-subscriber-logs.md +5 -4
- package/docs/examples/messaging/list-subscribers.md +6 -5
- package/docs/examples/messaging/list-targets.md +5 -4
- package/docs/examples/messaging/list-topic-logs.md +5 -4
- package/docs/examples/messaging/list-topics.md +5 -4
- package/docs/examples/messaging/update-apns-provider.md +10 -10
- package/docs/examples/messaging/update-email.md +14 -14
- package/docs/examples/messaging/update-fcm-provider.md +6 -6
- package/docs/examples/messaging/update-mailgun-provider.md +12 -12
- package/docs/examples/messaging/{update-msg91provider.md → update-msg-91-provider.md} +8 -8
- package/docs/examples/messaging/update-push.md +21 -21
- package/docs/examples/messaging/update-resend-provider.md +20 -0
- package/docs/examples/messaging/update-sendgrid-provider.md +10 -10
- package/docs/examples/messaging/update-sms.md +9 -9
- package/docs/examples/messaging/update-smtp-provider.md +16 -16
- package/docs/examples/messaging/update-telesign-provider.md +8 -8
- package/docs/examples/messaging/update-textmagic-provider.md +8 -8
- package/docs/examples/messaging/update-topic.md +5 -5
- package/docs/examples/messaging/update-twilio-provider.md +8 -8
- package/docs/examples/messaging/update-vonage-provider.md +8 -8
- package/docs/examples/migrations/create-appwrite-migration.md +6 -6
- package/docs/examples/migrations/create-csv-export.md +21 -0
- package/docs/examples/migrations/{create-csv-migration.md → create-csv-import.md} +6 -5
- package/docs/examples/migrations/create-firebase-migration.md +4 -4
- package/docs/examples/migrations/create-n-host-migration.md +10 -10
- package/docs/examples/migrations/create-supabase-migration.md +9 -9
- package/docs/examples/migrations/delete.md +3 -3
- package/docs/examples/migrations/get-appwrite-report.md +6 -6
- package/docs/examples/migrations/get-firebase-report.md +4 -4
- package/docs/examples/migrations/get-n-host-report.md +10 -10
- package/docs/examples/migrations/get-supabase-report.md +9 -9
- package/docs/examples/migrations/get.md +3 -3
- package/docs/examples/migrations/list.md +5 -4
- package/docs/examples/migrations/retry.md +3 -3
- package/docs/examples/organizations/add-credit.md +4 -4
- package/docs/examples/organizations/cancel-downgrade.md +3 -3
- package/docs/examples/organizations/create-downgrade-feedback.md +17 -0
- package/docs/examples/organizations/create-invoice-payment.md +5 -5
- package/docs/examples/organizations/create.md +13 -12
- package/docs/examples/organizations/delete-backup-payment-method.md +3 -3
- package/docs/examples/organizations/delete-billing-address.md +3 -3
- package/docs/examples/organizations/delete-default-payment-method.md +3 -3
- package/docs/examples/organizations/delete.md +3 -3
- package/docs/examples/organizations/estimation-create-organization.md +8 -7
- package/docs/examples/organizations/estimation-delete-organization.md +3 -3
- package/docs/examples/organizations/estimation-update-plan.md +7 -7
- package/docs/examples/organizations/get-aggregation.md +6 -4
- package/docs/examples/organizations/get-available-credits.md +3 -3
- package/docs/examples/organizations/get-billing-address.md +4 -4
- package/docs/examples/organizations/get-credit.md +4 -4
- package/docs/examples/organizations/get-invoice-download.md +4 -4
- package/docs/examples/organizations/get-invoice-view.md +4 -4
- package/docs/examples/organizations/get-invoice.md +4 -4
- package/docs/examples/organizations/get-payment-method.md +4 -4
- package/docs/examples/organizations/get-plan.md +3 -3
- package/docs/examples/organizations/get-scopes.md +3 -3
- package/docs/examples/organizations/get-usage.md +5 -5
- package/docs/examples/organizations/list-aggregations.md +4 -4
- package/docs/examples/organizations/list-credits.md +4 -4
- package/docs/examples/organizations/list-invoices.md +4 -4
- package/docs/examples/organizations/list.md +4 -4
- package/docs/examples/organizations/set-backup-payment-method.md +4 -4
- package/docs/examples/organizations/set-billing-address.md +4 -4
- package/docs/examples/organizations/set-billing-email.md +4 -4
- package/docs/examples/organizations/set-billing-tax-id.md +4 -4
- package/docs/examples/organizations/set-default-payment-method.md +4 -4
- package/docs/examples/organizations/update-budget.md +5 -5
- package/docs/examples/organizations/update-plan.md +11 -11
- package/docs/examples/organizations/update-projects.md +4 -4
- package/docs/examples/organizations/validate-invoice.md +4 -4
- package/docs/examples/organizations/validate-payment.md +4 -4
- package/docs/examples/project/create-variable.md +5 -5
- package/docs/examples/project/delete-variable.md +3 -3
- package/docs/examples/project/get-usage.md +5 -5
- package/docs/examples/project/get-variable.md +3 -3
- package/docs/examples/project/update-variable.md +6 -6
- package/docs/examples/projects/create-dev-key.md +5 -5
- package/docs/examples/projects/{create-j-w-t.md → create-jwt.md} +5 -5
- package/docs/examples/projects/create-key.md +6 -6
- package/docs/examples/projects/create-platform.md +8 -8
- package/docs/examples/projects/create-smtp-test.md +12 -12
- package/docs/examples/projects/create-webhook.md +10 -10
- package/docs/examples/projects/create.md +16 -16
- package/docs/examples/projects/delete-dev-key.md +4 -4
- package/docs/examples/projects/delete-email-template.md +5 -5
- package/docs/examples/projects/delete-key.md +4 -4
- package/docs/examples/projects/delete-platform.md +4 -4
- package/docs/examples/projects/delete-sms-template.md +5 -5
- package/docs/examples/projects/delete-webhook.md +4 -4
- package/docs/examples/projects/delete.md +3 -3
- package/docs/examples/projects/get-dev-key.md +4 -4
- package/docs/examples/projects/get-email-template.md +5 -5
- package/docs/examples/projects/get-key.md +4 -4
- package/docs/examples/projects/get-platform.md +4 -4
- package/docs/examples/projects/get-sms-template.md +5 -5
- package/docs/examples/projects/get-webhook.md +4 -4
- package/docs/examples/projects/get.md +3 -3
- package/docs/examples/projects/list-dev-keys.md +4 -4
- package/docs/examples/projects/list-keys.md +4 -3
- package/docs/examples/projects/list-platforms.md +4 -3
- package/docs/examples/projects/list-webhooks.md +4 -3
- package/docs/examples/projects/list.md +5 -4
- package/docs/examples/projects/update-api-status-all.md +4 -4
- package/docs/examples/projects/update-api-status.md +6 -6
- package/docs/examples/projects/update-auth-duration.md +4 -4
- package/docs/examples/projects/update-auth-limit.md +4 -4
- package/docs/examples/projects/update-auth-password-dictionary.md +4 -4
- package/docs/examples/projects/update-auth-password-history.md +4 -4
- package/docs/examples/projects/update-auth-sessions-limit.md +4 -4
- package/docs/examples/projects/update-auth-status.md +5 -5
- package/docs/examples/projects/update-dev-key.md +6 -6
- package/docs/examples/projects/update-email-template.md +10 -10
- package/docs/examples/projects/update-key.md +7 -7
- package/docs/examples/projects/update-memberships-privacy.md +6 -6
- package/docs/examples/projects/update-mock-numbers.md +4 -4
- package/docs/examples/projects/{update-o-auth2.md → update-o-auth-2.md} +7 -7
- package/docs/examples/projects/update-personal-data-check.md +4 -4
- package/docs/examples/projects/update-platform.md +8 -8
- package/docs/examples/projects/update-service-status-all.md +4 -4
- package/docs/examples/projects/update-service-status.md +5 -5
- package/docs/examples/projects/update-session-alerts.md +4 -4
- package/docs/examples/projects/update-session-invalidation.md +14 -0
- package/docs/examples/projects/update-sms-template.md +6 -6
- package/docs/examples/projects/update-smtp.md +12 -12
- package/docs/examples/projects/update-status.md +14 -0
- package/docs/examples/projects/update-team.md +4 -4
- package/docs/examples/projects/update-webhook-signature.md +4 -4
- package/docs/examples/projects/update-webhook.md +11 -11
- package/docs/examples/projects/update.md +13 -13
- package/docs/examples/proxy/{create-a-p-i-rule.md → create-api-rule.md} +3 -3
- package/docs/examples/proxy/create-function-rule.md +5 -5
- package/docs/examples/proxy/create-redirect-rule.md +8 -8
- package/docs/examples/proxy/create-site-rule.md +5 -5
- package/docs/examples/proxy/delete-rule.md +3 -3
- package/docs/examples/proxy/get-rule.md +3 -3
- package/docs/examples/proxy/list-rules.md +5 -4
- package/docs/examples/proxy/update-rule-verification.md +3 -3
- package/docs/examples/sites/create-deployment.md +8 -8
- package/docs/examples/sites/create-duplicate-deployment.md +4 -4
- package/docs/examples/sites/create-template-deployment.md +10 -9
- package/docs/examples/sites/create-variable.md +6 -6
- package/docs/examples/sites/create-vcs-deployment.md +7 -7
- package/docs/examples/sites/create.md +21 -21
- package/docs/examples/sites/delete-deployment.md +4 -4
- package/docs/examples/sites/delete-log.md +4 -4
- package/docs/examples/sites/delete-variable.md +4 -4
- package/docs/examples/sites/delete.md +3 -3
- package/docs/examples/sites/get-deployment-download.md +5 -5
- package/docs/examples/sites/get-deployment.md +4 -4
- package/docs/examples/sites/get-log.md +4 -4
- package/docs/examples/sites/get-template.md +3 -3
- package/docs/examples/sites/get-usage.md +5 -5
- package/docs/examples/sites/get-variable.md +4 -4
- package/docs/examples/sites/get.md +3 -3
- package/docs/examples/sites/list-deployments.md +6 -5
- package/docs/examples/sites/list-logs.md +5 -4
- package/docs/examples/sites/list-templates.md +6 -6
- package/docs/examples/sites/list-usage.md +4 -4
- package/docs/examples/sites/list-variables.md +3 -3
- package/docs/examples/sites/list.md +5 -4
- package/docs/examples/sites/update-deployment-status.md +4 -4
- package/docs/examples/sites/update-site-deployment.md +4 -4
- package/docs/examples/sites/update-variable.md +7 -7
- package/docs/examples/sites/update.md +21 -21
- package/docs/examples/storage/create-bucket.md +14 -13
- package/docs/examples/storage/create-file.md +7 -7
- package/docs/examples/storage/delete-bucket.md +3 -3
- package/docs/examples/storage/delete-file.md +4 -4
- package/docs/examples/storage/get-bucket-usage.md +5 -5
- package/docs/examples/storage/get-bucket.md +3 -3
- package/docs/examples/storage/get-file-download.md +5 -5
- package/docs/examples/storage/get-file-preview.md +16 -16
- package/docs/examples/storage/get-file-view.md +5 -5
- package/docs/examples/storage/get-file.md +4 -4
- package/docs/examples/storage/get-usage.md +4 -4
- package/docs/examples/storage/list-buckets.md +5 -4
- package/docs/examples/storage/list-files.md +6 -5
- package/docs/examples/storage/update-bucket.md +14 -13
- package/docs/examples/storage/update-file.md +7 -7
- package/docs/examples/tablesdb/create-boolean-column.md +18 -0
- package/docs/examples/tablesdb/create-datetime-column.md +18 -0
- package/docs/examples/tablesdb/create-email-column.md +18 -0
- package/docs/examples/tablesdb/create-enum-column.md +19 -0
- package/docs/examples/tablesdb/create-float-column.md +20 -0
- package/docs/examples/tablesdb/create-index.md +19 -0
- package/docs/examples/tablesdb/create-integer-column.md +20 -0
- package/docs/examples/tablesdb/create-ip-column.md +18 -0
- package/docs/examples/tablesdb/create-line-column.md +17 -0
- package/docs/examples/tablesdb/create-operations.md +24 -0
- package/docs/examples/tablesdb/create-point-column.md +17 -0
- package/docs/examples/tablesdb/create-polygon-column.md +17 -0
- package/docs/examples/tablesdb/create-relationship-column.md +20 -0
- package/docs/examples/tablesdb/create-row.md +24 -0
- package/docs/examples/tablesdb/create-rows.md +16 -0
- package/docs/examples/tablesdb/create-string-column.md +20 -0
- package/docs/examples/tablesdb/create-table.md +20 -0
- package/docs/examples/tablesdb/create-transaction.md +13 -0
- package/docs/examples/tablesdb/create-url-column.md +18 -0
- package/docs/examples/tablesdb/create.md +15 -0
- package/docs/examples/tablesdb/decrement-row-column.md +19 -0
- package/docs/examples/tablesdb/delete-column.md +15 -0
- package/docs/examples/tablesdb/delete-index.md +15 -0
- package/docs/examples/tablesdb/delete-row.md +16 -0
- package/docs/examples/tablesdb/delete-rows.md +16 -0
- package/docs/examples/tablesdb/delete-table.md +14 -0
- package/docs/examples/tablesdb/delete-transaction.md +13 -0
- package/docs/examples/tablesdb/delete.md +13 -0
- package/docs/examples/tablesdb/get-column.md +15 -0
- package/docs/examples/tablesdb/get-index.md +15 -0
- package/docs/examples/tablesdb/get-row.md +17 -0
- package/docs/examples/tablesdb/get-table-usage.md +15 -0
- package/docs/examples/tablesdb/get-table.md +14 -0
- package/docs/examples/tablesdb/get-transaction.md +13 -0
- package/docs/examples/tablesdb/get-usage.md +14 -0
- package/docs/examples/tablesdb/get.md +13 -0
- package/docs/examples/tablesdb/increment-row-column.md +19 -0
- package/docs/examples/tablesdb/list-columns.md +16 -0
- package/docs/examples/tablesdb/list-indexes.md +16 -0
- package/docs/examples/tablesdb/list-row-logs.md +16 -0
- package/docs/examples/tablesdb/list-rows.md +17 -0
- package/docs/examples/tablesdb/list-table-logs.md +15 -0
- package/docs/examples/tablesdb/list-tables.md +16 -0
- package/docs/examples/tablesdb/list-transactions.md +13 -0
- package/docs/examples/tablesdb/list-usage.md +13 -0
- package/docs/examples/tablesdb/list.md +15 -0
- package/docs/examples/tablesdb/update-boolean-column.md +18 -0
- package/docs/examples/tablesdb/update-datetime-column.md +18 -0
- package/docs/examples/tablesdb/update-email-column.md +18 -0
- package/docs/examples/tablesdb/update-enum-column.md +19 -0
- package/docs/examples/tablesdb/update-float-column.md +20 -0
- package/docs/examples/tablesdb/update-integer-column.md +20 -0
- package/docs/examples/tablesdb/update-ip-column.md +18 -0
- package/docs/examples/tablesdb/update-line-column.md +18 -0
- package/docs/examples/tablesdb/update-point-column.md +18 -0
- package/docs/examples/tablesdb/update-polygon-column.md +18 -0
- package/docs/examples/tablesdb/update-relationship-column.md +17 -0
- package/docs/examples/tablesdb/update-row.md +24 -0
- package/docs/examples/tablesdb/update-rows.md +23 -0
- package/docs/examples/tablesdb/update-string-column.md +19 -0
- package/docs/examples/tablesdb/update-table.md +18 -0
- package/docs/examples/tablesdb/update-transaction.md +15 -0
- package/docs/examples/tablesdb/update-url-column.md +18 -0
- package/docs/examples/tablesdb/update.md +15 -0
- package/docs/examples/tablesdb/upsert-row.md +24 -0
- package/docs/examples/tablesdb/upsert-rows.md +16 -0
- package/docs/examples/teams/create-membership.md +9 -9
- package/docs/examples/teams/create.md +5 -5
- package/docs/examples/teams/delete-membership.md +4 -4
- package/docs/examples/teams/delete.md +3 -3
- package/docs/examples/teams/get-membership.md +4 -4
- package/docs/examples/teams/get-prefs.md +3 -3
- package/docs/examples/teams/get.md +3 -3
- package/docs/examples/teams/list-logs.md +5 -4
- package/docs/examples/teams/list-memberships.md +6 -5
- package/docs/examples/teams/list.md +5 -4
- package/docs/examples/teams/update-membership-status.md +6 -6
- package/docs/examples/teams/update-membership.md +5 -5
- package/docs/examples/teams/update-name.md +4 -4
- package/docs/examples/teams/update-prefs.md +4 -4
- package/docs/examples/tokens/create-file-token.md +5 -5
- package/docs/examples/tokens/delete.md +3 -3
- package/docs/examples/tokens/get.md +3 -3
- package/docs/examples/tokens/list.md +6 -5
- package/docs/examples/tokens/update.md +4 -4
- package/docs/examples/users/{create-m-d5user.md → create-argon-2-user.md} +6 -6
- package/docs/examples/users/create-bcrypt-user.md +6 -6
- package/docs/examples/users/{create-j-w-t.md → create-jwt.md} +5 -5
- package/docs/examples/users/{create-argon2user.md → create-md-5-user.md} +6 -6
- package/docs/examples/users/create-mfa-recovery-codes.md +3 -3
- package/docs/examples/users/{create-p-h-pass-user.md → create-ph-pass-user.md} +6 -6
- package/docs/examples/users/create-scrypt-modified-user.md +9 -9
- package/docs/examples/users/create-scrypt-user.md +11 -11
- package/docs/examples/users/create-session.md +3 -3
- package/docs/examples/users/{create-s-h-a-user.md → create-sha-user.md} +7 -7
- package/docs/examples/users/create-target.md +8 -8
- package/docs/examples/users/create-token.md +5 -5
- package/docs/examples/users/create.md +7 -7
- package/docs/examples/users/delete-identity.md +3 -3
- package/docs/examples/users/delete-mfa-authenticator.md +4 -4
- package/docs/examples/users/delete-session.md +4 -4
- package/docs/examples/users/delete-sessions.md +3 -3
- package/docs/examples/users/delete-target.md +4 -4
- package/docs/examples/users/delete.md +3 -3
- package/docs/examples/users/get-mfa-recovery-codes.md +3 -3
- package/docs/examples/users/get-prefs.md +3 -3
- package/docs/examples/users/get-target.md +4 -4
- package/docs/examples/users/get-usage.md +4 -4
- package/docs/examples/users/get.md +3 -3
- package/docs/examples/users/list-identities.md +5 -4
- package/docs/examples/users/list-logs.md +5 -4
- package/docs/examples/users/list-memberships.md +6 -5
- package/docs/examples/users/list-mfa-factors.md +3 -3
- package/docs/examples/users/list-sessions.md +4 -3
- package/docs/examples/users/list-targets.md +5 -4
- package/docs/examples/users/list.md +5 -4
- package/docs/examples/users/update-email-verification.md +4 -4
- package/docs/examples/users/update-email.md +4 -4
- package/docs/examples/users/update-labels.md +4 -4
- package/docs/examples/users/update-mfa-recovery-codes.md +3 -3
- package/docs/examples/users/update-mfa.md +4 -4
- package/docs/examples/users/update-name.md +4 -4
- package/docs/examples/users/update-password.md +4 -4
- package/docs/examples/users/update-phone-verification.md +4 -4
- package/docs/examples/users/update-phone.md +4 -4
- package/docs/examples/users/update-prefs.md +4 -4
- package/docs/examples/users/update-status.md +4 -4
- package/docs/examples/users/update-target.md +7 -7
- package/docs/examples/vcs/create-repository-detection.md +6 -6
- package/docs/examples/vcs/create-repository.md +5 -5
- package/docs/examples/vcs/delete-installation.md +3 -3
- package/docs/examples/vcs/get-installation.md +3 -3
- package/docs/examples/vcs/get-repository-contents.md +6 -6
- package/docs/examples/vcs/get-repository.md +4 -4
- package/docs/examples/vcs/list-installations.md +5 -4
- package/docs/examples/vcs/list-repositories.md +6 -5
- package/docs/examples/vcs/list-repository-branches.md +4 -4
- package/docs/examples/vcs/update-external-deployments.md +5 -5
- package/package.json +4 -4
- package/src/client.ts +71 -7
- package/src/enums/api-service.ts +1 -0
- package/src/enums/attribute-status.ts +7 -0
- package/src/enums/billing-plan-group.ts +5 -0
- package/src/enums/build-runtime.ts +2 -0
- package/src/enums/column-status.ts +7 -0
- package/src/enums/credit-card.ts +1 -1
- package/src/enums/database-type.ts +4 -0
- package/src/enums/deployment-status.ts +7 -0
- package/src/enums/execution-method.ts +1 -0
- package/src/enums/execution-status.ts +7 -0
- package/src/enums/execution-trigger.ts +5 -0
- package/src/enums/framework.ts +1 -0
- package/src/enums/health-antivirus-status.ts +5 -0
- package/src/enums/health-check-status.ts +4 -0
- package/src/enums/index-status.ts +7 -0
- package/src/enums/index-type.ts +1 -0
- package/src/enums/message-status.ts +7 -0
- package/src/enums/o-auth-provider.ts +3 -0
- package/src/enums/platform.ts +4 -0
- package/src/enums/proxy-rule-deployment-resource-type.ts +4 -0
- package/src/enums/proxy-rule-status.ts +6 -0
- package/src/enums/region.ts +3 -0
- package/src/enums/runtime.ts +2 -0
- package/src/enums/status.ts +4 -0
- package/src/enums/template-reference-type.ts +5 -0
- package/src/enums/theme.ts +4 -0
- package/src/enums/timezone.ts +421 -0
- package/src/enums/{user-usage-range.ts → usage-range.ts} +1 -1
- package/src/enums/{v-c-s-deployment-type.ts → vcs-reference-type.ts} +1 -1
- package/src/index.ts +27 -11
- package/src/models.ts +1692 -238
- package/src/operator.ts +308 -0
- package/src/query.ts +246 -2
- package/src/services/account.ts +2205 -223
- package/src/services/assistant.ts +29 -3
- package/src/services/avatars.ts +486 -33
- package/src/services/backups.ts +389 -42
- package/src/services/console.ts +492 -19
- package/src/services/databases.ts +3521 -431
- package/src/services/domains.ts +1684 -197
- package/src/services/functions.ts +1162 -149
- package/src/services/graphql.ts +55 -4
- package/src/services/health.ts +560 -41
- package/src/services/locale.ts +9 -0
- package/src/services/messaging.ts +3367 -380
- package/src/services/migrations.ts +641 -65
- package/src/services/organizations.ts +1323 -128
- package/src/services/project.ts +168 -17
- package/src/services/projects.ts +2742 -266
- package/src/services/proxy.ts +265 -26
- package/src/services/realtime.ts +437 -0
- package/src/services/sites.ts +1098 -140
- package/src/services/storage.ts +651 -82
- package/src/services/tables-db.ts +5439 -0
- package/src/services/teams.ts +512 -55
- package/src/services/tokens.ts +167 -16
- package/src/services/users.ts +1873 -181
- package/src/services/vcs.ts +359 -39
- package/types/client.d.ts +33 -5
- package/types/enums/api-service.d.ts +1 -0
- package/types/enums/attribute-status.d.ts +7 -0
- package/types/enums/billing-plan-group.d.ts +5 -0
- package/types/enums/build-runtime.d.ts +3 -1
- package/types/enums/column-status.d.ts +7 -0
- package/types/enums/credit-card.d.ts +1 -1
- package/types/enums/database-type.d.ts +4 -0
- package/types/enums/deployment-status.d.ts +7 -0
- package/types/enums/execution-method.d.ts +2 -1
- package/types/enums/execution-status.d.ts +7 -0
- package/types/enums/execution-trigger.d.ts +5 -0
- package/types/enums/framework.d.ts +1 -0
- package/types/enums/health-antivirus-status.d.ts +5 -0
- package/types/enums/health-check-status.d.ts +4 -0
- package/types/enums/index-status.d.ts +7 -0
- package/types/enums/index-type.d.ts +2 -1
- package/types/enums/message-status.d.ts +7 -0
- package/types/enums/o-auth-provider.d.ts +4 -1
- package/types/enums/platform.d.ts +4 -0
- package/types/enums/proxy-rule-deployment-resource-type.d.ts +4 -0
- package/types/enums/proxy-rule-status.d.ts +6 -0
- package/types/enums/region.d.ts +4 -1
- package/types/enums/runtime.d.ts +3 -1
- package/types/enums/status.d.ts +4 -0
- package/types/enums/template-reference-type.d.ts +5 -0
- package/types/enums/theme.d.ts +4 -0
- package/types/enums/timezone.d.ts +421 -0
- package/types/enums/{site-usage-range.d.ts → usage-range.d.ts} +1 -1
- package/types/enums/{v-c-s-deployment-type.d.ts → vcs-reference-type.d.ts} +1 -1
- package/types/index.d.ts +27 -11
- package/types/models.d.ts +1664 -245
- package/types/operator.d.ts +180 -0
- package/types/query.d.ts +198 -2
- package/types/services/account.d.ts +985 -123
- package/types/services/assistant.d.ts +13 -2
- package/types/services/avatars.d.ts +244 -26
- package/types/services/backups.d.ts +190 -30
- package/types/services/console.d.ts +201 -14
- package/types/services/databases.d.ts +1731 -284
- package/types/services/domains.d.ts +904 -152
- package/types/services/functions.d.ts +616 -125
- package/types/services/graphql.d.ts +24 -2
- package/types/services/health.d.ts +245 -23
- package/types/services/messaging.d.ts +1660 -271
- package/types/services/migrations.d.ts +319 -53
- package/types/services/organizations.d.ts +635 -97
- package/types/services/project.d.ts +81 -12
- package/types/services/projects.d.ts +1308 -202
- package/types/services/proxy.d.ts +128 -19
- package/types/services/realtime.d.ts +118 -0
- package/types/services/sites.d.ts +577 -116
- package/types/services/storage.d.ts +354 -73
- package/types/services/tables-db.d.ts +2040 -0
- package/types/services/teams.d.ts +260 -44
- package/types/services/tokens.d.ts +80 -12
- package/types/services/users.d.ts +881 -124
- package/types/services/vcs.d.ts +179 -31
- package/docs/examples/domains/create-record-m-x.md +0 -18
- package/docs/examples/domains/create-record-s-r-v.md +0 -20
- package/docs/examples/domains/create-record-t-x-t.md +0 -17
- package/docs/examples/domains/update-record-a-a-a-a.md +0 -18
- package/docs/examples/domains/update-record-c-a-a.md +0 -18
- package/docs/examples/domains/update-record-c-n-a-m-e.md +0 -18
- package/docs/examples/domains/update-record-h-t-t-p-s.md +0 -18
- package/docs/examples/domains/update-record-m-x.md +0 -19
- package/docs/examples/domains/update-record-n-s.md +0 -18
- package/docs/examples/domains/update-record-s-r-v.md +0 -21
- package/docs/examples/domains/update-record-t-x-t.md +0 -18
- package/src/enums/billing-plan.ts +0 -5
- package/src/enums/database-usage-range.ts +0 -5
- package/src/enums/function-usage-range.ts +0 -5
- package/src/enums/site-usage-range.ts +0 -5
- package/src/enums/storage-usage-range.ts +0 -5
- package/types/enums/billing-plan.d.ts +0 -5
- package/types/enums/database-usage-range.d.ts +0 -5
- package/types/enums/function-usage-range.d.ts +0 -5
- package/types/enums/storage-usage-range.d.ts +0 -5
- package/types/enums/user-usage-range.d.ts +0 -5
- /package/docs/examples/health/{get-d-b.md → get-db.md} +0 -0
- /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
- /package/src/enums/{s-m-t-p-secure.ts → smtp-secure.ts} +0 -0
- /package/src/enums/{v-c-s-detection-type.ts → vcs-detection-type.ts} +0 -0
- /package/types/enums/{s-m-t-p-secure.d.ts → smtp-secure.d.ts} +0 -0
- /package/types/enums/{v-c-s-detection-type.d.ts → vcs-detection-type.d.ts} +0 -0
package/src/services/account.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Service } from '../service';
|
|
2
2
|
import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
|
+
|
|
4
5
|
import { AuthenticatorType } from '../enums/authenticator-type';
|
|
5
6
|
import { AuthenticationFactor } from '../enums/authentication-factor';
|
|
6
7
|
import { OAuthProvider } from '../enums/o-auth-provider';
|
|
@@ -19,6 +20,7 @@ export class Account {
|
|
|
19
20
|
* @returns {Promise<Models.User<Preferences>>}
|
|
20
21
|
*/
|
|
21
22
|
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
23
|
+
|
|
22
24
|
const apiPath = '/account';
|
|
23
25
|
const payload: Payload = {};
|
|
24
26
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -37,14 +39,48 @@ export class Account {
|
|
|
37
39
|
/**
|
|
38
40
|
* Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
39
41
|
*
|
|
40
|
-
* @param {string} userId
|
|
41
|
-
* @param {string} email
|
|
42
|
-
* @param {string} password
|
|
43
|
-
* @param {string} name
|
|
42
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
43
|
+
* @param {string} params.email - User email.
|
|
44
|
+
* @param {string} params.password - New user password. Must be between 8 and 256 chars.
|
|
45
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
46
|
+
* @throws {AppwriteException}
|
|
47
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
48
|
+
*/
|
|
49
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>;
|
|
50
|
+
/**
|
|
51
|
+
* Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
52
|
+
*
|
|
53
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
54
|
+
* @param {string} email - User email.
|
|
55
|
+
* @param {string} password - New user password. Must be between 8 and 256 chars.
|
|
56
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
44
57
|
* @throws {AppwriteException}
|
|
45
58
|
* @returns {Promise<Models.User<Preferences>>}
|
|
59
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
46
60
|
*/
|
|
47
|
-
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences
|
|
61
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
|
|
62
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
63
|
+
paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string,
|
|
64
|
+
...rest: [(string)?, (string)?, (string)?]
|
|
65
|
+
): Promise<Models.User<Preferences>> {
|
|
66
|
+
let params: { userId: string, email: string, password: string, name?: string };
|
|
67
|
+
|
|
68
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
69
|
+
params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string };
|
|
70
|
+
} else {
|
|
71
|
+
params = {
|
|
72
|
+
userId: paramsOrFirst as string,
|
|
73
|
+
email: rest[0] as string,
|
|
74
|
+
password: rest[1] as string,
|
|
75
|
+
name: rest[2] as string
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const userId = params.userId;
|
|
80
|
+
const email = params.email;
|
|
81
|
+
const password = params.password;
|
|
82
|
+
const name = params.name;
|
|
83
|
+
|
|
48
84
|
if (typeof userId === 'undefined') {
|
|
49
85
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
50
86
|
}
|
|
@@ -54,6 +90,7 @@ export class Account {
|
|
|
54
90
|
if (typeof password === 'undefined') {
|
|
55
91
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
56
92
|
}
|
|
93
|
+
|
|
57
94
|
const apiPath = '/account';
|
|
58
95
|
const payload: Payload = {};
|
|
59
96
|
if (typeof userId !== 'undefined') {
|
|
@@ -89,6 +126,7 @@ export class Account {
|
|
|
89
126
|
* @returns {Promise<{}>}
|
|
90
127
|
*/
|
|
91
128
|
delete(): Promise<{}> {
|
|
129
|
+
|
|
92
130
|
const apiPath = '/account';
|
|
93
131
|
const payload: Payload = {};
|
|
94
132
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -108,11 +146,36 @@ export class Account {
|
|
|
108
146
|
/**
|
|
109
147
|
* List all billing addresses for a user.
|
|
110
148
|
*
|
|
111
|
-
* @param {string[]} queries
|
|
149
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
|
|
150
|
+
* @throws {AppwriteException}
|
|
151
|
+
* @returns {Promise<Models.BillingAddressList>}
|
|
152
|
+
*/
|
|
153
|
+
listBillingAddresses(params?: { queries?: string[] }): Promise<Models.BillingAddressList>;
|
|
154
|
+
/**
|
|
155
|
+
* List all billing addresses for a user.
|
|
156
|
+
*
|
|
157
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
|
|
112
158
|
* @throws {AppwriteException}
|
|
113
159
|
* @returns {Promise<Models.BillingAddressList>}
|
|
160
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
114
161
|
*/
|
|
115
|
-
listBillingAddresses(queries?: string[]): Promise<Models.BillingAddressList
|
|
162
|
+
listBillingAddresses(queries?: string[]): Promise<Models.BillingAddressList>;
|
|
163
|
+
listBillingAddresses(
|
|
164
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
165
|
+
): Promise<Models.BillingAddressList> {
|
|
166
|
+
let params: { queries?: string[] };
|
|
167
|
+
|
|
168
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
169
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
170
|
+
} else {
|
|
171
|
+
params = {
|
|
172
|
+
queries: paramsOrFirst as string[]
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const queries = params.queries;
|
|
177
|
+
|
|
178
|
+
|
|
116
179
|
const apiPath = '/account/billing-addresses';
|
|
117
180
|
const payload: Payload = {};
|
|
118
181
|
if (typeof queries !== 'undefined') {
|
|
@@ -132,40 +195,81 @@ export class Account {
|
|
|
132
195
|
}
|
|
133
196
|
|
|
134
197
|
/**
|
|
135
|
-
* Add a new billing address to a user
|
|
198
|
+
* Add a new billing address to a user's account.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} params.country - Country
|
|
201
|
+
* @param {string} params.city - City
|
|
202
|
+
* @param {string} params.streetAddress - Street address
|
|
203
|
+
* @param {string} params.addressLine2 - Address line 2
|
|
204
|
+
* @param {string} params.state - State or province
|
|
205
|
+
* @param {string} params.postalCode - Postal code
|
|
206
|
+
* @throws {AppwriteException}
|
|
207
|
+
* @returns {Promise<Models.BillingAddress>}
|
|
208
|
+
*/
|
|
209
|
+
createBillingAddress(params: { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string }): Promise<Models.BillingAddress>;
|
|
210
|
+
/**
|
|
211
|
+
* Add a new billing address to a user's account.
|
|
136
212
|
*
|
|
137
|
-
* @param {string} country
|
|
138
|
-
* @param {string}
|
|
139
|
-
* @param {string}
|
|
140
|
-
* @param {string}
|
|
141
|
-
* @param {string}
|
|
142
|
-
* @param {string}
|
|
213
|
+
* @param {string} country - Country
|
|
214
|
+
* @param {string} city - City
|
|
215
|
+
* @param {string} streetAddress - Street address
|
|
216
|
+
* @param {string} addressLine2 - Address line 2
|
|
217
|
+
* @param {string} state - State or province
|
|
218
|
+
* @param {string} postalCode - Postal code
|
|
143
219
|
* @throws {AppwriteException}
|
|
144
220
|
* @returns {Promise<Models.BillingAddress>}
|
|
221
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
145
222
|
*/
|
|
146
|
-
createBillingAddress(country: string,
|
|
223
|
+
createBillingAddress(country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string): Promise<Models.BillingAddress>;
|
|
224
|
+
createBillingAddress(
|
|
225
|
+
paramsOrFirst: { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string } | string,
|
|
226
|
+
...rest: [(string)?, (string)?, (string)?, (string)?, (string)?]
|
|
227
|
+
): Promise<Models.BillingAddress> {
|
|
228
|
+
let params: { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
|
|
229
|
+
|
|
230
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
231
|
+
params = (paramsOrFirst || {}) as { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
|
|
232
|
+
} else {
|
|
233
|
+
params = {
|
|
234
|
+
country: paramsOrFirst as string,
|
|
235
|
+
city: rest[0] as string,
|
|
236
|
+
streetAddress: rest[1] as string,
|
|
237
|
+
addressLine2: rest[2] as string,
|
|
238
|
+
state: rest[3] as string,
|
|
239
|
+
postalCode: rest[4] as string
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const country = params.country;
|
|
244
|
+
const city = params.city;
|
|
245
|
+
const streetAddress = params.streetAddress;
|
|
246
|
+
const addressLine2 = params.addressLine2;
|
|
247
|
+
const state = params.state;
|
|
248
|
+
const postalCode = params.postalCode;
|
|
249
|
+
|
|
147
250
|
if (typeof country === 'undefined') {
|
|
148
251
|
throw new AppwriteException('Missing required parameter: "country"');
|
|
149
252
|
}
|
|
150
|
-
if (typeof streetAddress === 'undefined') {
|
|
151
|
-
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
152
|
-
}
|
|
153
253
|
if (typeof city === 'undefined') {
|
|
154
254
|
throw new AppwriteException('Missing required parameter: "city"');
|
|
155
255
|
}
|
|
156
|
-
if (typeof
|
|
157
|
-
throw new AppwriteException('Missing required parameter: "
|
|
256
|
+
if (typeof streetAddress === 'undefined') {
|
|
257
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
158
258
|
}
|
|
259
|
+
|
|
159
260
|
const apiPath = '/account/billing-addresses';
|
|
160
261
|
const payload: Payload = {};
|
|
161
262
|
if (typeof country !== 'undefined') {
|
|
162
263
|
payload['country'] = country;
|
|
163
264
|
}
|
|
265
|
+
if (typeof city !== 'undefined') {
|
|
266
|
+
payload['city'] = city;
|
|
267
|
+
}
|
|
164
268
|
if (typeof streetAddress !== 'undefined') {
|
|
165
269
|
payload['streetAddress'] = streetAddress;
|
|
166
270
|
}
|
|
167
|
-
if (typeof
|
|
168
|
-
payload['
|
|
271
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
272
|
+
payload['addressLine2'] = addressLine2;
|
|
169
273
|
}
|
|
170
274
|
if (typeof state !== 'undefined') {
|
|
171
275
|
payload['state'] = state;
|
|
@@ -173,9 +277,6 @@ export class Account {
|
|
|
173
277
|
if (typeof postalCode !== 'undefined') {
|
|
174
278
|
payload['postalCode'] = postalCode;
|
|
175
279
|
}
|
|
176
|
-
if (typeof addressLine2 !== 'undefined') {
|
|
177
|
-
payload['addressLine2'] = addressLine2;
|
|
178
|
-
}
|
|
179
280
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
180
281
|
|
|
181
282
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -191,16 +292,41 @@ export class Account {
|
|
|
191
292
|
}
|
|
192
293
|
|
|
193
294
|
/**
|
|
194
|
-
* Get a specific billing address for a user using it
|
|
295
|
+
* Get a specific billing address for a user using it's ID.
|
|
296
|
+
*
|
|
297
|
+
* @param {string} params.billingAddressId - Unique ID of billing address
|
|
298
|
+
* @throws {AppwriteException}
|
|
299
|
+
* @returns {Promise<Models.BillingAddress>}
|
|
300
|
+
*/
|
|
301
|
+
getBillingAddress(params: { billingAddressId: string }): Promise<Models.BillingAddress>;
|
|
302
|
+
/**
|
|
303
|
+
* Get a specific billing address for a user using it's ID.
|
|
195
304
|
*
|
|
196
|
-
* @param {string} billingAddressId
|
|
305
|
+
* @param {string} billingAddressId - Unique ID of billing address
|
|
197
306
|
* @throws {AppwriteException}
|
|
198
307
|
* @returns {Promise<Models.BillingAddress>}
|
|
308
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
199
309
|
*/
|
|
200
|
-
getBillingAddress(billingAddressId: string): Promise<Models.BillingAddress
|
|
310
|
+
getBillingAddress(billingAddressId: string): Promise<Models.BillingAddress>;
|
|
311
|
+
getBillingAddress(
|
|
312
|
+
paramsOrFirst: { billingAddressId: string } | string
|
|
313
|
+
): Promise<Models.BillingAddress> {
|
|
314
|
+
let params: { billingAddressId: string };
|
|
315
|
+
|
|
316
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
317
|
+
params = (paramsOrFirst || {}) as { billingAddressId: string };
|
|
318
|
+
} else {
|
|
319
|
+
params = {
|
|
320
|
+
billingAddressId: paramsOrFirst as string
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const billingAddressId = params.billingAddressId;
|
|
325
|
+
|
|
201
326
|
if (typeof billingAddressId === 'undefined') {
|
|
202
327
|
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
203
328
|
}
|
|
329
|
+
|
|
204
330
|
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
205
331
|
const payload: Payload = {};
|
|
206
332
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -217,44 +343,88 @@ export class Account {
|
|
|
217
343
|
}
|
|
218
344
|
|
|
219
345
|
/**
|
|
220
|
-
* Update a specific billing address using it
|
|
346
|
+
* Update a specific billing address using it's ID.
|
|
221
347
|
*
|
|
222
|
-
* @param {string} billingAddressId
|
|
223
|
-
* @param {string} country
|
|
224
|
-
* @param {string}
|
|
225
|
-
* @param {string}
|
|
226
|
-
* @param {string}
|
|
227
|
-
* @param {string}
|
|
228
|
-
* @param {string}
|
|
348
|
+
* @param {string} params.billingAddressId - Unique ID of billing address
|
|
349
|
+
* @param {string} params.country - Country
|
|
350
|
+
* @param {string} params.city - City
|
|
351
|
+
* @param {string} params.streetAddress - Street address
|
|
352
|
+
* @param {string} params.addressLine2 - Address line 2
|
|
353
|
+
* @param {string} params.state - State or province
|
|
354
|
+
* @param {string} params.postalCode - Postal code
|
|
229
355
|
* @throws {AppwriteException}
|
|
230
356
|
* @returns {Promise<Models.BillingAddress>}
|
|
231
357
|
*/
|
|
232
|
-
updateBillingAddress(billingAddressId: string, country: string,
|
|
358
|
+
updateBillingAddress(params: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string }): Promise<Models.BillingAddress>;
|
|
359
|
+
/**
|
|
360
|
+
* Update a specific billing address using it's ID.
|
|
361
|
+
*
|
|
362
|
+
* @param {string} billingAddressId - Unique ID of billing address
|
|
363
|
+
* @param {string} country - Country
|
|
364
|
+
* @param {string} city - City
|
|
365
|
+
* @param {string} streetAddress - Street address
|
|
366
|
+
* @param {string} addressLine2 - Address line 2
|
|
367
|
+
* @param {string} state - State or province
|
|
368
|
+
* @param {string} postalCode - Postal code
|
|
369
|
+
* @throws {AppwriteException}
|
|
370
|
+
* @returns {Promise<Models.BillingAddress>}
|
|
371
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
372
|
+
*/
|
|
373
|
+
updateBillingAddress(billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string): Promise<Models.BillingAddress>;
|
|
374
|
+
updateBillingAddress(
|
|
375
|
+
paramsOrFirst: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string } | string,
|
|
376
|
+
...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?]
|
|
377
|
+
): Promise<Models.BillingAddress> {
|
|
378
|
+
let params: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
|
|
379
|
+
|
|
380
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
381
|
+
params = (paramsOrFirst || {}) as { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
|
|
382
|
+
} else {
|
|
383
|
+
params = {
|
|
384
|
+
billingAddressId: paramsOrFirst as string,
|
|
385
|
+
country: rest[0] as string,
|
|
386
|
+
city: rest[1] as string,
|
|
387
|
+
streetAddress: rest[2] as string,
|
|
388
|
+
addressLine2: rest[3] as string,
|
|
389
|
+
state: rest[4] as string,
|
|
390
|
+
postalCode: rest[5] as string
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const billingAddressId = params.billingAddressId;
|
|
395
|
+
const country = params.country;
|
|
396
|
+
const city = params.city;
|
|
397
|
+
const streetAddress = params.streetAddress;
|
|
398
|
+
const addressLine2 = params.addressLine2;
|
|
399
|
+
const state = params.state;
|
|
400
|
+
const postalCode = params.postalCode;
|
|
401
|
+
|
|
233
402
|
if (typeof billingAddressId === 'undefined') {
|
|
234
403
|
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
235
404
|
}
|
|
236
405
|
if (typeof country === 'undefined') {
|
|
237
406
|
throw new AppwriteException('Missing required parameter: "country"');
|
|
238
407
|
}
|
|
239
|
-
if (typeof streetAddress === 'undefined') {
|
|
240
|
-
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
241
|
-
}
|
|
242
408
|
if (typeof city === 'undefined') {
|
|
243
409
|
throw new AppwriteException('Missing required parameter: "city"');
|
|
244
410
|
}
|
|
245
|
-
if (typeof
|
|
246
|
-
throw new AppwriteException('Missing required parameter: "
|
|
411
|
+
if (typeof streetAddress === 'undefined') {
|
|
412
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
247
413
|
}
|
|
414
|
+
|
|
248
415
|
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
249
416
|
const payload: Payload = {};
|
|
250
417
|
if (typeof country !== 'undefined') {
|
|
251
418
|
payload['country'] = country;
|
|
252
419
|
}
|
|
420
|
+
if (typeof city !== 'undefined') {
|
|
421
|
+
payload['city'] = city;
|
|
422
|
+
}
|
|
253
423
|
if (typeof streetAddress !== 'undefined') {
|
|
254
424
|
payload['streetAddress'] = streetAddress;
|
|
255
425
|
}
|
|
256
|
-
if (typeof
|
|
257
|
-
payload['
|
|
426
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
427
|
+
payload['addressLine2'] = addressLine2;
|
|
258
428
|
}
|
|
259
429
|
if (typeof state !== 'undefined') {
|
|
260
430
|
payload['state'] = state;
|
|
@@ -262,9 +432,6 @@ export class Account {
|
|
|
262
432
|
if (typeof postalCode !== 'undefined') {
|
|
263
433
|
payload['postalCode'] = postalCode;
|
|
264
434
|
}
|
|
265
|
-
if (typeof addressLine2 !== 'undefined') {
|
|
266
|
-
payload['addressLine2'] = addressLine2;
|
|
267
|
-
}
|
|
268
435
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
269
436
|
|
|
270
437
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -280,16 +447,41 @@ export class Account {
|
|
|
280
447
|
}
|
|
281
448
|
|
|
282
449
|
/**
|
|
283
|
-
* Delete a specific billing address using it
|
|
450
|
+
* Delete a specific billing address using it's ID.
|
|
451
|
+
*
|
|
452
|
+
* @param {string} params.billingAddressId - Billing address unique ID
|
|
453
|
+
* @throws {AppwriteException}
|
|
454
|
+
* @returns {Promise<{}>}
|
|
455
|
+
*/
|
|
456
|
+
deleteBillingAddress(params: { billingAddressId: string }): Promise<{}>;
|
|
457
|
+
/**
|
|
458
|
+
* Delete a specific billing address using it's ID.
|
|
284
459
|
*
|
|
285
|
-
* @param {string} billingAddressId
|
|
460
|
+
* @param {string} billingAddressId - Billing address unique ID
|
|
286
461
|
* @throws {AppwriteException}
|
|
287
462
|
* @returns {Promise<{}>}
|
|
463
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
288
464
|
*/
|
|
289
|
-
deleteBillingAddress(billingAddressId: string): Promise<{}
|
|
465
|
+
deleteBillingAddress(billingAddressId: string): Promise<{}>;
|
|
466
|
+
deleteBillingAddress(
|
|
467
|
+
paramsOrFirst: { billingAddressId: string } | string
|
|
468
|
+
): Promise<{}> {
|
|
469
|
+
let params: { billingAddressId: string };
|
|
470
|
+
|
|
471
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
472
|
+
params = (paramsOrFirst || {}) as { billingAddressId: string };
|
|
473
|
+
} else {
|
|
474
|
+
params = {
|
|
475
|
+
billingAddressId: paramsOrFirst as string
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const billingAddressId = params.billingAddressId;
|
|
480
|
+
|
|
290
481
|
if (typeof billingAddressId === 'undefined') {
|
|
291
482
|
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
292
483
|
}
|
|
484
|
+
|
|
293
485
|
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
294
486
|
const payload: Payload = {};
|
|
295
487
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -309,14 +501,39 @@ export class Account {
|
|
|
309
501
|
/**
|
|
310
502
|
* Get coupon details for an account.
|
|
311
503
|
*
|
|
312
|
-
* @param {string} couponId
|
|
504
|
+
* @param {string} params.couponId - ID of the coupon
|
|
505
|
+
* @throws {AppwriteException}
|
|
506
|
+
* @returns {Promise<Models.Coupon>}
|
|
507
|
+
*/
|
|
508
|
+
getCoupon(params: { couponId: string }): Promise<Models.Coupon>;
|
|
509
|
+
/**
|
|
510
|
+
* Get coupon details for an account.
|
|
511
|
+
*
|
|
512
|
+
* @param {string} couponId - ID of the coupon
|
|
313
513
|
* @throws {AppwriteException}
|
|
314
514
|
* @returns {Promise<Models.Coupon>}
|
|
515
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
315
516
|
*/
|
|
316
|
-
getCoupon(couponId: string): Promise<Models.Coupon
|
|
517
|
+
getCoupon(couponId: string): Promise<Models.Coupon>;
|
|
518
|
+
getCoupon(
|
|
519
|
+
paramsOrFirst: { couponId: string } | string
|
|
520
|
+
): Promise<Models.Coupon> {
|
|
521
|
+
let params: { couponId: string };
|
|
522
|
+
|
|
523
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
524
|
+
params = (paramsOrFirst || {}) as { couponId: string };
|
|
525
|
+
} else {
|
|
526
|
+
params = {
|
|
527
|
+
couponId: paramsOrFirst as string
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
const couponId = params.couponId;
|
|
532
|
+
|
|
317
533
|
if (typeof couponId === 'undefined') {
|
|
318
534
|
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
319
535
|
}
|
|
536
|
+
|
|
320
537
|
const apiPath = '/account/coupons/{couponId}'.replace('{couponId}', couponId);
|
|
321
538
|
const payload: Payload = {};
|
|
322
539
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -337,18 +554,49 @@ export class Account {
|
|
|
337
554
|
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
338
555
|
*
|
|
339
556
|
*
|
|
340
|
-
* @param {string} email
|
|
341
|
-
* @param {string} password
|
|
557
|
+
* @param {string} params.email - User email.
|
|
558
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
559
|
+
* @throws {AppwriteException}
|
|
560
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
561
|
+
*/
|
|
562
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { email: string, password: string }): Promise<Models.User<Preferences>>;
|
|
563
|
+
/**
|
|
564
|
+
* Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
|
|
565
|
+
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
566
|
+
*
|
|
567
|
+
*
|
|
568
|
+
* @param {string} email - User email.
|
|
569
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
342
570
|
* @throws {AppwriteException}
|
|
343
571
|
* @returns {Promise<Models.User<Preferences>>}
|
|
572
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
344
573
|
*/
|
|
345
|
-
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences
|
|
574
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>;
|
|
575
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
576
|
+
paramsOrFirst: { email: string, password: string } | string,
|
|
577
|
+
...rest: [(string)?]
|
|
578
|
+
): Promise<Models.User<Preferences>> {
|
|
579
|
+
let params: { email: string, password: string };
|
|
580
|
+
|
|
581
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
582
|
+
params = (paramsOrFirst || {}) as { email: string, password: string };
|
|
583
|
+
} else {
|
|
584
|
+
params = {
|
|
585
|
+
email: paramsOrFirst as string,
|
|
586
|
+
password: rest[0] as string
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
const email = params.email;
|
|
591
|
+
const password = params.password;
|
|
592
|
+
|
|
346
593
|
if (typeof email === 'undefined') {
|
|
347
594
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
348
595
|
}
|
|
349
596
|
if (typeof password === 'undefined') {
|
|
350
597
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
351
598
|
}
|
|
599
|
+
|
|
352
600
|
const apiPath = '/account/email';
|
|
353
601
|
const payload: Payload = {};
|
|
354
602
|
if (typeof email !== 'undefined') {
|
|
@@ -374,16 +622,49 @@ export class Account {
|
|
|
374
622
|
/**
|
|
375
623
|
* Get the list of identities for the currently logged in user.
|
|
376
624
|
*
|
|
377
|
-
* @param {string[]} queries
|
|
625
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
626
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
627
|
+
* @throws {AppwriteException}
|
|
628
|
+
* @returns {Promise<Models.IdentityList>}
|
|
629
|
+
*/
|
|
630
|
+
listIdentities(params?: { queries?: string[], total?: boolean }): Promise<Models.IdentityList>;
|
|
631
|
+
/**
|
|
632
|
+
* Get the list of identities for the currently logged in user.
|
|
633
|
+
*
|
|
634
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
635
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
378
636
|
* @throws {AppwriteException}
|
|
379
637
|
* @returns {Promise<Models.IdentityList>}
|
|
638
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
380
639
|
*/
|
|
381
|
-
listIdentities(queries?: string[]): Promise<Models.IdentityList
|
|
640
|
+
listIdentities(queries?: string[], total?: boolean): Promise<Models.IdentityList>;
|
|
641
|
+
listIdentities(
|
|
642
|
+
paramsOrFirst?: { queries?: string[], total?: boolean } | string[],
|
|
643
|
+
...rest: [(boolean)?]
|
|
644
|
+
): Promise<Models.IdentityList> {
|
|
645
|
+
let params: { queries?: string[], total?: boolean };
|
|
646
|
+
|
|
647
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
648
|
+
params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean };
|
|
649
|
+
} else {
|
|
650
|
+
params = {
|
|
651
|
+
queries: paramsOrFirst as string[],
|
|
652
|
+
total: rest[0] as boolean
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const queries = params.queries;
|
|
657
|
+
const total = params.total;
|
|
658
|
+
|
|
659
|
+
|
|
382
660
|
const apiPath = '/account/identities';
|
|
383
661
|
const payload: Payload = {};
|
|
384
662
|
if (typeof queries !== 'undefined') {
|
|
385
663
|
payload['queries'] = queries;
|
|
386
664
|
}
|
|
665
|
+
if (typeof total !== 'undefined') {
|
|
666
|
+
payload['total'] = total;
|
|
667
|
+
}
|
|
387
668
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
388
669
|
|
|
389
670
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -400,14 +681,39 @@ export class Account {
|
|
|
400
681
|
/**
|
|
401
682
|
* Delete an identity by its unique ID.
|
|
402
683
|
*
|
|
403
|
-
* @param {string} identityId
|
|
684
|
+
* @param {string} params.identityId - Identity ID.
|
|
685
|
+
* @throws {AppwriteException}
|
|
686
|
+
* @returns {Promise<{}>}
|
|
687
|
+
*/
|
|
688
|
+
deleteIdentity(params: { identityId: string }): Promise<{}>;
|
|
689
|
+
/**
|
|
690
|
+
* Delete an identity by its unique ID.
|
|
691
|
+
*
|
|
692
|
+
* @param {string} identityId - Identity ID.
|
|
404
693
|
* @throws {AppwriteException}
|
|
405
694
|
* @returns {Promise<{}>}
|
|
695
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
406
696
|
*/
|
|
407
|
-
deleteIdentity(identityId: string): Promise<{}
|
|
697
|
+
deleteIdentity(identityId: string): Promise<{}>;
|
|
698
|
+
deleteIdentity(
|
|
699
|
+
paramsOrFirst: { identityId: string } | string
|
|
700
|
+
): Promise<{}> {
|
|
701
|
+
let params: { identityId: string };
|
|
702
|
+
|
|
703
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
704
|
+
params = (paramsOrFirst || {}) as { identityId: string };
|
|
705
|
+
} else {
|
|
706
|
+
params = {
|
|
707
|
+
identityId: paramsOrFirst as string
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const identityId = params.identityId;
|
|
712
|
+
|
|
408
713
|
if (typeof identityId === 'undefined') {
|
|
409
714
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
410
715
|
}
|
|
716
|
+
|
|
411
717
|
const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
|
|
412
718
|
const payload: Payload = {};
|
|
413
719
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -427,11 +733,36 @@ export class Account {
|
|
|
427
733
|
/**
|
|
428
734
|
* List all invoices tied to an account.
|
|
429
735
|
*
|
|
430
|
-
* @param {string[]} queries
|
|
736
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, amount, currency, from, to, dueAt, attempts, status, grossAmount
|
|
431
737
|
* @throws {AppwriteException}
|
|
432
738
|
* @returns {Promise<Models.InvoiceList>}
|
|
433
739
|
*/
|
|
434
|
-
listInvoices(queries?: string[]): Promise<Models.InvoiceList
|
|
740
|
+
listInvoices(params?: { queries?: string[] }): Promise<Models.InvoiceList>;
|
|
741
|
+
/**
|
|
742
|
+
* List all invoices tied to an account.
|
|
743
|
+
*
|
|
744
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, amount, currency, from, to, dueAt, attempts, status, grossAmount
|
|
745
|
+
* @throws {AppwriteException}
|
|
746
|
+
* @returns {Promise<Models.InvoiceList>}
|
|
747
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
748
|
+
*/
|
|
749
|
+
listInvoices(queries?: string[]): Promise<Models.InvoiceList>;
|
|
750
|
+
listInvoices(
|
|
751
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
752
|
+
): Promise<Models.InvoiceList> {
|
|
753
|
+
let params: { queries?: string[] };
|
|
754
|
+
|
|
755
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
756
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
757
|
+
} else {
|
|
758
|
+
params = {
|
|
759
|
+
queries: paramsOrFirst as string[]
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const queries = params.queries;
|
|
764
|
+
|
|
765
|
+
|
|
435
766
|
const apiPath = '/account/invoices';
|
|
436
767
|
const payload: Payload = {};
|
|
437
768
|
if (typeof queries !== 'undefined') {
|
|
@@ -453,12 +784,41 @@ export class Account {
|
|
|
453
784
|
/**
|
|
454
785
|
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
|
|
455
786
|
*
|
|
787
|
+
* @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
|
788
|
+
* @throws {AppwriteException}
|
|
789
|
+
* @returns {Promise<Models.Jwt>}
|
|
790
|
+
*/
|
|
791
|
+
createJWT(params?: { duration?: number }): Promise<Models.Jwt>;
|
|
792
|
+
/**
|
|
793
|
+
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
|
|
794
|
+
*
|
|
795
|
+
* @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
|
456
796
|
* @throws {AppwriteException}
|
|
457
797
|
* @returns {Promise<Models.Jwt>}
|
|
798
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
458
799
|
*/
|
|
459
|
-
createJWT(): Promise<Models.Jwt
|
|
800
|
+
createJWT(duration?: number): Promise<Models.Jwt>;
|
|
801
|
+
createJWT(
|
|
802
|
+
paramsOrFirst?: { duration?: number } | number
|
|
803
|
+
): Promise<Models.Jwt> {
|
|
804
|
+
let params: { duration?: number };
|
|
805
|
+
|
|
806
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
807
|
+
params = (paramsOrFirst || {}) as { duration?: number };
|
|
808
|
+
} else {
|
|
809
|
+
params = {
|
|
810
|
+
duration: paramsOrFirst as number
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
const duration = params.duration;
|
|
815
|
+
|
|
816
|
+
|
|
460
817
|
const apiPath = '/account/jwts';
|
|
461
818
|
const payload: Payload = {};
|
|
819
|
+
if (typeof duration !== 'undefined') {
|
|
820
|
+
payload['duration'] = duration;
|
|
821
|
+
}
|
|
462
822
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
463
823
|
|
|
464
824
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -476,16 +836,49 @@ export class Account {
|
|
|
476
836
|
/**
|
|
477
837
|
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
478
838
|
*
|
|
479
|
-
* @param {string[]} queries
|
|
839
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
840
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
841
|
+
* @throws {AppwriteException}
|
|
842
|
+
* @returns {Promise<Models.LogList>}
|
|
843
|
+
*/
|
|
844
|
+
listLogs(params?: { queries?: string[], total?: boolean }): Promise<Models.LogList>;
|
|
845
|
+
/**
|
|
846
|
+
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
847
|
+
*
|
|
848
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
849
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
480
850
|
* @throws {AppwriteException}
|
|
481
851
|
* @returns {Promise<Models.LogList>}
|
|
852
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
482
853
|
*/
|
|
483
|
-
listLogs(queries?: string[]): Promise<Models.LogList
|
|
854
|
+
listLogs(queries?: string[], total?: boolean): Promise<Models.LogList>;
|
|
855
|
+
listLogs(
|
|
856
|
+
paramsOrFirst?: { queries?: string[], total?: boolean } | string[],
|
|
857
|
+
...rest: [(boolean)?]
|
|
858
|
+
): Promise<Models.LogList> {
|
|
859
|
+
let params: { queries?: string[], total?: boolean };
|
|
860
|
+
|
|
861
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
862
|
+
params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean };
|
|
863
|
+
} else {
|
|
864
|
+
params = {
|
|
865
|
+
queries: paramsOrFirst as string[],
|
|
866
|
+
total: rest[0] as boolean
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
const queries = params.queries;
|
|
871
|
+
const total = params.total;
|
|
872
|
+
|
|
873
|
+
|
|
484
874
|
const apiPath = '/account/logs';
|
|
485
875
|
const payload: Payload = {};
|
|
486
876
|
if (typeof queries !== 'undefined') {
|
|
487
877
|
payload['queries'] = queries;
|
|
488
878
|
}
|
|
879
|
+
if (typeof total !== 'undefined') {
|
|
880
|
+
payload['total'] = total;
|
|
881
|
+
}
|
|
489
882
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
490
883
|
|
|
491
884
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -502,14 +895,39 @@ export class Account {
|
|
|
502
895
|
/**
|
|
503
896
|
* Enable or disable MFA on an account.
|
|
504
897
|
*
|
|
505
|
-
* @param {boolean} mfa
|
|
898
|
+
* @param {boolean} params.mfa - Enable or disable MFA.
|
|
899
|
+
* @throws {AppwriteException}
|
|
900
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
901
|
+
*/
|
|
902
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { mfa: boolean }): Promise<Models.User<Preferences>>;
|
|
903
|
+
/**
|
|
904
|
+
* Enable or disable MFA on an account.
|
|
905
|
+
*
|
|
906
|
+
* @param {boolean} mfa - Enable or disable MFA.
|
|
506
907
|
* @throws {AppwriteException}
|
|
507
908
|
* @returns {Promise<Models.User<Preferences>>}
|
|
909
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
508
910
|
*/
|
|
509
|
-
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences
|
|
911
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>;
|
|
912
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
913
|
+
paramsOrFirst: { mfa: boolean } | boolean
|
|
914
|
+
): Promise<Models.User<Preferences>> {
|
|
915
|
+
let params: { mfa: boolean };
|
|
916
|
+
|
|
917
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
918
|
+
params = (paramsOrFirst || {}) as { mfa: boolean };
|
|
919
|
+
} else {
|
|
920
|
+
params = {
|
|
921
|
+
mfa: paramsOrFirst as boolean
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
const mfa = params.mfa;
|
|
926
|
+
|
|
510
927
|
if (typeof mfa === 'undefined') {
|
|
511
928
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
512
929
|
}
|
|
930
|
+
|
|
513
931
|
const apiPath = '/account/mfa';
|
|
514
932
|
const payload: Payload = {};
|
|
515
933
|
if (typeof mfa !== 'undefined') {
|
|
@@ -532,14 +950,40 @@ export class Account {
|
|
|
532
950
|
/**
|
|
533
951
|
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
534
952
|
*
|
|
535
|
-
* @param {AuthenticatorType} type
|
|
953
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
954
|
+
* @throws {AppwriteException}
|
|
955
|
+
* @returns {Promise<Models.MfaType>}
|
|
956
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.
|
|
957
|
+
*/
|
|
958
|
+
createMfaAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>;
|
|
959
|
+
/**
|
|
960
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
961
|
+
*
|
|
962
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
536
963
|
* @throws {AppwriteException}
|
|
537
964
|
* @returns {Promise<Models.MfaType>}
|
|
965
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
538
966
|
*/
|
|
539
|
-
createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType
|
|
967
|
+
createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
|
|
968
|
+
createMfaAuthenticator(
|
|
969
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
970
|
+
): Promise<Models.MfaType> {
|
|
971
|
+
let params: { type: AuthenticatorType };
|
|
972
|
+
|
|
973
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
974
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
975
|
+
} else {
|
|
976
|
+
params = {
|
|
977
|
+
type: paramsOrFirst as AuthenticatorType
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const type = params.type;
|
|
982
|
+
|
|
540
983
|
if (typeof type === 'undefined') {
|
|
541
984
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
542
985
|
}
|
|
986
|
+
|
|
543
987
|
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
544
988
|
const payload: Payload = {};
|
|
545
989
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -557,25 +1001,43 @@ export class Account {
|
|
|
557
1001
|
}
|
|
558
1002
|
|
|
559
1003
|
/**
|
|
560
|
-
*
|
|
1004
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
561
1005
|
*
|
|
562
|
-
* @param {AuthenticatorType} type
|
|
563
|
-
* @param {string} otp
|
|
1006
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
564
1007
|
* @throws {AppwriteException}
|
|
565
|
-
* @returns {Promise<Models.
|
|
1008
|
+
* @returns {Promise<Models.MfaType>}
|
|
1009
|
+
*/
|
|
1010
|
+
createMFAAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
1013
|
+
*
|
|
1014
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
1015
|
+
* @throws {AppwriteException}
|
|
1016
|
+
* @returns {Promise<Models.MfaType>}
|
|
1017
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
566
1018
|
*/
|
|
567
|
-
|
|
1019
|
+
createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
|
|
1020
|
+
createMFAAuthenticator(
|
|
1021
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
1022
|
+
): Promise<Models.MfaType> {
|
|
1023
|
+
let params: { type: AuthenticatorType };
|
|
1024
|
+
|
|
1025
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
1026
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
1027
|
+
} else {
|
|
1028
|
+
params = {
|
|
1029
|
+
type: paramsOrFirst as AuthenticatorType
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
const type = params.type;
|
|
1034
|
+
|
|
568
1035
|
if (typeof type === 'undefined') {
|
|
569
1036
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
570
1037
|
}
|
|
571
|
-
|
|
572
|
-
throw new AppwriteException('Missing required parameter: "otp"');
|
|
573
|
-
}
|
|
1038
|
+
|
|
574
1039
|
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
575
1040
|
const payload: Payload = {};
|
|
576
|
-
if (typeof otp !== 'undefined') {
|
|
577
|
-
payload['otp'] = otp;
|
|
578
|
-
}
|
|
579
1041
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
580
1042
|
|
|
581
1043
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -583,7 +1045,7 @@ export class Account {
|
|
|
583
1045
|
}
|
|
584
1046
|
|
|
585
1047
|
return this.client.call(
|
|
586
|
-
'
|
|
1048
|
+
'post',
|
|
587
1049
|
uri,
|
|
588
1050
|
apiHeaders,
|
|
589
1051
|
payload
|
|
@@ -591,19 +1053,172 @@ export class Account {
|
|
|
591
1053
|
}
|
|
592
1054
|
|
|
593
1055
|
/**
|
|
594
|
-
*
|
|
1056
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
595
1057
|
*
|
|
596
|
-
* @param {AuthenticatorType} type
|
|
1058
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
1059
|
+
* @param {string} params.otp - Valid verification token.
|
|
597
1060
|
* @throws {AppwriteException}
|
|
598
|
-
* @returns {Promise<
|
|
1061
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1062
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.
|
|
1063
|
+
*/
|
|
1064
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
1067
|
+
*
|
|
1068
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
1069
|
+
* @param {string} otp - Valid verification token.
|
|
1070
|
+
* @throws {AppwriteException}
|
|
1071
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1072
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
599
1073
|
*/
|
|
600
|
-
|
|
1074
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
|
|
1075
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1076
|
+
paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType,
|
|
1077
|
+
...rest: [(string)?]
|
|
1078
|
+
): Promise<Models.User<Preferences>> {
|
|
1079
|
+
let params: { type: AuthenticatorType, otp: string };
|
|
1080
|
+
|
|
1081
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
1082
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string };
|
|
1083
|
+
} else {
|
|
1084
|
+
params = {
|
|
1085
|
+
type: paramsOrFirst as AuthenticatorType,
|
|
1086
|
+
otp: rest[0] as string
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
const type = params.type;
|
|
1091
|
+
const otp = params.otp;
|
|
1092
|
+
|
|
601
1093
|
if (typeof type === 'undefined') {
|
|
602
1094
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
603
1095
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
1096
|
+
if (typeof otp === 'undefined') {
|
|
1097
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
1101
|
+
const payload: Payload = {};
|
|
1102
|
+
if (typeof otp !== 'undefined') {
|
|
1103
|
+
payload['otp'] = otp;
|
|
1104
|
+
}
|
|
1105
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1106
|
+
|
|
1107
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1108
|
+
'content-type': 'application/json',
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
return this.client.call(
|
|
1112
|
+
'put',
|
|
1113
|
+
uri,
|
|
1114
|
+
apiHeaders,
|
|
1115
|
+
payload
|
|
1116
|
+
);
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
1121
|
+
*
|
|
1122
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
1123
|
+
* @param {string} params.otp - Valid verification token.
|
|
1124
|
+
* @throws {AppwriteException}
|
|
1125
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1126
|
+
*/
|
|
1127
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
1130
|
+
*
|
|
1131
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
1132
|
+
* @param {string} otp - Valid verification token.
|
|
1133
|
+
* @throws {AppwriteException}
|
|
1134
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1135
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1136
|
+
*/
|
|
1137
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
|
|
1138
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1139
|
+
paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType,
|
|
1140
|
+
...rest: [(string)?]
|
|
1141
|
+
): Promise<Models.User<Preferences>> {
|
|
1142
|
+
let params: { type: AuthenticatorType, otp: string };
|
|
1143
|
+
|
|
1144
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
1145
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string };
|
|
1146
|
+
} else {
|
|
1147
|
+
params = {
|
|
1148
|
+
type: paramsOrFirst as AuthenticatorType,
|
|
1149
|
+
otp: rest[0] as string
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
const type = params.type;
|
|
1154
|
+
const otp = params.otp;
|
|
1155
|
+
|
|
1156
|
+
if (typeof type === 'undefined') {
|
|
1157
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
1158
|
+
}
|
|
1159
|
+
if (typeof otp === 'undefined') {
|
|
1160
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
1164
|
+
const payload: Payload = {};
|
|
1165
|
+
if (typeof otp !== 'undefined') {
|
|
1166
|
+
payload['otp'] = otp;
|
|
1167
|
+
}
|
|
1168
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1169
|
+
|
|
1170
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1171
|
+
'content-type': 'application/json',
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
return this.client.call(
|
|
1175
|
+
'put',
|
|
1176
|
+
uri,
|
|
1177
|
+
apiHeaders,
|
|
1178
|
+
payload
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Delete an authenticator for a user by ID.
|
|
1184
|
+
*
|
|
1185
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
1186
|
+
* @throws {AppwriteException}
|
|
1187
|
+
* @returns {Promise<{}>}
|
|
1188
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.
|
|
1189
|
+
*/
|
|
1190
|
+
deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Delete an authenticator for a user by ID.
|
|
1193
|
+
*
|
|
1194
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
1195
|
+
* @throws {AppwriteException}
|
|
1196
|
+
* @returns {Promise<{}>}
|
|
1197
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1198
|
+
*/
|
|
1199
|
+
deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
|
|
1200
|
+
deleteMfaAuthenticator(
|
|
1201
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
1202
|
+
): Promise<{}> {
|
|
1203
|
+
let params: { type: AuthenticatorType };
|
|
1204
|
+
|
|
1205
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
1206
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
1207
|
+
} else {
|
|
1208
|
+
params = {
|
|
1209
|
+
type: paramsOrFirst as AuthenticatorType
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
const type = params.type;
|
|
1214
|
+
|
|
1215
|
+
if (typeof type === 'undefined') {
|
|
1216
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
1220
|
+
const payload: Payload = {};
|
|
1221
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
607
1222
|
|
|
608
1223
|
const apiHeaders: { [header: string]: string } = {
|
|
609
1224
|
'content-type': 'application/json',
|
|
@@ -617,18 +1232,151 @@ export class Account {
|
|
|
617
1232
|
);
|
|
618
1233
|
}
|
|
619
1234
|
|
|
1235
|
+
/**
|
|
1236
|
+
* Delete an authenticator for a user by ID.
|
|
1237
|
+
*
|
|
1238
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
1239
|
+
* @throws {AppwriteException}
|
|
1240
|
+
* @returns {Promise<{}>}
|
|
1241
|
+
*/
|
|
1242
|
+
deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Delete an authenticator for a user by ID.
|
|
1245
|
+
*
|
|
1246
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
1247
|
+
* @throws {AppwriteException}
|
|
1248
|
+
* @returns {Promise<{}>}
|
|
1249
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1250
|
+
*/
|
|
1251
|
+
deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>;
|
|
1252
|
+
deleteMFAAuthenticator(
|
|
1253
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
1254
|
+
): Promise<{}> {
|
|
1255
|
+
let params: { type: AuthenticatorType };
|
|
1256
|
+
|
|
1257
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
1258
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
1259
|
+
} else {
|
|
1260
|
+
params = {
|
|
1261
|
+
type: paramsOrFirst as AuthenticatorType
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
const type = params.type;
|
|
1266
|
+
|
|
1267
|
+
if (typeof type === 'undefined') {
|
|
1268
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
1272
|
+
const payload: Payload = {};
|
|
1273
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1274
|
+
|
|
1275
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1276
|
+
'content-type': 'application/json',
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
return this.client.call(
|
|
1280
|
+
'delete',
|
|
1281
|
+
uri,
|
|
1282
|
+
apiHeaders,
|
|
1283
|
+
payload
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
1289
|
+
*
|
|
1290
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
1291
|
+
* @throws {AppwriteException}
|
|
1292
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
1293
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.
|
|
1294
|
+
*/
|
|
1295
|
+
createMfaChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
1298
|
+
*
|
|
1299
|
+
* @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
1300
|
+
* @throws {AppwriteException}
|
|
1301
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
1302
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1303
|
+
*/
|
|
1304
|
+
createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
|
|
1305
|
+
createMfaChallenge(
|
|
1306
|
+
paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor
|
|
1307
|
+
): Promise<Models.MfaChallenge> {
|
|
1308
|
+
let params: { factor: AuthenticationFactor };
|
|
1309
|
+
|
|
1310
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
1311
|
+
params = (paramsOrFirst || {}) as { factor: AuthenticationFactor };
|
|
1312
|
+
} else {
|
|
1313
|
+
params = {
|
|
1314
|
+
factor: paramsOrFirst as AuthenticationFactor
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
const factor = params.factor;
|
|
1319
|
+
|
|
1320
|
+
if (typeof factor === 'undefined') {
|
|
1321
|
+
throw new AppwriteException('Missing required parameter: "factor"');
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const apiPath = '/account/mfa/challenges';
|
|
1325
|
+
const payload: Payload = {};
|
|
1326
|
+
if (typeof factor !== 'undefined') {
|
|
1327
|
+
payload['factor'] = factor;
|
|
1328
|
+
}
|
|
1329
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1330
|
+
|
|
1331
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1332
|
+
'content-type': 'application/json',
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
return this.client.call(
|
|
1336
|
+
'post',
|
|
1337
|
+
uri,
|
|
1338
|
+
apiHeaders,
|
|
1339
|
+
payload
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
620
1343
|
/**
|
|
621
1344
|
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
622
1345
|
*
|
|
623
|
-
* @param {AuthenticationFactor} factor
|
|
1346
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
624
1347
|
* @throws {AppwriteException}
|
|
625
1348
|
* @returns {Promise<Models.MfaChallenge>}
|
|
626
1349
|
*/
|
|
627
|
-
|
|
1350
|
+
createMFAChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
1353
|
+
*
|
|
1354
|
+
* @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
1355
|
+
* @throws {AppwriteException}
|
|
1356
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
1357
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1358
|
+
*/
|
|
1359
|
+
createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
|
|
1360
|
+
createMFAChallenge(
|
|
1361
|
+
paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor
|
|
1362
|
+
): Promise<Models.MfaChallenge> {
|
|
1363
|
+
let params: { factor: AuthenticationFactor };
|
|
1364
|
+
|
|
1365
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
1366
|
+
params = (paramsOrFirst || {}) as { factor: AuthenticationFactor };
|
|
1367
|
+
} else {
|
|
1368
|
+
params = {
|
|
1369
|
+
factor: paramsOrFirst as AuthenticationFactor
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
const factor = params.factor;
|
|
1374
|
+
|
|
628
1375
|
if (typeof factor === 'undefined') {
|
|
629
1376
|
throw new AppwriteException('Missing required parameter: "factor"');
|
|
630
1377
|
}
|
|
631
|
-
|
|
1378
|
+
|
|
1379
|
+
const apiPath = '/account/mfa/challenges';
|
|
632
1380
|
const payload: Payload = {};
|
|
633
1381
|
if (typeof factor !== 'undefined') {
|
|
634
1382
|
payload['factor'] = factor;
|
|
@@ -650,34 +1398,224 @@ export class Account {
|
|
|
650
1398
|
/**
|
|
651
1399
|
* Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
652
1400
|
*
|
|
653
|
-
* @param {string} challengeId
|
|
654
|
-
* @param {string} otp
|
|
1401
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
1402
|
+
* @param {string} params.otp - Valid verification token.
|
|
1403
|
+
* @throws {AppwriteException}
|
|
1404
|
+
* @returns {Promise<Models.Session>}
|
|
1405
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.
|
|
1406
|
+
*/
|
|
1407
|
+
updateMfaChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
1410
|
+
*
|
|
1411
|
+
* @param {string} challengeId - ID of the challenge.
|
|
1412
|
+
* @param {string} otp - Valid verification token.
|
|
1413
|
+
* @throws {AppwriteException}
|
|
1414
|
+
* @returns {Promise<Models.Session>}
|
|
1415
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1416
|
+
*/
|
|
1417
|
+
updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
1418
|
+
updateMfaChallenge(
|
|
1419
|
+
paramsOrFirst: { challengeId: string, otp: string } | string,
|
|
1420
|
+
...rest: [(string)?]
|
|
1421
|
+
): Promise<Models.Session> {
|
|
1422
|
+
let params: { challengeId: string, otp: string };
|
|
1423
|
+
|
|
1424
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1425
|
+
params = (paramsOrFirst || {}) as { challengeId: string, otp: string };
|
|
1426
|
+
} else {
|
|
1427
|
+
params = {
|
|
1428
|
+
challengeId: paramsOrFirst as string,
|
|
1429
|
+
otp: rest[0] as string
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
const challengeId = params.challengeId;
|
|
1434
|
+
const otp = params.otp;
|
|
1435
|
+
|
|
1436
|
+
if (typeof challengeId === 'undefined') {
|
|
1437
|
+
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
1438
|
+
}
|
|
1439
|
+
if (typeof otp === 'undefined') {
|
|
1440
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
const apiPath = '/account/mfa/challenges';
|
|
1444
|
+
const payload: Payload = {};
|
|
1445
|
+
if (typeof challengeId !== 'undefined') {
|
|
1446
|
+
payload['challengeId'] = challengeId;
|
|
1447
|
+
}
|
|
1448
|
+
if (typeof otp !== 'undefined') {
|
|
1449
|
+
payload['otp'] = otp;
|
|
1450
|
+
}
|
|
1451
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1452
|
+
|
|
1453
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1454
|
+
'content-type': 'application/json',
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
return this.client.call(
|
|
1458
|
+
'put',
|
|
1459
|
+
uri,
|
|
1460
|
+
apiHeaders,
|
|
1461
|
+
payload
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
1467
|
+
*
|
|
1468
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
1469
|
+
* @param {string} params.otp - Valid verification token.
|
|
655
1470
|
* @throws {AppwriteException}
|
|
656
1471
|
* @returns {Promise<Models.Session>}
|
|
657
1472
|
*/
|
|
658
|
-
|
|
1473
|
+
updateMFAChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
1476
|
+
*
|
|
1477
|
+
* @param {string} challengeId - ID of the challenge.
|
|
1478
|
+
* @param {string} otp - Valid verification token.
|
|
1479
|
+
* @throws {AppwriteException}
|
|
1480
|
+
* @returns {Promise<Models.Session>}
|
|
1481
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1482
|
+
*/
|
|
1483
|
+
updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
1484
|
+
updateMFAChallenge(
|
|
1485
|
+
paramsOrFirst: { challengeId: string, otp: string } | string,
|
|
1486
|
+
...rest: [(string)?]
|
|
1487
|
+
): Promise<Models.Session> {
|
|
1488
|
+
let params: { challengeId: string, otp: string };
|
|
1489
|
+
|
|
1490
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1491
|
+
params = (paramsOrFirst || {}) as { challengeId: string, otp: string };
|
|
1492
|
+
} else {
|
|
1493
|
+
params = {
|
|
1494
|
+
challengeId: paramsOrFirst as string,
|
|
1495
|
+
otp: rest[0] as string
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
const challengeId = params.challengeId;
|
|
1500
|
+
const otp = params.otp;
|
|
1501
|
+
|
|
659
1502
|
if (typeof challengeId === 'undefined') {
|
|
660
1503
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
661
1504
|
}
|
|
662
1505
|
if (typeof otp === 'undefined') {
|
|
663
1506
|
throw new AppwriteException('Missing required parameter: "otp"');
|
|
664
1507
|
}
|
|
665
|
-
|
|
1508
|
+
|
|
1509
|
+
const apiPath = '/account/mfa/challenges';
|
|
1510
|
+
const payload: Payload = {};
|
|
1511
|
+
if (typeof challengeId !== 'undefined') {
|
|
1512
|
+
payload['challengeId'] = challengeId;
|
|
1513
|
+
}
|
|
1514
|
+
if (typeof otp !== 'undefined') {
|
|
1515
|
+
payload['otp'] = otp;
|
|
1516
|
+
}
|
|
1517
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1518
|
+
|
|
1519
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1520
|
+
'content-type': 'application/json',
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
return this.client.call(
|
|
1524
|
+
'put',
|
|
1525
|
+
uri,
|
|
1526
|
+
apiHeaders,
|
|
1527
|
+
payload
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
1533
|
+
*
|
|
1534
|
+
* @throws {AppwriteException}
|
|
1535
|
+
* @returns {Promise<Models.MfaFactors>}
|
|
1536
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
|
|
1537
|
+
*/
|
|
1538
|
+
listMfaFactors(): Promise<Models.MfaFactors> {
|
|
1539
|
+
|
|
1540
|
+
const apiPath = '/account/mfa/factors';
|
|
1541
|
+
const payload: Payload = {};
|
|
1542
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1543
|
+
|
|
1544
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
return this.client.call(
|
|
1548
|
+
'get',
|
|
1549
|
+
uri,
|
|
1550
|
+
apiHeaders,
|
|
1551
|
+
payload
|
|
1552
|
+
);
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
1557
|
+
*
|
|
1558
|
+
* @throws {AppwriteException}
|
|
1559
|
+
* @returns {Promise<Models.MfaFactors>}
|
|
1560
|
+
*/
|
|
1561
|
+
listMFAFactors(): Promise<Models.MfaFactors> {
|
|
1562
|
+
|
|
1563
|
+
const apiPath = '/account/mfa/factors';
|
|
1564
|
+
const payload: Payload = {};
|
|
1565
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1566
|
+
|
|
1567
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
return this.client.call(
|
|
1571
|
+
'get',
|
|
1572
|
+
uri,
|
|
1573
|
+
apiHeaders,
|
|
1574
|
+
payload
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
1580
|
+
*
|
|
1581
|
+
* @throws {AppwriteException}
|
|
1582
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
1583
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
|
|
1584
|
+
*/
|
|
1585
|
+
getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1586
|
+
|
|
1587
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
1588
|
+
const payload: Payload = {};
|
|
1589
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1590
|
+
|
|
1591
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
return this.client.call(
|
|
1595
|
+
'get',
|
|
1596
|
+
uri,
|
|
1597
|
+
apiHeaders,
|
|
1598
|
+
payload
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
1604
|
+
*
|
|
1605
|
+
* @throws {AppwriteException}
|
|
1606
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
1607
|
+
*/
|
|
1608
|
+
getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1609
|
+
|
|
1610
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
666
1611
|
const payload: Payload = {};
|
|
667
|
-
if (typeof challengeId !== 'undefined') {
|
|
668
|
-
payload['challengeId'] = challengeId;
|
|
669
|
-
}
|
|
670
|
-
if (typeof otp !== 'undefined') {
|
|
671
|
-
payload['otp'] = otp;
|
|
672
|
-
}
|
|
673
1612
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
674
1613
|
|
|
675
1614
|
const apiHeaders: { [header: string]: string } = {
|
|
676
|
-
'content-type': 'application/json',
|
|
677
1615
|
}
|
|
678
1616
|
|
|
679
1617
|
return this.client.call(
|
|
680
|
-
'
|
|
1618
|
+
'get',
|
|
681
1619
|
uri,
|
|
682
1620
|
apiHeaders,
|
|
683
1621
|
payload
|
|
@@ -685,21 +1623,24 @@ export class Account {
|
|
|
685
1623
|
}
|
|
686
1624
|
|
|
687
1625
|
/**
|
|
688
|
-
*
|
|
1626
|
+
* Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
689
1627
|
*
|
|
690
1628
|
* @throws {AppwriteException}
|
|
691
|
-
* @returns {Promise<Models.
|
|
1629
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
1630
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
|
|
692
1631
|
*/
|
|
693
|
-
|
|
694
|
-
|
|
1632
|
+
createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1633
|
+
|
|
1634
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
695
1635
|
const payload: Payload = {};
|
|
696
1636
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
697
1637
|
|
|
698
1638
|
const apiHeaders: { [header: string]: string } = {
|
|
1639
|
+
'content-type': 'application/json',
|
|
699
1640
|
}
|
|
700
1641
|
|
|
701
1642
|
return this.client.call(
|
|
702
|
-
'
|
|
1643
|
+
'post',
|
|
703
1644
|
uri,
|
|
704
1645
|
apiHeaders,
|
|
705
1646
|
payload
|
|
@@ -707,21 +1648,23 @@ export class Account {
|
|
|
707
1648
|
}
|
|
708
1649
|
|
|
709
1650
|
/**
|
|
710
|
-
*
|
|
1651
|
+
* Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
711
1652
|
*
|
|
712
1653
|
* @throws {AppwriteException}
|
|
713
1654
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
714
1655
|
*/
|
|
715
|
-
|
|
1656
|
+
createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1657
|
+
|
|
716
1658
|
const apiPath = '/account/mfa/recovery-codes';
|
|
717
1659
|
const payload: Payload = {};
|
|
718
1660
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
719
1661
|
|
|
720
1662
|
const apiHeaders: { [header: string]: string } = {
|
|
1663
|
+
'content-type': 'application/json',
|
|
721
1664
|
}
|
|
722
1665
|
|
|
723
1666
|
return this.client.call(
|
|
724
|
-
'
|
|
1667
|
+
'post',
|
|
725
1668
|
uri,
|
|
726
1669
|
apiHeaders,
|
|
727
1670
|
payload
|
|
@@ -729,12 +1672,14 @@ export class Account {
|
|
|
729
1672
|
}
|
|
730
1673
|
|
|
731
1674
|
/**
|
|
732
|
-
*
|
|
1675
|
+
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
|
|
733
1676
|
*
|
|
734
1677
|
* @throws {AppwriteException}
|
|
735
1678
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
1679
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
|
|
736
1680
|
*/
|
|
737
|
-
|
|
1681
|
+
updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1682
|
+
|
|
738
1683
|
const apiPath = '/account/mfa/recovery-codes';
|
|
739
1684
|
const payload: Payload = {};
|
|
740
1685
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -744,7 +1689,7 @@ export class Account {
|
|
|
744
1689
|
}
|
|
745
1690
|
|
|
746
1691
|
return this.client.call(
|
|
747
|
-
'
|
|
1692
|
+
'patch',
|
|
748
1693
|
uri,
|
|
749
1694
|
apiHeaders,
|
|
750
1695
|
payload
|
|
@@ -757,7 +1702,8 @@ export class Account {
|
|
|
757
1702
|
* @throws {AppwriteException}
|
|
758
1703
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
759
1704
|
*/
|
|
760
|
-
|
|
1705
|
+
updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1706
|
+
|
|
761
1707
|
const apiPath = '/account/mfa/recovery-codes';
|
|
762
1708
|
const payload: Payload = {};
|
|
763
1709
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -777,14 +1723,39 @@ export class Account {
|
|
|
777
1723
|
/**
|
|
778
1724
|
* Update currently logged in user account name.
|
|
779
1725
|
*
|
|
780
|
-
* @param {string} name
|
|
1726
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
781
1727
|
* @throws {AppwriteException}
|
|
782
1728
|
* @returns {Promise<Models.User<Preferences>>}
|
|
783
1729
|
*/
|
|
784
|
-
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences
|
|
1730
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { name: string }): Promise<Models.User<Preferences>>;
|
|
1731
|
+
/**
|
|
1732
|
+
* Update currently logged in user account name.
|
|
1733
|
+
*
|
|
1734
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
1735
|
+
* @throws {AppwriteException}
|
|
1736
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1737
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1738
|
+
*/
|
|
1739
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>;
|
|
1740
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1741
|
+
paramsOrFirst: { name: string } | string
|
|
1742
|
+
): Promise<Models.User<Preferences>> {
|
|
1743
|
+
let params: { name: string };
|
|
1744
|
+
|
|
1745
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1746
|
+
params = (paramsOrFirst || {}) as { name: string };
|
|
1747
|
+
} else {
|
|
1748
|
+
params = {
|
|
1749
|
+
name: paramsOrFirst as string
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
const name = params.name;
|
|
1754
|
+
|
|
785
1755
|
if (typeof name === 'undefined') {
|
|
786
1756
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
787
1757
|
}
|
|
1758
|
+
|
|
788
1759
|
const apiPath = '/account/name';
|
|
789
1760
|
const payload: Payload = {};
|
|
790
1761
|
if (typeof name !== 'undefined') {
|
|
@@ -807,15 +1778,44 @@ export class Account {
|
|
|
807
1778
|
/**
|
|
808
1779
|
* Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
809
1780
|
*
|
|
810
|
-
* @param {string} password
|
|
811
|
-
* @param {string} oldPassword
|
|
1781
|
+
* @param {string} params.password - New user password. Must be at least 8 chars.
|
|
1782
|
+
* @param {string} params.oldPassword - Current user password. Must be at least 8 chars.
|
|
1783
|
+
* @throws {AppwriteException}
|
|
1784
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1785
|
+
*/
|
|
1786
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { password: string, oldPassword?: string }): Promise<Models.User<Preferences>>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
1789
|
+
*
|
|
1790
|
+
* @param {string} password - New user password. Must be at least 8 chars.
|
|
1791
|
+
* @param {string} oldPassword - Current user password. Must be at least 8 chars.
|
|
812
1792
|
* @throws {AppwriteException}
|
|
813
1793
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1794
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
814
1795
|
*/
|
|
815
|
-
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences
|
|
1796
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
|
|
1797
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1798
|
+
paramsOrFirst: { password: string, oldPassword?: string } | string,
|
|
1799
|
+
...rest: [(string)?]
|
|
1800
|
+
): Promise<Models.User<Preferences>> {
|
|
1801
|
+
let params: { password: string, oldPassword?: string };
|
|
1802
|
+
|
|
1803
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1804
|
+
params = (paramsOrFirst || {}) as { password: string, oldPassword?: string };
|
|
1805
|
+
} else {
|
|
1806
|
+
params = {
|
|
1807
|
+
password: paramsOrFirst as string,
|
|
1808
|
+
oldPassword: rest[0] as string
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
const password = params.password;
|
|
1813
|
+
const oldPassword = params.oldPassword;
|
|
1814
|
+
|
|
816
1815
|
if (typeof password === 'undefined') {
|
|
817
1816
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
818
1817
|
}
|
|
1818
|
+
|
|
819
1819
|
const apiPath = '/account/password';
|
|
820
1820
|
const payload: Payload = {};
|
|
821
1821
|
if (typeof password !== 'undefined') {
|
|
@@ -841,11 +1841,36 @@ export class Account {
|
|
|
841
1841
|
/**
|
|
842
1842
|
* List payment methods for this account.
|
|
843
1843
|
*
|
|
844
|
-
* @param {string[]} queries
|
|
1844
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
|
|
845
1845
|
* @throws {AppwriteException}
|
|
846
1846
|
* @returns {Promise<Models.PaymentMethodList>}
|
|
847
1847
|
*/
|
|
848
|
-
listPaymentMethods(queries?: string[]): Promise<Models.PaymentMethodList
|
|
1848
|
+
listPaymentMethods(params?: { queries?: string[] }): Promise<Models.PaymentMethodList>;
|
|
1849
|
+
/**
|
|
1850
|
+
* List payment methods for this account.
|
|
1851
|
+
*
|
|
1852
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
|
|
1853
|
+
* @throws {AppwriteException}
|
|
1854
|
+
* @returns {Promise<Models.PaymentMethodList>}
|
|
1855
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1856
|
+
*/
|
|
1857
|
+
listPaymentMethods(queries?: string[]): Promise<Models.PaymentMethodList>;
|
|
1858
|
+
listPaymentMethods(
|
|
1859
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
1860
|
+
): Promise<Models.PaymentMethodList> {
|
|
1861
|
+
let params: { queries?: string[] };
|
|
1862
|
+
|
|
1863
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1864
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
1865
|
+
} else {
|
|
1866
|
+
params = {
|
|
1867
|
+
queries: paramsOrFirst as string[]
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
const queries = params.queries;
|
|
1872
|
+
|
|
1873
|
+
|
|
849
1874
|
const apiPath = '/account/payment-methods';
|
|
850
1875
|
const payload: Payload = {};
|
|
851
1876
|
if (typeof queries !== 'undefined') {
|
|
@@ -871,6 +1896,7 @@ export class Account {
|
|
|
871
1896
|
* @returns {Promise<Models.PaymentMethod>}
|
|
872
1897
|
*/
|
|
873
1898
|
createPaymentMethod(): Promise<Models.PaymentMethod> {
|
|
1899
|
+
|
|
874
1900
|
const apiPath = '/account/payment-methods';
|
|
875
1901
|
const payload: Payload = {};
|
|
876
1902
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -890,14 +1916,39 @@ export class Account {
|
|
|
890
1916
|
/**
|
|
891
1917
|
* Get a specific payment method for the user.
|
|
892
1918
|
*
|
|
893
|
-
* @param {string} paymentMethodId
|
|
1919
|
+
* @param {string} params.paymentMethodId - Unique ID of payment method
|
|
1920
|
+
* @throws {AppwriteException}
|
|
1921
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
1922
|
+
*/
|
|
1923
|
+
getPaymentMethod(params: { paymentMethodId: string }): Promise<Models.PaymentMethod>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Get a specific payment method for the user.
|
|
1926
|
+
*
|
|
1927
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
894
1928
|
* @throws {AppwriteException}
|
|
895
1929
|
* @returns {Promise<Models.PaymentMethod>}
|
|
1930
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
896
1931
|
*/
|
|
897
|
-
getPaymentMethod(paymentMethodId: string): Promise<Models.PaymentMethod
|
|
1932
|
+
getPaymentMethod(paymentMethodId: string): Promise<Models.PaymentMethod>;
|
|
1933
|
+
getPaymentMethod(
|
|
1934
|
+
paramsOrFirst: { paymentMethodId: string } | string
|
|
1935
|
+
): Promise<Models.PaymentMethod> {
|
|
1936
|
+
let params: { paymentMethodId: string };
|
|
1937
|
+
|
|
1938
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1939
|
+
params = (paramsOrFirst || {}) as { paymentMethodId: string };
|
|
1940
|
+
} else {
|
|
1941
|
+
params = {
|
|
1942
|
+
paymentMethodId: paramsOrFirst as string
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
const paymentMethodId = params.paymentMethodId;
|
|
1947
|
+
|
|
898
1948
|
if (typeof paymentMethodId === 'undefined') {
|
|
899
1949
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
900
1950
|
}
|
|
1951
|
+
|
|
901
1952
|
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
902
1953
|
const payload: Payload = {};
|
|
903
1954
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -916,13 +1967,48 @@ export class Account {
|
|
|
916
1967
|
/**
|
|
917
1968
|
* Update a new payment method for the current user account.
|
|
918
1969
|
*
|
|
919
|
-
* @param {string} paymentMethodId
|
|
920
|
-
* @param {number} expiryMonth
|
|
921
|
-
* @param {number} expiryYear
|
|
1970
|
+
* @param {string} params.paymentMethodId - Unique ID of payment method
|
|
1971
|
+
* @param {number} params.expiryMonth - Payment expiry month
|
|
1972
|
+
* @param {number} params.expiryYear - Expiry year
|
|
1973
|
+
* @param {string} params.state - State of the payment method country
|
|
1974
|
+
* @throws {AppwriteException}
|
|
1975
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
1976
|
+
*/
|
|
1977
|
+
updatePaymentMethod(params: { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string }): Promise<Models.PaymentMethod>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Update a new payment method for the current user account.
|
|
1980
|
+
*
|
|
1981
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
1982
|
+
* @param {number} expiryMonth - Payment expiry month
|
|
1983
|
+
* @param {number} expiryYear - Expiry year
|
|
1984
|
+
* @param {string} state - State of the payment method country
|
|
922
1985
|
* @throws {AppwriteException}
|
|
923
1986
|
* @returns {Promise<Models.PaymentMethod>}
|
|
1987
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
924
1988
|
*/
|
|
925
|
-
updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number): Promise<Models.PaymentMethod
|
|
1989
|
+
updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string): Promise<Models.PaymentMethod>;
|
|
1990
|
+
updatePaymentMethod(
|
|
1991
|
+
paramsOrFirst: { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string } | string,
|
|
1992
|
+
...rest: [(number)?, (number)?, (string)?]
|
|
1993
|
+
): Promise<Models.PaymentMethod> {
|
|
1994
|
+
let params: { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string };
|
|
1995
|
+
|
|
1996
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1997
|
+
params = (paramsOrFirst || {}) as { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string };
|
|
1998
|
+
} else {
|
|
1999
|
+
params = {
|
|
2000
|
+
paymentMethodId: paramsOrFirst as string,
|
|
2001
|
+
expiryMonth: rest[0] as number,
|
|
2002
|
+
expiryYear: rest[1] as number,
|
|
2003
|
+
state: rest[2] as string
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
const paymentMethodId = params.paymentMethodId;
|
|
2008
|
+
const expiryMonth = params.expiryMonth;
|
|
2009
|
+
const expiryYear = params.expiryYear;
|
|
2010
|
+
const state = params.state;
|
|
2011
|
+
|
|
926
2012
|
if (typeof paymentMethodId === 'undefined') {
|
|
927
2013
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
928
2014
|
}
|
|
@@ -932,6 +2018,7 @@ export class Account {
|
|
|
932
2018
|
if (typeof expiryYear === 'undefined') {
|
|
933
2019
|
throw new AppwriteException('Missing required parameter: "expiryYear"');
|
|
934
2020
|
}
|
|
2021
|
+
|
|
935
2022
|
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
936
2023
|
const payload: Payload = {};
|
|
937
2024
|
if (typeof expiryMonth !== 'undefined') {
|
|
@@ -940,6 +2027,9 @@ export class Account {
|
|
|
940
2027
|
if (typeof expiryYear !== 'undefined') {
|
|
941
2028
|
payload['expiryYear'] = expiryYear;
|
|
942
2029
|
}
|
|
2030
|
+
if (typeof state !== 'undefined') {
|
|
2031
|
+
payload['state'] = state;
|
|
2032
|
+
}
|
|
943
2033
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
944
2034
|
|
|
945
2035
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -955,16 +2045,41 @@ export class Account {
|
|
|
955
2045
|
}
|
|
956
2046
|
|
|
957
2047
|
/**
|
|
958
|
-
* Delete a specific payment method from a user
|
|
2048
|
+
* Delete a specific payment method from a user's account.
|
|
959
2049
|
*
|
|
960
|
-
* @param {string} paymentMethodId
|
|
2050
|
+
* @param {string} params.paymentMethodId - Unique ID of payment method
|
|
961
2051
|
* @throws {AppwriteException}
|
|
962
2052
|
* @returns {Promise<{}>}
|
|
963
2053
|
*/
|
|
964
|
-
deletePaymentMethod(paymentMethodId: string): Promise<{}
|
|
2054
|
+
deletePaymentMethod(params: { paymentMethodId: string }): Promise<{}>;
|
|
2055
|
+
/**
|
|
2056
|
+
* Delete a specific payment method from a user's account.
|
|
2057
|
+
*
|
|
2058
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
2059
|
+
* @throws {AppwriteException}
|
|
2060
|
+
* @returns {Promise<{}>}
|
|
2061
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2062
|
+
*/
|
|
2063
|
+
deletePaymentMethod(paymentMethodId: string): Promise<{}>;
|
|
2064
|
+
deletePaymentMethod(
|
|
2065
|
+
paramsOrFirst: { paymentMethodId: string } | string
|
|
2066
|
+
): Promise<{}> {
|
|
2067
|
+
let params: { paymentMethodId: string };
|
|
2068
|
+
|
|
2069
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2070
|
+
params = (paramsOrFirst || {}) as { paymentMethodId: string };
|
|
2071
|
+
} else {
|
|
2072
|
+
params = {
|
|
2073
|
+
paymentMethodId: paramsOrFirst as string
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
const paymentMethodId = params.paymentMethodId;
|
|
2078
|
+
|
|
965
2079
|
if (typeof paymentMethodId === 'undefined') {
|
|
966
2080
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
967
2081
|
}
|
|
2082
|
+
|
|
968
2083
|
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
969
2084
|
const payload: Payload = {};
|
|
970
2085
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -984,13 +2099,48 @@ export class Account {
|
|
|
984
2099
|
/**
|
|
985
2100
|
* Update payment method provider.
|
|
986
2101
|
*
|
|
987
|
-
* @param {string} paymentMethodId
|
|
988
|
-
* @param {string} providerMethodId
|
|
989
|
-
* @param {string} name
|
|
2102
|
+
* @param {string} params.paymentMethodId - Unique ID of payment method
|
|
2103
|
+
* @param {string} params.providerMethodId - Payment method ID from the payment provider
|
|
2104
|
+
* @param {string} params.name - Name in the payment method
|
|
2105
|
+
* @param {string} params.state - State of the payment method country
|
|
2106
|
+
* @throws {AppwriteException}
|
|
2107
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
2108
|
+
*/
|
|
2109
|
+
updatePaymentMethodProvider(params: { paymentMethodId: string, providerMethodId: string, name: string, state?: string }): Promise<Models.PaymentMethod>;
|
|
2110
|
+
/**
|
|
2111
|
+
* Update payment method provider.
|
|
2112
|
+
*
|
|
2113
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
2114
|
+
* @param {string} providerMethodId - Payment method ID from the payment provider
|
|
2115
|
+
* @param {string} name - Name in the payment method
|
|
2116
|
+
* @param {string} state - State of the payment method country
|
|
990
2117
|
* @throws {AppwriteException}
|
|
991
2118
|
* @returns {Promise<Models.PaymentMethod>}
|
|
2119
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
992
2120
|
*/
|
|
993
|
-
updatePaymentMethodProvider(paymentMethodId: string, providerMethodId: string, name: string): Promise<Models.PaymentMethod
|
|
2121
|
+
updatePaymentMethodProvider(paymentMethodId: string, providerMethodId: string, name: string, state?: string): Promise<Models.PaymentMethod>;
|
|
2122
|
+
updatePaymentMethodProvider(
|
|
2123
|
+
paramsOrFirst: { paymentMethodId: string, providerMethodId: string, name: string, state?: string } | string,
|
|
2124
|
+
...rest: [(string)?, (string)?, (string)?]
|
|
2125
|
+
): Promise<Models.PaymentMethod> {
|
|
2126
|
+
let params: { paymentMethodId: string, providerMethodId: string, name: string, state?: string };
|
|
2127
|
+
|
|
2128
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2129
|
+
params = (paramsOrFirst || {}) as { paymentMethodId: string, providerMethodId: string, name: string, state?: string };
|
|
2130
|
+
} else {
|
|
2131
|
+
params = {
|
|
2132
|
+
paymentMethodId: paramsOrFirst as string,
|
|
2133
|
+
providerMethodId: rest[0] as string,
|
|
2134
|
+
name: rest[1] as string,
|
|
2135
|
+
state: rest[2] as string
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
const paymentMethodId = params.paymentMethodId;
|
|
2140
|
+
const providerMethodId = params.providerMethodId;
|
|
2141
|
+
const name = params.name;
|
|
2142
|
+
const state = params.state;
|
|
2143
|
+
|
|
994
2144
|
if (typeof paymentMethodId === 'undefined') {
|
|
995
2145
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
996
2146
|
}
|
|
@@ -1000,6 +2150,7 @@ export class Account {
|
|
|
1000
2150
|
if (typeof name === 'undefined') {
|
|
1001
2151
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
1002
2152
|
}
|
|
2153
|
+
|
|
1003
2154
|
const apiPath = '/account/payment-methods/{paymentMethodId}/provider'.replace('{paymentMethodId}', paymentMethodId);
|
|
1004
2155
|
const payload: Payload = {};
|
|
1005
2156
|
if (typeof providerMethodId !== 'undefined') {
|
|
@@ -1008,6 +2159,9 @@ export class Account {
|
|
|
1008
2159
|
if (typeof name !== 'undefined') {
|
|
1009
2160
|
payload['name'] = name;
|
|
1010
2161
|
}
|
|
2162
|
+
if (typeof state !== 'undefined') {
|
|
2163
|
+
payload['state'] = state;
|
|
2164
|
+
}
|
|
1011
2165
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1012
2166
|
|
|
1013
2167
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -1025,14 +2179,39 @@ export class Account {
|
|
|
1025
2179
|
/**
|
|
1026
2180
|
* Update payment method mandate options.
|
|
1027
2181
|
*
|
|
1028
|
-
* @param {string} paymentMethodId
|
|
2182
|
+
* @param {string} params.paymentMethodId - Unique ID of payment method
|
|
2183
|
+
* @throws {AppwriteException}
|
|
2184
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
2185
|
+
*/
|
|
2186
|
+
updatePaymentMethodMandateOptions(params: { paymentMethodId: string }): Promise<Models.PaymentMethod>;
|
|
2187
|
+
/**
|
|
2188
|
+
* Update payment method mandate options.
|
|
2189
|
+
*
|
|
2190
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
1029
2191
|
* @throws {AppwriteException}
|
|
1030
2192
|
* @returns {Promise<Models.PaymentMethod>}
|
|
2193
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1031
2194
|
*/
|
|
1032
|
-
updatePaymentMethodMandateOptions(paymentMethodId: string): Promise<Models.PaymentMethod
|
|
2195
|
+
updatePaymentMethodMandateOptions(paymentMethodId: string): Promise<Models.PaymentMethod>;
|
|
2196
|
+
updatePaymentMethodMandateOptions(
|
|
2197
|
+
paramsOrFirst: { paymentMethodId: string } | string
|
|
2198
|
+
): Promise<Models.PaymentMethod> {
|
|
2199
|
+
let params: { paymentMethodId: string };
|
|
2200
|
+
|
|
2201
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2202
|
+
params = (paramsOrFirst || {}) as { paymentMethodId: string };
|
|
2203
|
+
} else {
|
|
2204
|
+
params = {
|
|
2205
|
+
paymentMethodId: paramsOrFirst as string
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
const paymentMethodId = params.paymentMethodId;
|
|
2210
|
+
|
|
1033
2211
|
if (typeof paymentMethodId === 'undefined') {
|
|
1034
2212
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
1035
2213
|
}
|
|
2214
|
+
|
|
1036
2215
|
const apiPath = '/account/payment-methods/{paymentMethodId}/setup'.replace('{paymentMethodId}', paymentMethodId);
|
|
1037
2216
|
const payload: Payload = {};
|
|
1038
2217
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1050,20 +2229,49 @@ export class Account {
|
|
|
1050
2229
|
}
|
|
1051
2230
|
|
|
1052
2231
|
/**
|
|
1053
|
-
* Update the currently logged in user
|
|
2232
|
+
* Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
2233
|
+
*
|
|
2234
|
+
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
2235
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
2236
|
+
* @throws {AppwriteException}
|
|
2237
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
2238
|
+
*/
|
|
2239
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { phone: string, password: string }): Promise<Models.User<Preferences>>;
|
|
2240
|
+
/**
|
|
2241
|
+
* Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
1054
2242
|
*
|
|
1055
|
-
* @param {string} phone
|
|
1056
|
-
* @param {string} password
|
|
2243
|
+
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
2244
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
1057
2245
|
* @throws {AppwriteException}
|
|
1058
2246
|
* @returns {Promise<Models.User<Preferences>>}
|
|
2247
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1059
2248
|
*/
|
|
1060
|
-
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences
|
|
2249
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
|
|
2250
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
2251
|
+
paramsOrFirst: { phone: string, password: string } | string,
|
|
2252
|
+
...rest: [(string)?]
|
|
2253
|
+
): Promise<Models.User<Preferences>> {
|
|
2254
|
+
let params: { phone: string, password: string };
|
|
2255
|
+
|
|
2256
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2257
|
+
params = (paramsOrFirst || {}) as { phone: string, password: string };
|
|
2258
|
+
} else {
|
|
2259
|
+
params = {
|
|
2260
|
+
phone: paramsOrFirst as string,
|
|
2261
|
+
password: rest[0] as string
|
|
2262
|
+
};
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
const phone = params.phone;
|
|
2266
|
+
const password = params.password;
|
|
2267
|
+
|
|
1061
2268
|
if (typeof phone === 'undefined') {
|
|
1062
2269
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1063
2270
|
}
|
|
1064
2271
|
if (typeof password === 'undefined') {
|
|
1065
2272
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
1066
2273
|
}
|
|
2274
|
+
|
|
1067
2275
|
const apiPath = '/account/phone';
|
|
1068
2276
|
const payload: Payload = {};
|
|
1069
2277
|
if (typeof phone !== 'undefined') {
|
|
@@ -1093,6 +2301,7 @@ export class Account {
|
|
|
1093
2301
|
* @returns {Promise<Preferences>}
|
|
1094
2302
|
*/
|
|
1095
2303
|
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> {
|
|
2304
|
+
|
|
1096
2305
|
const apiPath = '/account/prefs';
|
|
1097
2306
|
const payload: Payload = {};
|
|
1098
2307
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1111,14 +2320,39 @@ export class Account {
|
|
|
1111
2320
|
/**
|
|
1112
2321
|
* Update currently logged in user account preferences. 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.
|
|
1113
2322
|
*
|
|
1114
|
-
* @param {Partial<Preferences>} prefs
|
|
2323
|
+
* @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object.
|
|
2324
|
+
* @throws {AppwriteException}
|
|
2325
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
2326
|
+
*/
|
|
2327
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { prefs: Partial<Preferences> }): Promise<Models.User<Preferences>>;
|
|
2328
|
+
/**
|
|
2329
|
+
* Update currently logged in user account preferences. 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.
|
|
2330
|
+
*
|
|
2331
|
+
* @param {Partial<Preferences>} prefs - Prefs key-value JSON object.
|
|
1115
2332
|
* @throws {AppwriteException}
|
|
1116
2333
|
* @returns {Promise<Models.User<Preferences>>}
|
|
2334
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1117
2335
|
*/
|
|
1118
|
-
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences
|
|
2336
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
|
|
2337
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
2338
|
+
paramsOrFirst: { prefs: Partial<Preferences> } | Partial<Preferences>
|
|
2339
|
+
): Promise<Models.User<Preferences>> {
|
|
2340
|
+
let params: { prefs: Partial<Preferences> };
|
|
2341
|
+
|
|
2342
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
|
|
2343
|
+
params = (paramsOrFirst || {}) as { prefs: Partial<Preferences> };
|
|
2344
|
+
} else {
|
|
2345
|
+
params = {
|
|
2346
|
+
prefs: paramsOrFirst as Partial<Preferences>
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
const prefs = params.prefs;
|
|
2351
|
+
|
|
1119
2352
|
if (typeof prefs === 'undefined') {
|
|
1120
2353
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
1121
2354
|
}
|
|
2355
|
+
|
|
1122
2356
|
const apiPath = '/account/prefs';
|
|
1123
2357
|
const payload: Payload = {};
|
|
1124
2358
|
if (typeof prefs !== 'undefined') {
|
|
@@ -1139,20 +2373,49 @@ export class Account {
|
|
|
1139
2373
|
}
|
|
1140
2374
|
|
|
1141
2375
|
/**
|
|
1142
|
-
* Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user
|
|
2376
|
+
* Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
2377
|
+
*
|
|
2378
|
+
* @param {string} params.email - User email.
|
|
2379
|
+
* @param {string} params.url - URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2380
|
+
* @throws {AppwriteException}
|
|
2381
|
+
* @returns {Promise<Models.Token>}
|
|
2382
|
+
*/
|
|
2383
|
+
createRecovery(params: { email: string, url: string }): Promise<Models.Token>;
|
|
2384
|
+
/**
|
|
2385
|
+
* Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
1143
2386
|
*
|
|
1144
|
-
* @param {string} email
|
|
1145
|
-
* @param {string} url
|
|
2387
|
+
* @param {string} email - User email.
|
|
2388
|
+
* @param {string} url - URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1146
2389
|
* @throws {AppwriteException}
|
|
1147
2390
|
* @returns {Promise<Models.Token>}
|
|
2391
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1148
2392
|
*/
|
|
1149
|
-
createRecovery(email: string, url: string): Promise<Models.Token
|
|
2393
|
+
createRecovery(email: string, url: string): Promise<Models.Token>;
|
|
2394
|
+
createRecovery(
|
|
2395
|
+
paramsOrFirst: { email: string, url: string } | string,
|
|
2396
|
+
...rest: [(string)?]
|
|
2397
|
+
): Promise<Models.Token> {
|
|
2398
|
+
let params: { email: string, url: string };
|
|
2399
|
+
|
|
2400
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2401
|
+
params = (paramsOrFirst || {}) as { email: string, url: string };
|
|
2402
|
+
} else {
|
|
2403
|
+
params = {
|
|
2404
|
+
email: paramsOrFirst as string,
|
|
2405
|
+
url: rest[0] as string
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
const email = params.email;
|
|
2410
|
+
const url = params.url;
|
|
2411
|
+
|
|
1150
2412
|
if (typeof email === 'undefined') {
|
|
1151
2413
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1152
2414
|
}
|
|
1153
2415
|
if (typeof url === 'undefined') {
|
|
1154
2416
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1155
2417
|
}
|
|
2418
|
+
|
|
1156
2419
|
const apiPath = '/account/recovery';
|
|
1157
2420
|
const payload: Payload = {};
|
|
1158
2421
|
if (typeof email !== 'undefined') {
|
|
@@ -1180,13 +2443,46 @@ export class Account {
|
|
|
1180
2443
|
*
|
|
1181
2444
|
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
1182
2445
|
*
|
|
1183
|
-
* @param {string} userId
|
|
1184
|
-
* @param {string} secret
|
|
1185
|
-
* @param {string} password
|
|
2446
|
+
* @param {string} params.userId - User ID.
|
|
2447
|
+
* @param {string} params.secret - Valid reset token.
|
|
2448
|
+
* @param {string} params.password - New user password. Must be between 8 and 256 chars.
|
|
2449
|
+
* @throws {AppwriteException}
|
|
2450
|
+
* @returns {Promise<Models.Token>}
|
|
2451
|
+
*/
|
|
2452
|
+
updateRecovery(params: { userId: string, secret: string, password: string }): Promise<Models.Token>;
|
|
2453
|
+
/**
|
|
2454
|
+
* Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
|
|
2455
|
+
*
|
|
2456
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
2457
|
+
*
|
|
2458
|
+
* @param {string} userId - User ID.
|
|
2459
|
+
* @param {string} secret - Valid reset token.
|
|
2460
|
+
* @param {string} password - New user password. Must be between 8 and 256 chars.
|
|
1186
2461
|
* @throws {AppwriteException}
|
|
1187
2462
|
* @returns {Promise<Models.Token>}
|
|
2463
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1188
2464
|
*/
|
|
1189
|
-
updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token
|
|
2465
|
+
updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
|
|
2466
|
+
updateRecovery(
|
|
2467
|
+
paramsOrFirst: { userId: string, secret: string, password: string } | string,
|
|
2468
|
+
...rest: [(string)?, (string)?]
|
|
2469
|
+
): Promise<Models.Token> {
|
|
2470
|
+
let params: { userId: string, secret: string, password: string };
|
|
2471
|
+
|
|
2472
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2473
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string, password: string };
|
|
2474
|
+
} else {
|
|
2475
|
+
params = {
|
|
2476
|
+
userId: paramsOrFirst as string,
|
|
2477
|
+
secret: rest[0] as string,
|
|
2478
|
+
password: rest[1] as string
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
const userId = params.userId;
|
|
2483
|
+
const secret = params.secret;
|
|
2484
|
+
const password = params.password;
|
|
2485
|
+
|
|
1190
2486
|
if (typeof userId === 'undefined') {
|
|
1191
2487
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1192
2488
|
}
|
|
@@ -1196,6 +2492,7 @@ export class Account {
|
|
|
1196
2492
|
if (typeof password === 'undefined') {
|
|
1197
2493
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
1198
2494
|
}
|
|
2495
|
+
|
|
1199
2496
|
const apiPath = '/account/recovery';
|
|
1200
2497
|
const payload: Payload = {};
|
|
1201
2498
|
if (typeof userId !== 'undefined') {
|
|
@@ -1228,6 +2525,7 @@ export class Account {
|
|
|
1228
2525
|
* @returns {Promise<Models.SessionList>}
|
|
1229
2526
|
*/
|
|
1230
2527
|
listSessions(): Promise<Models.SessionList> {
|
|
2528
|
+
|
|
1231
2529
|
const apiPath = '/account/sessions';
|
|
1232
2530
|
const payload: Payload = {};
|
|
1233
2531
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1250,6 +2548,7 @@ export class Account {
|
|
|
1250
2548
|
* @returns {Promise<{}>}
|
|
1251
2549
|
*/
|
|
1252
2550
|
deleteSessions(): Promise<{}> {
|
|
2551
|
+
|
|
1253
2552
|
const apiPath = '/account/sessions';
|
|
1254
2553
|
const payload: Payload = {};
|
|
1255
2554
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1273,6 +2572,7 @@ export class Account {
|
|
|
1273
2572
|
* @returns {Promise<Models.Session>}
|
|
1274
2573
|
*/
|
|
1275
2574
|
createAnonymousSession(): Promise<Models.Session> {
|
|
2575
|
+
|
|
1276
2576
|
const apiPath = '/account/sessions/anonymous';
|
|
1277
2577
|
const payload: Payload = {};
|
|
1278
2578
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1294,18 +2594,49 @@ export class Account {
|
|
|
1294
2594
|
*
|
|
1295
2595
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1296
2596
|
*
|
|
1297
|
-
* @param {string} email
|
|
1298
|
-
* @param {string} password
|
|
2597
|
+
* @param {string} params.email - User email.
|
|
2598
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
2599
|
+
* @throws {AppwriteException}
|
|
2600
|
+
* @returns {Promise<Models.Session>}
|
|
2601
|
+
*/
|
|
2602
|
+
createEmailPasswordSession(params: { email: string, password: string }): Promise<Models.Session>;
|
|
2603
|
+
/**
|
|
2604
|
+
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
|
|
2605
|
+
*
|
|
2606
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2607
|
+
*
|
|
2608
|
+
* @param {string} email - User email.
|
|
2609
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
1299
2610
|
* @throws {AppwriteException}
|
|
1300
2611
|
* @returns {Promise<Models.Session>}
|
|
2612
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1301
2613
|
*/
|
|
1302
|
-
createEmailPasswordSession(email: string, password: string): Promise<Models.Session
|
|
2614
|
+
createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
|
|
2615
|
+
createEmailPasswordSession(
|
|
2616
|
+
paramsOrFirst: { email: string, password: string } | string,
|
|
2617
|
+
...rest: [(string)?]
|
|
2618
|
+
): Promise<Models.Session> {
|
|
2619
|
+
let params: { email: string, password: string };
|
|
2620
|
+
|
|
2621
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2622
|
+
params = (paramsOrFirst || {}) as { email: string, password: string };
|
|
2623
|
+
} else {
|
|
2624
|
+
params = {
|
|
2625
|
+
email: paramsOrFirst as string,
|
|
2626
|
+
password: rest[0] as string
|
|
2627
|
+
};
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
const email = params.email;
|
|
2631
|
+
const password = params.password;
|
|
2632
|
+
|
|
1303
2633
|
if (typeof email === 'undefined') {
|
|
1304
2634
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1305
2635
|
}
|
|
1306
2636
|
if (typeof password === 'undefined') {
|
|
1307
2637
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
1308
2638
|
}
|
|
2639
|
+
|
|
1309
2640
|
const apiPath = '/account/sessions/email';
|
|
1310
2641
|
const payload: Payload = {};
|
|
1311
2642
|
if (typeof email !== 'undefined') {
|
|
@@ -1331,18 +2662,48 @@ export class Account {
|
|
|
1331
2662
|
/**
|
|
1332
2663
|
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
1333
2664
|
*
|
|
1334
|
-
* @param {string} userId
|
|
1335
|
-
* @param {string} secret
|
|
2665
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
2666
|
+
* @param {string} params.secret - Valid verification token.
|
|
1336
2667
|
* @throws {AppwriteException}
|
|
1337
2668
|
* @returns {Promise<Models.Session>}
|
|
2669
|
+
* @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
|
|
1338
2670
|
*/
|
|
1339
|
-
updateMagicURLSession(userId: string, secret: string): Promise<Models.Session
|
|
2671
|
+
updateMagicURLSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
2672
|
+
/**
|
|
2673
|
+
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
2674
|
+
*
|
|
2675
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
2676
|
+
* @param {string} secret - Valid verification token.
|
|
2677
|
+
* @throws {AppwriteException}
|
|
2678
|
+
* @returns {Promise<Models.Session>}
|
|
2679
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2680
|
+
*/
|
|
2681
|
+
updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
|
|
2682
|
+
updateMagicURLSession(
|
|
2683
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
2684
|
+
...rest: [(string)?]
|
|
2685
|
+
): Promise<Models.Session> {
|
|
2686
|
+
let params: { userId: string, secret: string };
|
|
2687
|
+
|
|
2688
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2689
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
2690
|
+
} else {
|
|
2691
|
+
params = {
|
|
2692
|
+
userId: paramsOrFirst as string,
|
|
2693
|
+
secret: rest[0] as string
|
|
2694
|
+
};
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
const userId = params.userId;
|
|
2698
|
+
const secret = params.secret;
|
|
2699
|
+
|
|
1340
2700
|
if (typeof userId === 'undefined') {
|
|
1341
2701
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1342
2702
|
}
|
|
1343
2703
|
if (typeof secret === 'undefined') {
|
|
1344
2704
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1345
2705
|
}
|
|
2706
|
+
|
|
1346
2707
|
const apiPath = '/account/sessions/magic-url';
|
|
1347
2708
|
const payload: Payload = {};
|
|
1348
2709
|
if (typeof userId !== 'undefined') {
|
|
@@ -1366,24 +2727,64 @@ export class Account {
|
|
|
1366
2727
|
}
|
|
1367
2728
|
|
|
1368
2729
|
/**
|
|
1369
|
-
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL
|
|
2730
|
+
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
|
2731
|
+
*
|
|
2732
|
+
* If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
|
|
2733
|
+
*
|
|
2734
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2735
|
+
*
|
|
2736
|
+
*
|
|
2737
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine.
|
|
2738
|
+
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2739
|
+
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2740
|
+
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
2741
|
+
* @throws {AppwriteException}
|
|
2742
|
+
* @returns {void | string}
|
|
2743
|
+
*/
|
|
2744
|
+
createOAuth2Session(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | string;
|
|
2745
|
+
/**
|
|
2746
|
+
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
|
1370
2747
|
*
|
|
1371
2748
|
* If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
|
|
1372
2749
|
*
|
|
1373
2750
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1374
2751
|
*
|
|
1375
2752
|
*
|
|
1376
|
-
* @param {OAuthProvider} provider
|
|
1377
|
-
* @param {string} success
|
|
1378
|
-
* @param {string} failure
|
|
1379
|
-
* @param {string[]} scopes
|
|
2753
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine.
|
|
2754
|
+
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2755
|
+
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
2756
|
+
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
1380
2757
|
* @throws {AppwriteException}
|
|
1381
2758
|
* @returns {void | string}
|
|
2759
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1382
2760
|
*/
|
|
1383
|
-
createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string
|
|
2761
|
+
createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string;
|
|
2762
|
+
createOAuth2Session(
|
|
2763
|
+
paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider,
|
|
2764
|
+
...rest: [(string)?, (string)?, (string[])?]
|
|
2765
|
+
): void | string {
|
|
2766
|
+
let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
2767
|
+
|
|
2768
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
2769
|
+
params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
2770
|
+
} else {
|
|
2771
|
+
params = {
|
|
2772
|
+
provider: paramsOrFirst as OAuthProvider,
|
|
2773
|
+
success: rest[0] as string,
|
|
2774
|
+
failure: rest[1] as string,
|
|
2775
|
+
scopes: rest[2] as string[]
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
const provider = params.provider;
|
|
2780
|
+
const success = params.success;
|
|
2781
|
+
const failure = params.failure;
|
|
2782
|
+
const scopes = params.scopes;
|
|
2783
|
+
|
|
1384
2784
|
if (typeof provider === 'undefined') {
|
|
1385
2785
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1386
2786
|
}
|
|
2787
|
+
|
|
1387
2788
|
const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
|
|
1388
2789
|
const payload: Payload = {};
|
|
1389
2790
|
if (typeof success !== 'undefined') {
|
|
@@ -1417,18 +2818,48 @@ export class Account {
|
|
|
1417
2818
|
/**
|
|
1418
2819
|
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
1419
2820
|
*
|
|
1420
|
-
* @param {string} userId
|
|
1421
|
-
* @param {string} secret
|
|
2821
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
2822
|
+
* @param {string} params.secret - Valid verification token.
|
|
2823
|
+
* @throws {AppwriteException}
|
|
2824
|
+
* @returns {Promise<Models.Session>}
|
|
2825
|
+
* @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
|
|
2826
|
+
*/
|
|
2827
|
+
updatePhoneSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
2828
|
+
/**
|
|
2829
|
+
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
2830
|
+
*
|
|
2831
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
2832
|
+
* @param {string} secret - Valid verification token.
|
|
1422
2833
|
* @throws {AppwriteException}
|
|
1423
2834
|
* @returns {Promise<Models.Session>}
|
|
2835
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1424
2836
|
*/
|
|
1425
|
-
updatePhoneSession(userId: string, secret: string): Promise<Models.Session
|
|
2837
|
+
updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
|
|
2838
|
+
updatePhoneSession(
|
|
2839
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
2840
|
+
...rest: [(string)?]
|
|
2841
|
+
): Promise<Models.Session> {
|
|
2842
|
+
let params: { userId: string, secret: string };
|
|
2843
|
+
|
|
2844
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2845
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
2846
|
+
} else {
|
|
2847
|
+
params = {
|
|
2848
|
+
userId: paramsOrFirst as string,
|
|
2849
|
+
secret: rest[0] as string
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
const userId = params.userId;
|
|
2854
|
+
const secret = params.secret;
|
|
2855
|
+
|
|
1426
2856
|
if (typeof userId === 'undefined') {
|
|
1427
2857
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1428
2858
|
}
|
|
1429
2859
|
if (typeof secret === 'undefined') {
|
|
1430
2860
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1431
2861
|
}
|
|
2862
|
+
|
|
1432
2863
|
const apiPath = '/account/sessions/phone';
|
|
1433
2864
|
const payload: Payload = {};
|
|
1434
2865
|
if (typeof userId !== 'undefined') {
|
|
@@ -1454,18 +2885,47 @@ export class Account {
|
|
|
1454
2885
|
/**
|
|
1455
2886
|
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
1456
2887
|
*
|
|
1457
|
-
* @param {string} userId
|
|
1458
|
-
* @param {string} secret
|
|
2888
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
2889
|
+
* @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
|
|
1459
2890
|
* @throws {AppwriteException}
|
|
1460
2891
|
* @returns {Promise<Models.Session>}
|
|
1461
2892
|
*/
|
|
1462
|
-
createSession(userId: string, secret: string): Promise<Models.Session
|
|
2893
|
+
createSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
2894
|
+
/**
|
|
2895
|
+
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
2896
|
+
*
|
|
2897
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
2898
|
+
* @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
|
|
2899
|
+
* @throws {AppwriteException}
|
|
2900
|
+
* @returns {Promise<Models.Session>}
|
|
2901
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2902
|
+
*/
|
|
2903
|
+
createSession(userId: string, secret: string): Promise<Models.Session>;
|
|
2904
|
+
createSession(
|
|
2905
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
2906
|
+
...rest: [(string)?]
|
|
2907
|
+
): Promise<Models.Session> {
|
|
2908
|
+
let params: { userId: string, secret: string };
|
|
2909
|
+
|
|
2910
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2911
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
2912
|
+
} else {
|
|
2913
|
+
params = {
|
|
2914
|
+
userId: paramsOrFirst as string,
|
|
2915
|
+
secret: rest[0] as string
|
|
2916
|
+
};
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
const userId = params.userId;
|
|
2920
|
+
const secret = params.secret;
|
|
2921
|
+
|
|
1463
2922
|
if (typeof userId === 'undefined') {
|
|
1464
2923
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1465
2924
|
}
|
|
1466
2925
|
if (typeof secret === 'undefined') {
|
|
1467
2926
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1468
2927
|
}
|
|
2928
|
+
|
|
1469
2929
|
const apiPath = '/account/sessions/token';
|
|
1470
2930
|
const payload: Payload = {};
|
|
1471
2931
|
if (typeof userId !== 'undefined') {
|
|
@@ -1489,16 +2949,41 @@ export class Account {
|
|
|
1489
2949
|
}
|
|
1490
2950
|
|
|
1491
2951
|
/**
|
|
1492
|
-
* Use this endpoint to get a logged in user
|
|
2952
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
2953
|
+
*
|
|
2954
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
2955
|
+
* @throws {AppwriteException}
|
|
2956
|
+
* @returns {Promise<Models.Session>}
|
|
2957
|
+
*/
|
|
2958
|
+
getSession(params: { sessionId: string }): Promise<Models.Session>;
|
|
2959
|
+
/**
|
|
2960
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
1493
2961
|
*
|
|
1494
|
-
* @param {string} sessionId
|
|
2962
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
1495
2963
|
* @throws {AppwriteException}
|
|
1496
2964
|
* @returns {Promise<Models.Session>}
|
|
2965
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1497
2966
|
*/
|
|
1498
|
-
getSession(sessionId: string): Promise<Models.Session
|
|
2967
|
+
getSession(sessionId: string): Promise<Models.Session>;
|
|
2968
|
+
getSession(
|
|
2969
|
+
paramsOrFirst: { sessionId: string } | string
|
|
2970
|
+
): Promise<Models.Session> {
|
|
2971
|
+
let params: { sessionId: string };
|
|
2972
|
+
|
|
2973
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2974
|
+
params = (paramsOrFirst || {}) as { sessionId: string };
|
|
2975
|
+
} else {
|
|
2976
|
+
params = {
|
|
2977
|
+
sessionId: paramsOrFirst as string
|
|
2978
|
+
};
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
const sessionId = params.sessionId;
|
|
2982
|
+
|
|
1499
2983
|
if (typeof sessionId === 'undefined') {
|
|
1500
2984
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1501
2985
|
}
|
|
2986
|
+
|
|
1502
2987
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1503
2988
|
const payload: Payload = {};
|
|
1504
2989
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1515,16 +3000,41 @@ export class Account {
|
|
|
1515
3000
|
}
|
|
1516
3001
|
|
|
1517
3002
|
/**
|
|
1518
|
-
* Use this endpoint to extend a session
|
|
3003
|
+
* Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
|
|
3004
|
+
*
|
|
3005
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
3006
|
+
* @throws {AppwriteException}
|
|
3007
|
+
* @returns {Promise<Models.Session>}
|
|
3008
|
+
*/
|
|
3009
|
+
updateSession(params: { sessionId: string }): Promise<Models.Session>;
|
|
3010
|
+
/**
|
|
3011
|
+
* Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
|
|
1519
3012
|
*
|
|
1520
|
-
* @param {string} sessionId
|
|
3013
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
1521
3014
|
* @throws {AppwriteException}
|
|
1522
3015
|
* @returns {Promise<Models.Session>}
|
|
3016
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1523
3017
|
*/
|
|
1524
|
-
updateSession(sessionId: string): Promise<Models.Session
|
|
3018
|
+
updateSession(sessionId: string): Promise<Models.Session>;
|
|
3019
|
+
updateSession(
|
|
3020
|
+
paramsOrFirst: { sessionId: string } | string
|
|
3021
|
+
): Promise<Models.Session> {
|
|
3022
|
+
let params: { sessionId: string };
|
|
3023
|
+
|
|
3024
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3025
|
+
params = (paramsOrFirst || {}) as { sessionId: string };
|
|
3026
|
+
} else {
|
|
3027
|
+
params = {
|
|
3028
|
+
sessionId: paramsOrFirst as string
|
|
3029
|
+
};
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
const sessionId = params.sessionId;
|
|
3033
|
+
|
|
1525
3034
|
if (typeof sessionId === 'undefined') {
|
|
1526
3035
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1527
3036
|
}
|
|
3037
|
+
|
|
1528
3038
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1529
3039
|
const payload: Payload = {};
|
|
1530
3040
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1542,16 +3052,41 @@ export class Account {
|
|
|
1542
3052
|
}
|
|
1543
3053
|
|
|
1544
3054
|
/**
|
|
1545
|
-
* Logout the user. Use
|
|
3055
|
+
* Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
3056
|
+
*
|
|
3057
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
3058
|
+
* @throws {AppwriteException}
|
|
3059
|
+
* @returns {Promise<{}>}
|
|
3060
|
+
*/
|
|
3061
|
+
deleteSession(params: { sessionId: string }): Promise<{}>;
|
|
3062
|
+
/**
|
|
3063
|
+
* Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
1546
3064
|
*
|
|
1547
|
-
* @param {string} sessionId
|
|
3065
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
1548
3066
|
* @throws {AppwriteException}
|
|
1549
3067
|
* @returns {Promise<{}>}
|
|
3068
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1550
3069
|
*/
|
|
1551
|
-
deleteSession(sessionId: string): Promise<{}
|
|
3070
|
+
deleteSession(sessionId: string): Promise<{}>;
|
|
3071
|
+
deleteSession(
|
|
3072
|
+
paramsOrFirst: { sessionId: string } | string
|
|
3073
|
+
): Promise<{}> {
|
|
3074
|
+
let params: { sessionId: string };
|
|
3075
|
+
|
|
3076
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3077
|
+
params = (paramsOrFirst || {}) as { sessionId: string };
|
|
3078
|
+
} else {
|
|
3079
|
+
params = {
|
|
3080
|
+
sessionId: paramsOrFirst as string
|
|
3081
|
+
};
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
const sessionId = params.sessionId;
|
|
3085
|
+
|
|
1552
3086
|
if (typeof sessionId === 'undefined') {
|
|
1553
3087
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1554
3088
|
}
|
|
3089
|
+
|
|
1555
3090
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1556
3091
|
const payload: Payload = {};
|
|
1557
3092
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1575,6 +3110,7 @@ export class Account {
|
|
|
1575
3110
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1576
3111
|
*/
|
|
1577
3112
|
updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
3113
|
+
|
|
1578
3114
|
const apiPath = '/account/status';
|
|
1579
3115
|
const payload: Payload = {};
|
|
1580
3116
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1594,19 +3130,51 @@ export class Account {
|
|
|
1594
3130
|
/**
|
|
1595
3131
|
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
|
|
1596
3132
|
*
|
|
1597
|
-
* @param {string} targetId
|
|
1598
|
-
* @param {string} identifier
|
|
1599
|
-
* @param {string} providerId
|
|
3133
|
+
* @param {string} params.targetId - Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
3134
|
+
* @param {string} params.identifier - The target identifier (token, email, phone etc.)
|
|
3135
|
+
* @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
|
|
3136
|
+
* @throws {AppwriteException}
|
|
3137
|
+
* @returns {Promise<Models.Target>}
|
|
3138
|
+
*/
|
|
3139
|
+
createPushTarget(params: { targetId: string, identifier: string, providerId?: string }): Promise<Models.Target>;
|
|
3140
|
+
/**
|
|
3141
|
+
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
|
|
3142
|
+
*
|
|
3143
|
+
* @param {string} targetId - Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
3144
|
+
* @param {string} identifier - The target identifier (token, email, phone etc.)
|
|
3145
|
+
* @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
|
|
1600
3146
|
* @throws {AppwriteException}
|
|
1601
3147
|
* @returns {Promise<Models.Target>}
|
|
3148
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1602
3149
|
*/
|
|
1603
|
-
createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target
|
|
3150
|
+
createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>;
|
|
3151
|
+
createPushTarget(
|
|
3152
|
+
paramsOrFirst: { targetId: string, identifier: string, providerId?: string } | string,
|
|
3153
|
+
...rest: [(string)?, (string)?]
|
|
3154
|
+
): Promise<Models.Target> {
|
|
3155
|
+
let params: { targetId: string, identifier: string, providerId?: string };
|
|
3156
|
+
|
|
3157
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3158
|
+
params = (paramsOrFirst || {}) as { targetId: string, identifier: string, providerId?: string };
|
|
3159
|
+
} else {
|
|
3160
|
+
params = {
|
|
3161
|
+
targetId: paramsOrFirst as string,
|
|
3162
|
+
identifier: rest[0] as string,
|
|
3163
|
+
providerId: rest[1] as string
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
const targetId = params.targetId;
|
|
3168
|
+
const identifier = params.identifier;
|
|
3169
|
+
const providerId = params.providerId;
|
|
3170
|
+
|
|
1604
3171
|
if (typeof targetId === 'undefined') {
|
|
1605
3172
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1606
3173
|
}
|
|
1607
3174
|
if (typeof identifier === 'undefined') {
|
|
1608
3175
|
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1609
3176
|
}
|
|
3177
|
+
|
|
1610
3178
|
const apiPath = '/account/targets/push';
|
|
1611
3179
|
const payload: Payload = {};
|
|
1612
3180
|
if (typeof targetId !== 'undefined') {
|
|
@@ -1633,20 +3201,49 @@ export class Account {
|
|
|
1633
3201
|
}
|
|
1634
3202
|
|
|
1635
3203
|
/**
|
|
1636
|
-
* Update the currently logged in user
|
|
3204
|
+
* Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
|
|
3205
|
+
*
|
|
3206
|
+
* @param {string} params.targetId - Target ID.
|
|
3207
|
+
* @param {string} params.identifier - The target identifier (token, email, phone etc.)
|
|
3208
|
+
* @throws {AppwriteException}
|
|
3209
|
+
* @returns {Promise<Models.Target>}
|
|
3210
|
+
*/
|
|
3211
|
+
updatePushTarget(params: { targetId: string, identifier: string }): Promise<Models.Target>;
|
|
3212
|
+
/**
|
|
3213
|
+
* Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
|
|
1637
3214
|
*
|
|
1638
|
-
* @param {string} targetId
|
|
1639
|
-
* @param {string} identifier
|
|
3215
|
+
* @param {string} targetId - Target ID.
|
|
3216
|
+
* @param {string} identifier - The target identifier (token, email, phone etc.)
|
|
1640
3217
|
* @throws {AppwriteException}
|
|
1641
3218
|
* @returns {Promise<Models.Target>}
|
|
3219
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1642
3220
|
*/
|
|
1643
|
-
updatePushTarget(targetId: string, identifier: string): Promise<Models.Target
|
|
3221
|
+
updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>;
|
|
3222
|
+
updatePushTarget(
|
|
3223
|
+
paramsOrFirst: { targetId: string, identifier: string } | string,
|
|
3224
|
+
...rest: [(string)?]
|
|
3225
|
+
): Promise<Models.Target> {
|
|
3226
|
+
let params: { targetId: string, identifier: string };
|
|
3227
|
+
|
|
3228
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3229
|
+
params = (paramsOrFirst || {}) as { targetId: string, identifier: string };
|
|
3230
|
+
} else {
|
|
3231
|
+
params = {
|
|
3232
|
+
targetId: paramsOrFirst as string,
|
|
3233
|
+
identifier: rest[0] as string
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
const targetId = params.targetId;
|
|
3238
|
+
const identifier = params.identifier;
|
|
3239
|
+
|
|
1644
3240
|
if (typeof targetId === 'undefined') {
|
|
1645
3241
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1646
3242
|
}
|
|
1647
3243
|
if (typeof identifier === 'undefined') {
|
|
1648
3244
|
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1649
3245
|
}
|
|
3246
|
+
|
|
1650
3247
|
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1651
3248
|
const payload: Payload = {};
|
|
1652
3249
|
if (typeof identifier !== 'undefined') {
|
|
@@ -1669,14 +3266,39 @@ export class Account {
|
|
|
1669
3266
|
/**
|
|
1670
3267
|
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
|
|
1671
3268
|
*
|
|
1672
|
-
* @param {string} targetId
|
|
3269
|
+
* @param {string} params.targetId - Target ID.
|
|
3270
|
+
* @throws {AppwriteException}
|
|
3271
|
+
* @returns {Promise<{}>}
|
|
3272
|
+
*/
|
|
3273
|
+
deletePushTarget(params: { targetId: string }): Promise<{}>;
|
|
3274
|
+
/**
|
|
3275
|
+
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
|
|
3276
|
+
*
|
|
3277
|
+
* @param {string} targetId - Target ID.
|
|
1673
3278
|
* @throws {AppwriteException}
|
|
1674
3279
|
* @returns {Promise<{}>}
|
|
3280
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1675
3281
|
*/
|
|
1676
|
-
deletePushTarget(targetId: string): Promise<{}
|
|
3282
|
+
deletePushTarget(targetId: string): Promise<{}>;
|
|
3283
|
+
deletePushTarget(
|
|
3284
|
+
paramsOrFirst: { targetId: string } | string
|
|
3285
|
+
): Promise<{}> {
|
|
3286
|
+
let params: { targetId: string };
|
|
3287
|
+
|
|
3288
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3289
|
+
params = (paramsOrFirst || {}) as { targetId: string };
|
|
3290
|
+
} else {
|
|
3291
|
+
params = {
|
|
3292
|
+
targetId: paramsOrFirst as string
|
|
3293
|
+
};
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
const targetId = params.targetId;
|
|
3297
|
+
|
|
1677
3298
|
if (typeof targetId === 'undefined') {
|
|
1678
3299
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1679
3300
|
}
|
|
3301
|
+
|
|
1680
3302
|
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1681
3303
|
const payload: Payload = {};
|
|
1682
3304
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1694,23 +3316,59 @@ export class Account {
|
|
|
1694
3316
|
}
|
|
1695
3317
|
|
|
1696
3318
|
/**
|
|
1697
|
-
* Sends the user an email with a secret key for creating a session. If the
|
|
3319
|
+
* Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
|
|
3320
|
+
*
|
|
3321
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
3322
|
+
*
|
|
3323
|
+
*
|
|
3324
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
3325
|
+
* @param {string} params.email - User email.
|
|
3326
|
+
* @param {boolean} params.phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
3327
|
+
* @throws {AppwriteException}
|
|
3328
|
+
* @returns {Promise<Models.Token>}
|
|
3329
|
+
*/
|
|
3330
|
+
createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise<Models.Token>;
|
|
3331
|
+
/**
|
|
3332
|
+
* Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
|
|
1698
3333
|
*
|
|
1699
3334
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
3335
|
+
*
|
|
1700
3336
|
*
|
|
1701
|
-
* @param {string} userId
|
|
1702
|
-
* @param {string} email
|
|
1703
|
-
* @param {boolean} phrase
|
|
3337
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
3338
|
+
* @param {string} email - User email.
|
|
3339
|
+
* @param {boolean} phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
1704
3340
|
* @throws {AppwriteException}
|
|
1705
3341
|
* @returns {Promise<Models.Token>}
|
|
3342
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1706
3343
|
*/
|
|
1707
|
-
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token
|
|
3344
|
+
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
|
|
3345
|
+
createEmailToken(
|
|
3346
|
+
paramsOrFirst: { userId: string, email: string, phrase?: boolean } | string,
|
|
3347
|
+
...rest: [(string)?, (boolean)?]
|
|
3348
|
+
): Promise<Models.Token> {
|
|
3349
|
+
let params: { userId: string, email: string, phrase?: boolean };
|
|
3350
|
+
|
|
3351
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3352
|
+
params = (paramsOrFirst || {}) as { userId: string, email: string, phrase?: boolean };
|
|
3353
|
+
} else {
|
|
3354
|
+
params = {
|
|
3355
|
+
userId: paramsOrFirst as string,
|
|
3356
|
+
email: rest[0] as string,
|
|
3357
|
+
phrase: rest[1] as boolean
|
|
3358
|
+
};
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
const userId = params.userId;
|
|
3362
|
+
const email = params.email;
|
|
3363
|
+
const phrase = params.phrase;
|
|
3364
|
+
|
|
1708
3365
|
if (typeof userId === 'undefined') {
|
|
1709
3366
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1710
3367
|
}
|
|
1711
3368
|
if (typeof email === 'undefined') {
|
|
1712
3369
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1713
3370
|
}
|
|
3371
|
+
|
|
1714
3372
|
const apiPath = '/account/tokens/email';
|
|
1715
3373
|
const payload: Payload = {};
|
|
1716
3374
|
if (typeof userId !== 'undefined') {
|
|
@@ -1737,25 +3395,63 @@ export class Account {
|
|
|
1737
3395
|
}
|
|
1738
3396
|
|
|
1739
3397
|
/**
|
|
1740
|
-
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user
|
|
3398
|
+
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
3399
|
+
*
|
|
3400
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
3401
|
+
*
|
|
3402
|
+
*
|
|
3403
|
+
* @param {string} params.userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
3404
|
+
* @param {string} params.email - User email.
|
|
3405
|
+
* @param {string} params.url - URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3406
|
+
* @param {boolean} params.phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
3407
|
+
* @throws {AppwriteException}
|
|
3408
|
+
* @returns {Promise<Models.Token>}
|
|
3409
|
+
*/
|
|
3410
|
+
createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise<Models.Token>;
|
|
3411
|
+
/**
|
|
3412
|
+
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
1741
3413
|
*
|
|
1742
3414
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1743
3415
|
*
|
|
1744
3416
|
*
|
|
1745
|
-
* @param {string} userId
|
|
1746
|
-
* @param {string} email
|
|
1747
|
-
* @param {string} url
|
|
1748
|
-
* @param {boolean} phrase
|
|
3417
|
+
* @param {string} userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
3418
|
+
* @param {string} email - User email.
|
|
3419
|
+
* @param {string} url - URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3420
|
+
* @param {boolean} phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
1749
3421
|
* @throws {AppwriteException}
|
|
1750
3422
|
* @returns {Promise<Models.Token>}
|
|
3423
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1751
3424
|
*/
|
|
1752
|
-
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token
|
|
3425
|
+
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
|
|
3426
|
+
createMagicURLToken(
|
|
3427
|
+
paramsOrFirst: { userId: string, email: string, url?: string, phrase?: boolean } | string,
|
|
3428
|
+
...rest: [(string)?, (string)?, (boolean)?]
|
|
3429
|
+
): Promise<Models.Token> {
|
|
3430
|
+
let params: { userId: string, email: string, url?: string, phrase?: boolean };
|
|
3431
|
+
|
|
3432
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3433
|
+
params = (paramsOrFirst || {}) as { userId: string, email: string, url?: string, phrase?: boolean };
|
|
3434
|
+
} else {
|
|
3435
|
+
params = {
|
|
3436
|
+
userId: paramsOrFirst as string,
|
|
3437
|
+
email: rest[0] as string,
|
|
3438
|
+
url: rest[1] as string,
|
|
3439
|
+
phrase: rest[2] as boolean
|
|
3440
|
+
};
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
const userId = params.userId;
|
|
3444
|
+
const email = params.email;
|
|
3445
|
+
const url = params.url;
|
|
3446
|
+
const phrase = params.phrase;
|
|
3447
|
+
|
|
1753
3448
|
if (typeof userId === 'undefined') {
|
|
1754
3449
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1755
3450
|
}
|
|
1756
3451
|
if (typeof email === 'undefined') {
|
|
1757
3452
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1758
3453
|
}
|
|
3454
|
+
|
|
1759
3455
|
const apiPath = '/account/tokens/magic-url';
|
|
1760
3456
|
const payload: Payload = {};
|
|
1761
3457
|
if (typeof userId !== 'undefined') {
|
|
@@ -1785,23 +3481,62 @@ export class Account {
|
|
|
1785
3481
|
}
|
|
1786
3482
|
|
|
1787
3483
|
/**
|
|
1788
|
-
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL
|
|
3484
|
+
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
|
3485
|
+
*
|
|
3486
|
+
* If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
|
3487
|
+
*
|
|
3488
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
3489
|
+
*
|
|
3490
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine.
|
|
3491
|
+
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3492
|
+
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3493
|
+
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
3494
|
+
* @throws {AppwriteException}
|
|
3495
|
+
* @returns {void | string}
|
|
3496
|
+
*/
|
|
3497
|
+
createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | string;
|
|
3498
|
+
/**
|
|
3499
|
+
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
|
1789
3500
|
*
|
|
1790
3501
|
* If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
|
1791
3502
|
*
|
|
1792
3503
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1793
3504
|
*
|
|
1794
|
-
* @param {OAuthProvider} provider
|
|
1795
|
-
* @param {string} success
|
|
1796
|
-
* @param {string} failure
|
|
1797
|
-
* @param {string[]} scopes
|
|
3505
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine.
|
|
3506
|
+
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3507
|
+
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3508
|
+
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
1798
3509
|
* @throws {AppwriteException}
|
|
1799
3510
|
* @returns {void | string}
|
|
3511
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1800
3512
|
*/
|
|
1801
|
-
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string
|
|
3513
|
+
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string;
|
|
3514
|
+
createOAuth2Token(
|
|
3515
|
+
paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider,
|
|
3516
|
+
...rest: [(string)?, (string)?, (string[])?]
|
|
3517
|
+
): void | string {
|
|
3518
|
+
let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
3519
|
+
|
|
3520
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
3521
|
+
params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
3522
|
+
} else {
|
|
3523
|
+
params = {
|
|
3524
|
+
provider: paramsOrFirst as OAuthProvider,
|
|
3525
|
+
success: rest[0] as string,
|
|
3526
|
+
failure: rest[1] as string,
|
|
3527
|
+
scopes: rest[2] as string[]
|
|
3528
|
+
};
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
const provider = params.provider;
|
|
3532
|
+
const success = params.success;
|
|
3533
|
+
const failure = params.failure;
|
|
3534
|
+
const scopes = params.scopes;
|
|
3535
|
+
|
|
1802
3536
|
if (typeof provider === 'undefined') {
|
|
1803
3537
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1804
3538
|
}
|
|
3539
|
+
|
|
1805
3540
|
const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
|
|
1806
3541
|
const payload: Payload = {};
|
|
1807
3542
|
if (typeof success !== 'undefined') {
|
|
@@ -1833,22 +3568,53 @@ export class Account {
|
|
|
1833
3568
|
}
|
|
1834
3569
|
|
|
1835
3570
|
/**
|
|
1836
|
-
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user
|
|
3571
|
+
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
|
|
3572
|
+
*
|
|
3573
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
3574
|
+
*
|
|
3575
|
+
* @param {string} params.userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
|
|
3576
|
+
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
3577
|
+
* @throws {AppwriteException}
|
|
3578
|
+
* @returns {Promise<Models.Token>}
|
|
3579
|
+
*/
|
|
3580
|
+
createPhoneToken(params: { userId: string, phone: string }): Promise<Models.Token>;
|
|
3581
|
+
/**
|
|
3582
|
+
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
|
|
1837
3583
|
*
|
|
1838
3584
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1839
3585
|
*
|
|
1840
|
-
* @param {string} userId
|
|
1841
|
-
* @param {string} phone
|
|
3586
|
+
* @param {string} userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
|
|
3587
|
+
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
1842
3588
|
* @throws {AppwriteException}
|
|
1843
3589
|
* @returns {Promise<Models.Token>}
|
|
3590
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1844
3591
|
*/
|
|
1845
|
-
createPhoneToken(userId: string, phone: string): Promise<Models.Token
|
|
3592
|
+
createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
|
|
3593
|
+
createPhoneToken(
|
|
3594
|
+
paramsOrFirst: { userId: string, phone: string } | string,
|
|
3595
|
+
...rest: [(string)?]
|
|
3596
|
+
): Promise<Models.Token> {
|
|
3597
|
+
let params: { userId: string, phone: string };
|
|
3598
|
+
|
|
3599
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3600
|
+
params = (paramsOrFirst || {}) as { userId: string, phone: string };
|
|
3601
|
+
} else {
|
|
3602
|
+
params = {
|
|
3603
|
+
userId: paramsOrFirst as string,
|
|
3604
|
+
phone: rest[0] as string
|
|
3605
|
+
};
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
const userId = params.userId;
|
|
3609
|
+
const phone = params.phone;
|
|
3610
|
+
|
|
1846
3611
|
if (typeof userId === 'undefined') {
|
|
1847
3612
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1848
3613
|
}
|
|
1849
3614
|
if (typeof phone === 'undefined') {
|
|
1850
3615
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1851
3616
|
}
|
|
3617
|
+
|
|
1852
3618
|
const apiPath = '/account/tokens/phone';
|
|
1853
3619
|
const payload: Payload = {};
|
|
1854
3620
|
if (typeof userId !== 'undefined') {
|
|
@@ -1872,20 +3638,110 @@ export class Account {
|
|
|
1872
3638
|
}
|
|
1873
3639
|
|
|
1874
3640
|
/**
|
|
1875
|
-
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user
|
|
3641
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
3642
|
+
*
|
|
3643
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
3644
|
+
*
|
|
3645
|
+
*
|
|
3646
|
+
* @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3647
|
+
* @throws {AppwriteException}
|
|
3648
|
+
* @returns {Promise<Models.Token>}
|
|
3649
|
+
*/
|
|
3650
|
+
createEmailVerification(params: { url: string }): Promise<Models.Token>;
|
|
3651
|
+
/**
|
|
3652
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
3653
|
+
*
|
|
3654
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
3655
|
+
*
|
|
3656
|
+
*
|
|
3657
|
+
* @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3658
|
+
* @throws {AppwriteException}
|
|
3659
|
+
* @returns {Promise<Models.Token>}
|
|
3660
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3661
|
+
*/
|
|
3662
|
+
createEmailVerification(url: string): Promise<Models.Token>;
|
|
3663
|
+
createEmailVerification(
|
|
3664
|
+
paramsOrFirst: { url: string } | string
|
|
3665
|
+
): Promise<Models.Token> {
|
|
3666
|
+
let params: { url: string };
|
|
3667
|
+
|
|
3668
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3669
|
+
params = (paramsOrFirst || {}) as { url: string };
|
|
3670
|
+
} else {
|
|
3671
|
+
params = {
|
|
3672
|
+
url: paramsOrFirst as string
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
const url = params.url;
|
|
3677
|
+
|
|
3678
|
+
if (typeof url === 'undefined') {
|
|
3679
|
+
throw new AppwriteException('Missing required parameter: "url"');
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
const apiPath = '/account/verifications/email';
|
|
3683
|
+
const payload: Payload = {};
|
|
3684
|
+
if (typeof url !== 'undefined') {
|
|
3685
|
+
payload['url'] = url;
|
|
3686
|
+
}
|
|
3687
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3688
|
+
|
|
3689
|
+
const apiHeaders: { [header: string]: string } = {
|
|
3690
|
+
'content-type': 'application/json',
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
return this.client.call(
|
|
3694
|
+
'post',
|
|
3695
|
+
uri,
|
|
3696
|
+
apiHeaders,
|
|
3697
|
+
payload
|
|
3698
|
+
);
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
/**
|
|
3702
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
3703
|
+
*
|
|
3704
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
3705
|
+
*
|
|
3706
|
+
*
|
|
3707
|
+
* @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
3708
|
+
* @throws {AppwriteException}
|
|
3709
|
+
* @returns {Promise<Models.Token>}
|
|
3710
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.
|
|
3711
|
+
*/
|
|
3712
|
+
createVerification(params: { url: string }): Promise<Models.Token>;
|
|
3713
|
+
/**
|
|
3714
|
+
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
1876
3715
|
*
|
|
1877
3716
|
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
1878
3717
|
*
|
|
1879
3718
|
*
|
|
1880
|
-
* @param {string} url
|
|
3719
|
+
* @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1881
3720
|
* @throws {AppwriteException}
|
|
1882
3721
|
* @returns {Promise<Models.Token>}
|
|
3722
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1883
3723
|
*/
|
|
1884
|
-
createVerification(url: string): Promise<Models.Token
|
|
3724
|
+
createVerification(url: string): Promise<Models.Token>;
|
|
3725
|
+
createVerification(
|
|
3726
|
+
paramsOrFirst: { url: string } | string
|
|
3727
|
+
): Promise<Models.Token> {
|
|
3728
|
+
let params: { url: string };
|
|
3729
|
+
|
|
3730
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3731
|
+
params = (paramsOrFirst || {}) as { url: string };
|
|
3732
|
+
} else {
|
|
3733
|
+
params = {
|
|
3734
|
+
url: paramsOrFirst as string
|
|
3735
|
+
};
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
const url = params.url;
|
|
3739
|
+
|
|
1885
3740
|
if (typeof url === 'undefined') {
|
|
1886
3741
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1887
3742
|
}
|
|
1888
|
-
|
|
3743
|
+
|
|
3744
|
+
const apiPath = '/account/verifications/email';
|
|
1889
3745
|
const payload: Payload = {};
|
|
1890
3746
|
if (typeof url !== 'undefined') {
|
|
1891
3747
|
payload['url'] = url;
|
|
@@ -1907,19 +3763,115 @@ export class Account {
|
|
|
1907
3763
|
/**
|
|
1908
3764
|
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1909
3765
|
*
|
|
1910
|
-
* @param {string} userId
|
|
1911
|
-
* @param {string} secret
|
|
3766
|
+
* @param {string} params.userId - User ID.
|
|
3767
|
+
* @param {string} params.secret - Valid verification token.
|
|
3768
|
+
* @throws {AppwriteException}
|
|
3769
|
+
* @returns {Promise<Models.Token>}
|
|
3770
|
+
*/
|
|
3771
|
+
updateEmailVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
3772
|
+
/**
|
|
3773
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
3774
|
+
*
|
|
3775
|
+
* @param {string} userId - User ID.
|
|
3776
|
+
* @param {string} secret - Valid verification token.
|
|
3777
|
+
* @throws {AppwriteException}
|
|
3778
|
+
* @returns {Promise<Models.Token>}
|
|
3779
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3780
|
+
*/
|
|
3781
|
+
updateEmailVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
3782
|
+
updateEmailVerification(
|
|
3783
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
3784
|
+
...rest: [(string)?]
|
|
3785
|
+
): Promise<Models.Token> {
|
|
3786
|
+
let params: { userId: string, secret: string };
|
|
3787
|
+
|
|
3788
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3789
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
3790
|
+
} else {
|
|
3791
|
+
params = {
|
|
3792
|
+
userId: paramsOrFirst as string,
|
|
3793
|
+
secret: rest[0] as string
|
|
3794
|
+
};
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
const userId = params.userId;
|
|
3798
|
+
const secret = params.secret;
|
|
3799
|
+
|
|
3800
|
+
if (typeof userId === 'undefined') {
|
|
3801
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
3802
|
+
}
|
|
3803
|
+
if (typeof secret === 'undefined') {
|
|
3804
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
const apiPath = '/account/verifications/email';
|
|
3808
|
+
const payload: Payload = {};
|
|
3809
|
+
if (typeof userId !== 'undefined') {
|
|
3810
|
+
payload['userId'] = userId;
|
|
3811
|
+
}
|
|
3812
|
+
if (typeof secret !== 'undefined') {
|
|
3813
|
+
payload['secret'] = secret;
|
|
3814
|
+
}
|
|
3815
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3816
|
+
|
|
3817
|
+
const apiHeaders: { [header: string]: string } = {
|
|
3818
|
+
'content-type': 'application/json',
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
return this.client.call(
|
|
3822
|
+
'put',
|
|
3823
|
+
uri,
|
|
3824
|
+
apiHeaders,
|
|
3825
|
+
payload
|
|
3826
|
+
);
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
/**
|
|
3830
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
3831
|
+
*
|
|
3832
|
+
* @param {string} params.userId - User ID.
|
|
3833
|
+
* @param {string} params.secret - Valid verification token.
|
|
1912
3834
|
* @throws {AppwriteException}
|
|
1913
3835
|
* @returns {Promise<Models.Token>}
|
|
3836
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.
|
|
1914
3837
|
*/
|
|
1915
|
-
updateVerification(userId: string, secret: string): Promise<Models.Token
|
|
3838
|
+
updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
3839
|
+
/**
|
|
3840
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
3841
|
+
*
|
|
3842
|
+
* @param {string} userId - User ID.
|
|
3843
|
+
* @param {string} secret - Valid verification token.
|
|
3844
|
+
* @throws {AppwriteException}
|
|
3845
|
+
* @returns {Promise<Models.Token>}
|
|
3846
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3847
|
+
*/
|
|
3848
|
+
updateVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
3849
|
+
updateVerification(
|
|
3850
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
3851
|
+
...rest: [(string)?]
|
|
3852
|
+
): Promise<Models.Token> {
|
|
3853
|
+
let params: { userId: string, secret: string };
|
|
3854
|
+
|
|
3855
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3856
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
3857
|
+
} else {
|
|
3858
|
+
params = {
|
|
3859
|
+
userId: paramsOrFirst as string,
|
|
3860
|
+
secret: rest[0] as string
|
|
3861
|
+
};
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3864
|
+
const userId = params.userId;
|
|
3865
|
+
const secret = params.secret;
|
|
3866
|
+
|
|
1916
3867
|
if (typeof userId === 'undefined') {
|
|
1917
3868
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1918
3869
|
}
|
|
1919
3870
|
if (typeof secret === 'undefined') {
|
|
1920
3871
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1921
3872
|
}
|
|
1922
|
-
|
|
3873
|
+
|
|
3874
|
+
const apiPath = '/account/verifications/email';
|
|
1923
3875
|
const payload: Payload = {};
|
|
1924
3876
|
if (typeof userId !== 'undefined') {
|
|
1925
3877
|
payload['userId'] = userId;
|
|
@@ -1942,13 +3894,14 @@ export class Account {
|
|
|
1942
3894
|
}
|
|
1943
3895
|
|
|
1944
3896
|
/**
|
|
1945
|
-
* Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user
|
|
3897
|
+
* Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
|
|
1946
3898
|
*
|
|
1947
3899
|
* @throws {AppwriteException}
|
|
1948
3900
|
* @returns {Promise<Models.Token>}
|
|
1949
3901
|
*/
|
|
1950
3902
|
createPhoneVerification(): Promise<Models.Token> {
|
|
1951
|
-
|
|
3903
|
+
|
|
3904
|
+
const apiPath = '/account/verifications/phone';
|
|
1952
3905
|
const payload: Payload = {};
|
|
1953
3906
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1954
3907
|
|
|
@@ -1965,21 +3918,50 @@ export class Account {
|
|
|
1965
3918
|
}
|
|
1966
3919
|
|
|
1967
3920
|
/**
|
|
1968
|
-
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user
|
|
3921
|
+
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
3922
|
+
*
|
|
3923
|
+
* @param {string} params.userId - User ID.
|
|
3924
|
+
* @param {string} params.secret - Valid verification token.
|
|
3925
|
+
* @throws {AppwriteException}
|
|
3926
|
+
* @returns {Promise<Models.Token>}
|
|
3927
|
+
*/
|
|
3928
|
+
updatePhoneVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
3929
|
+
/**
|
|
3930
|
+
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1969
3931
|
*
|
|
1970
|
-
* @param {string} userId
|
|
1971
|
-
* @param {string} secret
|
|
3932
|
+
* @param {string} userId - User ID.
|
|
3933
|
+
* @param {string} secret - Valid verification token.
|
|
1972
3934
|
* @throws {AppwriteException}
|
|
1973
3935
|
* @returns {Promise<Models.Token>}
|
|
3936
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1974
3937
|
*/
|
|
1975
|
-
updatePhoneVerification(userId: string, secret: string): Promise<Models.Token
|
|
3938
|
+
updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
3939
|
+
updatePhoneVerification(
|
|
3940
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
3941
|
+
...rest: [(string)?]
|
|
3942
|
+
): Promise<Models.Token> {
|
|
3943
|
+
let params: { userId: string, secret: string };
|
|
3944
|
+
|
|
3945
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3946
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
3947
|
+
} else {
|
|
3948
|
+
params = {
|
|
3949
|
+
userId: paramsOrFirst as string,
|
|
3950
|
+
secret: rest[0] as string
|
|
3951
|
+
};
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
const userId = params.userId;
|
|
3955
|
+
const secret = params.secret;
|
|
3956
|
+
|
|
1976
3957
|
if (typeof userId === 'undefined') {
|
|
1977
3958
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1978
3959
|
}
|
|
1979
3960
|
if (typeof secret === 'undefined') {
|
|
1980
3961
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1981
3962
|
}
|
|
1982
|
-
|
|
3963
|
+
|
|
3964
|
+
const apiPath = '/account/verifications/phone';
|
|
1983
3965
|
const payload: Payload = {};
|
|
1984
3966
|
if (typeof userId !== 'undefined') {
|
|
1985
3967
|
payload['userId'] = userId;
|