@appwrite.io/console 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +9 -8
- package/CHANGELOG.md +51 -6
- package/LICENSE +1 -1
- package/README.md +84 -4
- package/dist/cjs/sdk.js +15258 -6036
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +15256 -6037
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +15258 -6036
- 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 +16 -11
- package/docs/examples/databases/create-documents.md +7 -6
- 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 +13 -0
- 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 +14 -0
- 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 -5
- 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 +42 -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 +1925 -239
- package/src/operator.ts +308 -0
- package/src/query.ts +246 -2
- package/src/services/account.ts +2278 -235
- package/src/services/assistant.ts +29 -3
- package/src/services/avatars.ts +511 -52
- package/src/services/backups.ts +400 -42
- package/src/services/console.ts +499 -19
- package/src/services/databases.ts +3584 -430
- package/src/services/domains.ts +1795 -266
- package/src/services/functions.ts +1197 -155
- package/src/services/graphql.ts +56 -4
- package/src/services/health.ts +586 -42
- package/src/services/locale.ts +18 -2
- package/src/services/messaging.ts +3418 -386
- package/src/services/migrations.ts +653 -65
- package/src/services/organizations.ts +1411 -126
- package/src/services/project.ts +173 -17
- package/src/services/projects.ts +2808 -282
- package/src/services/proxy.ts +272 -26
- package/src/services/realtime.ts +437 -0
- package/src/services/sites.ts +1129 -143
- package/src/services/storage.ts +672 -89
- package/src/services/tables-db.ts +5439 -0
- package/src/services/teams.ts +535 -65
- package/src/services/tokens.ts +171 -16
- package/src/services/users.ts +1916 -182
- package/src/services/vcs.ts +373 -41
- package/types/client.d.ts +14 -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 +1877 -422
- package/types/operator.d.ts +180 -0
- package/types/query.d.ts +198 -2
- package/types/services/account.d.ts +1020 -158
- package/types/services/assistant.d.ts +13 -2
- package/types/services/avatars.d.ts +263 -45
- package/types/services/backups.d.ts +190 -30
- package/types/services/console.d.ts +202 -15
- package/types/services/databases.d.ts +1756 -299
- package/types/services/domains.d.ts +971 -219
- package/types/services/functions.d.ts +622 -131
- package/types/services/graphql.d.ts +24 -2
- package/types/services/health.d.ts +246 -24
- package/types/services/locale.d.ts +2 -2
- package/types/services/messaging.d.ts +1670 -281
- package/types/services/migrations.d.ts +319 -53
- package/types/services/organizations.d.ts +664 -109
- 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 +580 -119
- package/types/services/storage.d.ts +362 -81
- package/types/services/tables-db.d.ts +2040 -0
- package/types/services/teams.d.ts +277 -61
- package/types/services/tokens.d.ts +80 -12
- package/types/services/users.d.ts +906 -149
- package/types/services/vcs.d.ts +182 -34
- 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';
|
|
@@ -18,7 +19,8 @@ export class Account {
|
|
|
18
19
|
* @throws {AppwriteException}
|
|
19
20
|
* @returns {Promise<Models.User<Preferences>>}
|
|
20
21
|
*/
|
|
21
|
-
get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
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);
|
|
@@ -33,17 +35,52 @@ export class Account {
|
|
|
33
35
|
payload
|
|
34
36
|
);
|
|
35
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
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).
|
|
41
|
+
*
|
|
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>>;
|
|
36
50
|
/**
|
|
37
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).
|
|
38
52
|
*
|
|
39
|
-
* @param {string} userId
|
|
40
|
-
* @param {string} email
|
|
41
|
-
* @param {string} password
|
|
42
|
-
* @param {string} name
|
|
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.
|
|
43
57
|
* @throws {AppwriteException}
|
|
44
58
|
* @returns {Promise<Models.User<Preferences>>}
|
|
59
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
45
60
|
*/
|
|
46
|
-
create<Preferences extends Models.Preferences>(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
|
+
|
|
47
84
|
if (typeof userId === 'undefined') {
|
|
48
85
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
49
86
|
}
|
|
@@ -53,6 +90,7 @@ export class Account {
|
|
|
53
90
|
if (typeof password === 'undefined') {
|
|
54
91
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
55
92
|
}
|
|
93
|
+
|
|
56
94
|
const apiPath = '/account';
|
|
57
95
|
const payload: Payload = {};
|
|
58
96
|
if (typeof userId !== 'undefined') {
|
|
@@ -80,6 +118,7 @@ export class Account {
|
|
|
80
118
|
payload
|
|
81
119
|
);
|
|
82
120
|
}
|
|
121
|
+
|
|
83
122
|
/**
|
|
84
123
|
* Delete the currently logged in user.
|
|
85
124
|
*
|
|
@@ -87,6 +126,7 @@ export class Account {
|
|
|
87
126
|
* @returns {Promise<{}>}
|
|
88
127
|
*/
|
|
89
128
|
delete(): Promise<{}> {
|
|
129
|
+
|
|
90
130
|
const apiPath = '/account';
|
|
91
131
|
const payload: Payload = {};
|
|
92
132
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -102,14 +142,40 @@ export class Account {
|
|
|
102
142
|
payload
|
|
103
143
|
);
|
|
104
144
|
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* List all billing addresses for a user.
|
|
148
|
+
*
|
|
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>;
|
|
105
154
|
/**
|
|
106
155
|
* List all billing addresses for a user.
|
|
107
156
|
*
|
|
108
|
-
* @param {string[]} queries
|
|
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
|
|
109
158
|
* @throws {AppwriteException}
|
|
110
159
|
* @returns {Promise<Models.BillingAddressList>}
|
|
160
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
111
161
|
*/
|
|
112
|
-
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
|
+
|
|
113
179
|
const apiPath = '/account/billing-addresses';
|
|
114
180
|
const payload: Payload = {};
|
|
115
181
|
if (typeof queries !== 'undefined') {
|
|
@@ -127,41 +193,83 @@ export class Account {
|
|
|
127
193
|
payload
|
|
128
194
|
);
|
|
129
195
|
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
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>;
|
|
130
210
|
/**
|
|
131
|
-
* Add a new billing address to a user
|
|
211
|
+
* Add a new billing address to a user's account.
|
|
132
212
|
*
|
|
133
|
-
* @param {string} country
|
|
134
|
-
* @param {string}
|
|
135
|
-
* @param {string}
|
|
136
|
-
* @param {string}
|
|
137
|
-
* @param {string}
|
|
138
|
-
* @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
|
|
139
219
|
* @throws {AppwriteException}
|
|
140
220
|
* @returns {Promise<Models.BillingAddress>}
|
|
221
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
141
222
|
*/
|
|
142
|
-
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
|
+
|
|
143
250
|
if (typeof country === 'undefined') {
|
|
144
251
|
throw new AppwriteException('Missing required parameter: "country"');
|
|
145
252
|
}
|
|
146
|
-
if (typeof streetAddress === 'undefined') {
|
|
147
|
-
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
148
|
-
}
|
|
149
253
|
if (typeof city === 'undefined') {
|
|
150
254
|
throw new AppwriteException('Missing required parameter: "city"');
|
|
151
255
|
}
|
|
152
|
-
if (typeof
|
|
153
|
-
throw new AppwriteException('Missing required parameter: "
|
|
256
|
+
if (typeof streetAddress === 'undefined') {
|
|
257
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
154
258
|
}
|
|
259
|
+
|
|
155
260
|
const apiPath = '/account/billing-addresses';
|
|
156
261
|
const payload: Payload = {};
|
|
157
262
|
if (typeof country !== 'undefined') {
|
|
158
263
|
payload['country'] = country;
|
|
159
264
|
}
|
|
265
|
+
if (typeof city !== 'undefined') {
|
|
266
|
+
payload['city'] = city;
|
|
267
|
+
}
|
|
160
268
|
if (typeof streetAddress !== 'undefined') {
|
|
161
269
|
payload['streetAddress'] = streetAddress;
|
|
162
270
|
}
|
|
163
|
-
if (typeof
|
|
164
|
-
payload['
|
|
271
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
272
|
+
payload['addressLine2'] = addressLine2;
|
|
165
273
|
}
|
|
166
274
|
if (typeof state !== 'undefined') {
|
|
167
275
|
payload['state'] = state;
|
|
@@ -169,9 +277,6 @@ export class Account {
|
|
|
169
277
|
if (typeof postalCode !== 'undefined') {
|
|
170
278
|
payload['postalCode'] = postalCode;
|
|
171
279
|
}
|
|
172
|
-
if (typeof addressLine2 !== 'undefined') {
|
|
173
|
-
payload['addressLine2'] = addressLine2;
|
|
174
|
-
}
|
|
175
280
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
176
281
|
|
|
177
282
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -185,17 +290,43 @@ export class Account {
|
|
|
185
290
|
payload
|
|
186
291
|
);
|
|
187
292
|
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
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>;
|
|
188
302
|
/**
|
|
189
|
-
* Get a specific billing address for a user using it
|
|
303
|
+
* Get a specific billing address for a user using it's ID.
|
|
190
304
|
*
|
|
191
|
-
* @param {string} billingAddressId
|
|
305
|
+
* @param {string} billingAddressId - Unique ID of billing address
|
|
192
306
|
* @throws {AppwriteException}
|
|
193
307
|
* @returns {Promise<Models.BillingAddress>}
|
|
308
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
194
309
|
*/
|
|
195
|
-
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
|
+
|
|
196
326
|
if (typeof billingAddressId === 'undefined') {
|
|
197
327
|
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
198
328
|
}
|
|
329
|
+
|
|
199
330
|
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
200
331
|
const payload: Payload = {};
|
|
201
332
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -210,45 +341,90 @@ export class Account {
|
|
|
210
341
|
payload
|
|
211
342
|
);
|
|
212
343
|
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Update a specific billing address using it's ID.
|
|
347
|
+
*
|
|
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
|
|
355
|
+
* @throws {AppwriteException}
|
|
356
|
+
* @returns {Promise<Models.BillingAddress>}
|
|
357
|
+
*/
|
|
358
|
+
updateBillingAddress(params: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string }): Promise<Models.BillingAddress>;
|
|
213
359
|
/**
|
|
214
|
-
* Update a specific billing address using it
|
|
360
|
+
* Update a specific billing address using it's ID.
|
|
215
361
|
*
|
|
216
|
-
* @param {string} billingAddressId
|
|
217
|
-
* @param {string} country
|
|
218
|
-
* @param {string}
|
|
219
|
-
* @param {string}
|
|
220
|
-
* @param {string}
|
|
221
|
-
* @param {string}
|
|
222
|
-
* @param {string}
|
|
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
|
|
223
369
|
* @throws {AppwriteException}
|
|
224
370
|
* @returns {Promise<Models.BillingAddress>}
|
|
371
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
225
372
|
*/
|
|
226
|
-
updateBillingAddress(billingAddressId: string, country: string,
|
|
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
|
+
|
|
227
402
|
if (typeof billingAddressId === 'undefined') {
|
|
228
403
|
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
229
404
|
}
|
|
230
405
|
if (typeof country === 'undefined') {
|
|
231
406
|
throw new AppwriteException('Missing required parameter: "country"');
|
|
232
407
|
}
|
|
233
|
-
if (typeof streetAddress === 'undefined') {
|
|
234
|
-
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
235
|
-
}
|
|
236
408
|
if (typeof city === 'undefined') {
|
|
237
409
|
throw new AppwriteException('Missing required parameter: "city"');
|
|
238
410
|
}
|
|
239
|
-
if (typeof
|
|
240
|
-
throw new AppwriteException('Missing required parameter: "
|
|
411
|
+
if (typeof streetAddress === 'undefined') {
|
|
412
|
+
throw new AppwriteException('Missing required parameter: "streetAddress"');
|
|
241
413
|
}
|
|
414
|
+
|
|
242
415
|
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
243
416
|
const payload: Payload = {};
|
|
244
417
|
if (typeof country !== 'undefined') {
|
|
245
418
|
payload['country'] = country;
|
|
246
419
|
}
|
|
420
|
+
if (typeof city !== 'undefined') {
|
|
421
|
+
payload['city'] = city;
|
|
422
|
+
}
|
|
247
423
|
if (typeof streetAddress !== 'undefined') {
|
|
248
424
|
payload['streetAddress'] = streetAddress;
|
|
249
425
|
}
|
|
250
|
-
if (typeof
|
|
251
|
-
payload['
|
|
426
|
+
if (typeof addressLine2 !== 'undefined') {
|
|
427
|
+
payload['addressLine2'] = addressLine2;
|
|
252
428
|
}
|
|
253
429
|
if (typeof state !== 'undefined') {
|
|
254
430
|
payload['state'] = state;
|
|
@@ -256,9 +432,6 @@ export class Account {
|
|
|
256
432
|
if (typeof postalCode !== 'undefined') {
|
|
257
433
|
payload['postalCode'] = postalCode;
|
|
258
434
|
}
|
|
259
|
-
if (typeof addressLine2 !== 'undefined') {
|
|
260
|
-
payload['addressLine2'] = addressLine2;
|
|
261
|
-
}
|
|
262
435
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
263
436
|
|
|
264
437
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -272,17 +445,43 @@ export class Account {
|
|
|
272
445
|
payload
|
|
273
446
|
);
|
|
274
447
|
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
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<{}>;
|
|
275
457
|
/**
|
|
276
|
-
* Delete a specific billing address using it
|
|
458
|
+
* Delete a specific billing address using it's ID.
|
|
277
459
|
*
|
|
278
|
-
* @param {string} billingAddressId
|
|
460
|
+
* @param {string} billingAddressId - Billing address unique ID
|
|
279
461
|
* @throws {AppwriteException}
|
|
280
462
|
* @returns {Promise<{}>}
|
|
463
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
281
464
|
*/
|
|
282
|
-
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
|
+
|
|
283
481
|
if (typeof billingAddressId === 'undefined') {
|
|
284
482
|
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
285
483
|
}
|
|
484
|
+
|
|
286
485
|
const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
|
|
287
486
|
const payload: Payload = {};
|
|
288
487
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -298,17 +497,43 @@ export class Account {
|
|
|
298
497
|
payload
|
|
299
498
|
);
|
|
300
499
|
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Get coupon details for an account.
|
|
503
|
+
*
|
|
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>;
|
|
301
509
|
/**
|
|
302
510
|
* Get coupon details for an account.
|
|
303
511
|
*
|
|
304
|
-
* @param {string} couponId
|
|
512
|
+
* @param {string} couponId - ID of the coupon
|
|
305
513
|
* @throws {AppwriteException}
|
|
306
514
|
* @returns {Promise<Models.Coupon>}
|
|
515
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
307
516
|
*/
|
|
308
|
-
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
|
+
|
|
309
533
|
if (typeof couponId === 'undefined') {
|
|
310
534
|
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
311
535
|
}
|
|
536
|
+
|
|
312
537
|
const apiPath = '/account/coupons/{couponId}'.replace('{couponId}', couponId);
|
|
313
538
|
const payload: Payload = {};
|
|
314
539
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -323,23 +548,55 @@ export class Account {
|
|
|
323
548
|
payload
|
|
324
549
|
);
|
|
325
550
|
}
|
|
551
|
+
|
|
326
552
|
/**
|
|
327
553
|
* 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.
|
|
328
|
-
This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
329
|
-
|
|
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.
|
|
555
|
+
*
|
|
556
|
+
*
|
|
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
|
+
*
|
|
330
567
|
*
|
|
331
|
-
* @param {string} email
|
|
332
|
-
* @param {string} password
|
|
568
|
+
* @param {string} email - User email.
|
|
569
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
333
570
|
* @throws {AppwriteException}
|
|
334
571
|
* @returns {Promise<Models.User<Preferences>>}
|
|
572
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
335
573
|
*/
|
|
336
|
-
updateEmail<Preferences extends Models.Preferences>(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
|
+
|
|
337
593
|
if (typeof email === 'undefined') {
|
|
338
594
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
339
595
|
}
|
|
340
596
|
if (typeof password === 'undefined') {
|
|
341
597
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
342
598
|
}
|
|
599
|
+
|
|
343
600
|
const apiPath = '/account/email';
|
|
344
601
|
const payload: Payload = {};
|
|
345
602
|
if (typeof email !== 'undefined') {
|
|
@@ -361,19 +618,53 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
361
618
|
payload
|
|
362
619
|
);
|
|
363
620
|
}
|
|
621
|
+
|
|
364
622
|
/**
|
|
365
623
|
* Get the list of identities for the currently logged in user.
|
|
366
624
|
*
|
|
367
|
-
* @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.
|
|
368
627
|
* @throws {AppwriteException}
|
|
369
628
|
* @returns {Promise<Models.IdentityList>}
|
|
370
629
|
*/
|
|
371
|
-
listIdentities(queries?: string[]): Promise<Models.IdentityList
|
|
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.
|
|
636
|
+
* @throws {AppwriteException}
|
|
637
|
+
* @returns {Promise<Models.IdentityList>}
|
|
638
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
639
|
+
*/
|
|
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
|
+
|
|
372
660
|
const apiPath = '/account/identities';
|
|
373
661
|
const payload: Payload = {};
|
|
374
662
|
if (typeof queries !== 'undefined') {
|
|
375
663
|
payload['queries'] = queries;
|
|
376
664
|
}
|
|
665
|
+
if (typeof total !== 'undefined') {
|
|
666
|
+
payload['total'] = total;
|
|
667
|
+
}
|
|
377
668
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
378
669
|
|
|
379
670
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -386,17 +677,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
386
677
|
payload
|
|
387
678
|
);
|
|
388
679
|
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Delete an identity by its unique ID.
|
|
683
|
+
*
|
|
684
|
+
* @param {string} params.identityId - Identity ID.
|
|
685
|
+
* @throws {AppwriteException}
|
|
686
|
+
* @returns {Promise<{}>}
|
|
687
|
+
*/
|
|
688
|
+
deleteIdentity(params: { identityId: string }): Promise<{}>;
|
|
389
689
|
/**
|
|
390
690
|
* Delete an identity by its unique ID.
|
|
391
691
|
*
|
|
392
|
-
* @param {string} identityId
|
|
692
|
+
* @param {string} identityId - Identity ID.
|
|
393
693
|
* @throws {AppwriteException}
|
|
394
694
|
* @returns {Promise<{}>}
|
|
695
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
395
696
|
*/
|
|
396
|
-
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
|
+
|
|
397
713
|
if (typeof identityId === 'undefined') {
|
|
398
714
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
399
715
|
}
|
|
716
|
+
|
|
400
717
|
const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
|
|
401
718
|
const payload: Payload = {};
|
|
402
719
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -412,14 +729,40 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
412
729
|
payload
|
|
413
730
|
);
|
|
414
731
|
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* List all invoices tied to an account.
|
|
735
|
+
*
|
|
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
|
|
737
|
+
* @throws {AppwriteException}
|
|
738
|
+
* @returns {Promise<Models.InvoiceList>}
|
|
739
|
+
*/
|
|
740
|
+
listInvoices(params?: { queries?: string[] }): Promise<Models.InvoiceList>;
|
|
415
741
|
/**
|
|
416
742
|
* List all invoices tied to an account.
|
|
417
743
|
*
|
|
418
|
-
* @param {string[]} queries
|
|
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
|
|
419
745
|
* @throws {AppwriteException}
|
|
420
746
|
* @returns {Promise<Models.InvoiceList>}
|
|
747
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
421
748
|
*/
|
|
422
|
-
listInvoices(queries?: string[]): Promise<Models.InvoiceList
|
|
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
|
+
|
|
423
766
|
const apiPath = '/account/invoices';
|
|
424
767
|
const payload: Payload = {};
|
|
425
768
|
if (typeof queries !== 'undefined') {
|
|
@@ -437,15 +780,45 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
437
780
|
payload
|
|
438
781
|
);
|
|
439
782
|
}
|
|
783
|
+
|
|
440
784
|
/**
|
|
441
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.
|
|
442
786
|
*
|
|
787
|
+
* @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
|
443
788
|
* @throws {AppwriteException}
|
|
444
789
|
* @returns {Promise<Models.Jwt>}
|
|
445
790
|
*/
|
|
446
|
-
createJWT(): Promise<Models.Jwt
|
|
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.
|
|
796
|
+
* @throws {AppwriteException}
|
|
797
|
+
* @returns {Promise<Models.Jwt>}
|
|
798
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
799
|
+
*/
|
|
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
|
+
|
|
447
817
|
const apiPath = '/account/jwts';
|
|
448
818
|
const payload: Payload = {};
|
|
819
|
+
if (typeof duration !== 'undefined') {
|
|
820
|
+
payload['duration'] = duration;
|
|
821
|
+
}
|
|
449
822
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
450
823
|
|
|
451
824
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -459,19 +832,53 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
459
832
|
payload
|
|
460
833
|
);
|
|
461
834
|
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
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.
|
|
838
|
+
*
|
|
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>;
|
|
462
845
|
/**
|
|
463
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.
|
|
464
847
|
*
|
|
465
|
-
* @param {string[]} queries
|
|
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.
|
|
466
850
|
* @throws {AppwriteException}
|
|
467
851
|
* @returns {Promise<Models.LogList>}
|
|
852
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
468
853
|
*/
|
|
469
|
-
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
|
+
|
|
470
874
|
const apiPath = '/account/logs';
|
|
471
875
|
const payload: Payload = {};
|
|
472
876
|
if (typeof queries !== 'undefined') {
|
|
473
877
|
payload['queries'] = queries;
|
|
474
878
|
}
|
|
879
|
+
if (typeof total !== 'undefined') {
|
|
880
|
+
payload['total'] = total;
|
|
881
|
+
}
|
|
475
882
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
476
883
|
|
|
477
884
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -484,17 +891,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
484
891
|
payload
|
|
485
892
|
);
|
|
486
893
|
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Enable or disable MFA on an account.
|
|
897
|
+
*
|
|
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>>;
|
|
487
903
|
/**
|
|
488
904
|
* Enable or disable MFA on an account.
|
|
489
905
|
*
|
|
490
|
-
* @param {boolean} mfa
|
|
906
|
+
* @param {boolean} mfa - Enable or disable MFA.
|
|
491
907
|
* @throws {AppwriteException}
|
|
492
908
|
* @returns {Promise<Models.User<Preferences>>}
|
|
909
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
493
910
|
*/
|
|
494
|
-
updateMFA<Preferences extends Models.Preferences>(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
|
+
|
|
495
927
|
if (typeof mfa === 'undefined') {
|
|
496
928
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
497
929
|
}
|
|
930
|
+
|
|
498
931
|
const apiPath = '/account/mfa';
|
|
499
932
|
const payload: Payload = {};
|
|
500
933
|
if (typeof mfa !== 'undefined') {
|
|
@@ -513,17 +946,44 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
513
946
|
payload
|
|
514
947
|
);
|
|
515
948
|
}
|
|
949
|
+
|
|
950
|
+
/**
|
|
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.
|
|
952
|
+
*
|
|
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>;
|
|
516
959
|
/**
|
|
517
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.
|
|
518
961
|
*
|
|
519
|
-
* @param {AuthenticatorType} type
|
|
962
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
520
963
|
* @throws {AppwriteException}
|
|
521
964
|
* @returns {Promise<Models.MfaType>}
|
|
965
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
522
966
|
*/
|
|
523
|
-
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
|
+
|
|
524
983
|
if (typeof type === 'undefined') {
|
|
525
984
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
526
985
|
}
|
|
986
|
+
|
|
527
987
|
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
528
988
|
const payload: Payload = {};
|
|
529
989
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -539,26 +999,45 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
539
999
|
payload
|
|
540
1000
|
);
|
|
541
1001
|
}
|
|
1002
|
+
|
|
542
1003
|
/**
|
|
543
|
-
*
|
|
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.
|
|
544
1005
|
*
|
|
545
|
-
* @param {AuthenticatorType} type
|
|
546
|
-
* @param {string} otp
|
|
1006
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
547
1007
|
* @throws {AppwriteException}
|
|
548
|
-
* @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.
|
|
549
1018
|
*/
|
|
550
|
-
|
|
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
|
+
|
|
551
1035
|
if (typeof type === 'undefined') {
|
|
552
1036
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
553
1037
|
}
|
|
554
|
-
|
|
555
|
-
throw new AppwriteException('Missing required parameter: "otp"');
|
|
556
|
-
}
|
|
1038
|
+
|
|
557
1039
|
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
558
1040
|
const payload: Payload = {};
|
|
559
|
-
if (typeof otp !== 'undefined') {
|
|
560
|
-
payload['otp'] = otp;
|
|
561
|
-
}
|
|
562
1041
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
563
1042
|
|
|
564
1043
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -566,23 +1045,229 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
566
1045
|
}
|
|
567
1046
|
|
|
568
1047
|
return this.client.call(
|
|
569
|
-
'
|
|
1048
|
+
'post',
|
|
570
1049
|
uri,
|
|
571
1050
|
apiHeaders,
|
|
572
1051
|
payload
|
|
573
1052
|
);
|
|
574
1053
|
}
|
|
1054
|
+
|
|
575
1055
|
/**
|
|
576
|
-
*
|
|
1056
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
1057
|
+
*
|
|
1058
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
1059
|
+
* @param {string} params.otp - Valid verification token.
|
|
1060
|
+
* @throws {AppwriteException}
|
|
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.
|
|
1073
|
+
*/
|
|
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
|
+
|
|
1093
|
+
if (typeof type === 'undefined') {
|
|
1094
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
1095
|
+
}
|
|
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);
|
|
1222
|
+
|
|
1223
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1224
|
+
'content-type': 'application/json',
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
return this.client.call(
|
|
1228
|
+
'delete',
|
|
1229
|
+
uri,
|
|
1230
|
+
apiHeaders,
|
|
1231
|
+
payload
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
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.
|
|
577
1245
|
*
|
|
578
|
-
* @param {AuthenticatorType} type
|
|
1246
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
579
1247
|
* @throws {AppwriteException}
|
|
580
1248
|
* @returns {Promise<{}>}
|
|
1249
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
581
1250
|
*/
|
|
582
|
-
|
|
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
|
+
|
|
583
1267
|
if (typeof type === 'undefined') {
|
|
584
1268
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
585
1269
|
}
|
|
1270
|
+
|
|
586
1271
|
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
587
1272
|
const payload: Payload = {};
|
|
588
1273
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -598,18 +1283,100 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
598
1283
|
payload
|
|
599
1284
|
);
|
|
600
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
|
+
|
|
601
1343
|
/**
|
|
602
1344
|
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
603
1345
|
*
|
|
604
|
-
* @param {AuthenticationFactor} factor
|
|
1346
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
605
1347
|
* @throws {AppwriteException}
|
|
606
1348
|
* @returns {Promise<Models.MfaChallenge>}
|
|
607
1349
|
*/
|
|
608
|
-
|
|
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
|
+
|
|
609
1375
|
if (typeof factor === 'undefined') {
|
|
610
1376
|
throw new AppwriteException('Missing required parameter: "factor"');
|
|
611
1377
|
}
|
|
612
|
-
|
|
1378
|
+
|
|
1379
|
+
const apiPath = '/account/mfa/challenges';
|
|
613
1380
|
const payload: Payload = {};
|
|
614
1381
|
if (typeof factor !== 'undefined') {
|
|
615
1382
|
payload['factor'] = factor;
|
|
@@ -627,22 +1394,119 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
627
1394
|
payload
|
|
628
1395
|
);
|
|
629
1396
|
}
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
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.
|
|
1400
|
+
*
|
|
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
|
+
|
|
630
1465
|
/**
|
|
631
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.
|
|
632
1467
|
*
|
|
633
|
-
* @param {string} challengeId
|
|
634
|
-
* @param {string} otp
|
|
1468
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
1469
|
+
* @param {string} params.otp - Valid verification token.
|
|
635
1470
|
* @throws {AppwriteException}
|
|
636
1471
|
* @returns {Promise<Models.Session>}
|
|
637
1472
|
*/
|
|
638
|
-
|
|
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
|
+
|
|
639
1502
|
if (typeof challengeId === 'undefined') {
|
|
640
1503
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
641
1504
|
}
|
|
642
1505
|
if (typeof otp === 'undefined') {
|
|
643
1506
|
throw new AppwriteException('Missing required parameter: "otp"');
|
|
644
1507
|
}
|
|
645
|
-
|
|
1508
|
+
|
|
1509
|
+
const apiPath = '/account/mfa/challenges';
|
|
646
1510
|
const payload: Payload = {};
|
|
647
1511
|
if (typeof challengeId !== 'undefined') {
|
|
648
1512
|
payload['challengeId'] = challengeId;
|
|
@@ -663,55 +1527,159 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
663
1527
|
payload
|
|
664
1528
|
);
|
|
665
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
|
+
|
|
666
1555
|
/**
|
|
667
1556
|
* List the factors available on the account to be used as a MFA challange.
|
|
668
1557
|
*
|
|
669
1558
|
* @throws {AppwriteException}
|
|
670
1559
|
* @returns {Promise<Models.MfaFactors>}
|
|
671
1560
|
*/
|
|
672
|
-
|
|
673
|
-
|
|
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';
|
|
1611
|
+
const payload: Payload = {};
|
|
1612
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1613
|
+
|
|
1614
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
return this.client.call(
|
|
1618
|
+
'get',
|
|
1619
|
+
uri,
|
|
1620
|
+
apiHeaders,
|
|
1621
|
+
payload
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
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.
|
|
1627
|
+
*
|
|
1628
|
+
* @throws {AppwriteException}
|
|
1629
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
1630
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
|
|
1631
|
+
*/
|
|
1632
|
+
createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1633
|
+
|
|
1634
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
674
1635
|
const payload: Payload = {};
|
|
675
1636
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
676
1637
|
|
|
677
1638
|
const apiHeaders: { [header: string]: string } = {
|
|
1639
|
+
'content-type': 'application/json',
|
|
678
1640
|
}
|
|
679
1641
|
|
|
680
1642
|
return this.client.call(
|
|
681
|
-
'
|
|
1643
|
+
'post',
|
|
682
1644
|
uri,
|
|
683
1645
|
apiHeaders,
|
|
684
1646
|
payload
|
|
685
1647
|
);
|
|
686
1648
|
}
|
|
1649
|
+
|
|
687
1650
|
/**
|
|
688
|
-
*
|
|
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.
|
|
689
1652
|
*
|
|
690
1653
|
* @throws {AppwriteException}
|
|
691
1654
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
692
1655
|
*/
|
|
693
|
-
|
|
1656
|
+
createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1657
|
+
|
|
694
1658
|
const apiPath = '/account/mfa/recovery-codes';
|
|
695
1659
|
const payload: Payload = {};
|
|
696
1660
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
697
1661
|
|
|
698
1662
|
const apiHeaders: { [header: string]: string } = {
|
|
1663
|
+
'content-type': 'application/json',
|
|
699
1664
|
}
|
|
700
1665
|
|
|
701
1666
|
return this.client.call(
|
|
702
|
-
'
|
|
1667
|
+
'post',
|
|
703
1668
|
uri,
|
|
704
1669
|
apiHeaders,
|
|
705
1670
|
payload
|
|
706
1671
|
);
|
|
707
1672
|
}
|
|
1673
|
+
|
|
708
1674
|
/**
|
|
709
|
-
*
|
|
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.
|
|
710
1676
|
*
|
|
711
1677
|
* @throws {AppwriteException}
|
|
712
1678
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
1679
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
|
|
713
1680
|
*/
|
|
714
|
-
|
|
1681
|
+
updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1682
|
+
|
|
715
1683
|
const apiPath = '/account/mfa/recovery-codes';
|
|
716
1684
|
const payload: Payload = {};
|
|
717
1685
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -721,19 +1689,21 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
721
1689
|
}
|
|
722
1690
|
|
|
723
1691
|
return this.client.call(
|
|
724
|
-
'
|
|
1692
|
+
'patch',
|
|
725
1693
|
uri,
|
|
726
1694
|
apiHeaders,
|
|
727
1695
|
payload
|
|
728
1696
|
);
|
|
729
1697
|
}
|
|
1698
|
+
|
|
730
1699
|
/**
|
|
731
1700
|
* 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.
|
|
732
1701
|
*
|
|
733
1702
|
* @throws {AppwriteException}
|
|
734
1703
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
735
1704
|
*/
|
|
736
|
-
|
|
1705
|
+
updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1706
|
+
|
|
737
1707
|
const apiPath = '/account/mfa/recovery-codes';
|
|
738
1708
|
const payload: Payload = {};
|
|
739
1709
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -749,17 +1719,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
749
1719
|
payload
|
|
750
1720
|
);
|
|
751
1721
|
}
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* Update currently logged in user account name.
|
|
1725
|
+
*
|
|
1726
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
1727
|
+
* @throws {AppwriteException}
|
|
1728
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1729
|
+
*/
|
|
1730
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { name: string }): Promise<Models.User<Preferences>>;
|
|
752
1731
|
/**
|
|
753
1732
|
* Update currently logged in user account name.
|
|
754
1733
|
*
|
|
755
|
-
* @param {string} name
|
|
1734
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
756
1735
|
* @throws {AppwriteException}
|
|
757
1736
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1737
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
758
1738
|
*/
|
|
759
|
-
updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences
|
|
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
|
+
|
|
760
1755
|
if (typeof name === 'undefined') {
|
|
761
1756
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
762
1757
|
}
|
|
1758
|
+
|
|
763
1759
|
const apiPath = '/account/name';
|
|
764
1760
|
const payload: Payload = {};
|
|
765
1761
|
if (typeof name !== 'undefined') {
|
|
@@ -778,18 +1774,48 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
778
1774
|
payload
|
|
779
1775
|
);
|
|
780
1776
|
}
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
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.
|
|
1780
|
+
*
|
|
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>>;
|
|
781
1787
|
/**
|
|
782
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.
|
|
783
1789
|
*
|
|
784
|
-
* @param {string} password
|
|
785
|
-
* @param {string} oldPassword
|
|
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.
|
|
786
1792
|
* @throws {AppwriteException}
|
|
787
1793
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1794
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
788
1795
|
*/
|
|
789
|
-
updatePassword<Preferences extends Models.Preferences>(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
|
+
|
|
790
1815
|
if (typeof password === 'undefined') {
|
|
791
1816
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
792
1817
|
}
|
|
1818
|
+
|
|
793
1819
|
const apiPath = '/account/password';
|
|
794
1820
|
const payload: Payload = {};
|
|
795
1821
|
if (typeof password !== 'undefined') {
|
|
@@ -811,14 +1837,40 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
811
1837
|
payload
|
|
812
1838
|
);
|
|
813
1839
|
}
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* List payment methods for this account.
|
|
1843
|
+
*
|
|
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
|
|
1845
|
+
* @throws {AppwriteException}
|
|
1846
|
+
* @returns {Promise<Models.PaymentMethodList>}
|
|
1847
|
+
*/
|
|
1848
|
+
listPaymentMethods(params?: { queries?: string[] }): Promise<Models.PaymentMethodList>;
|
|
814
1849
|
/**
|
|
815
1850
|
* List payment methods for this account.
|
|
816
1851
|
*
|
|
817
|
-
* @param {string[]} queries
|
|
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
|
|
818
1853
|
* @throws {AppwriteException}
|
|
819
1854
|
* @returns {Promise<Models.PaymentMethodList>}
|
|
1855
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
820
1856
|
*/
|
|
821
|
-
listPaymentMethods(queries?: string[]): Promise<Models.PaymentMethodList
|
|
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
|
+
|
|
822
1874
|
const apiPath = '/account/payment-methods';
|
|
823
1875
|
const payload: Payload = {};
|
|
824
1876
|
if (typeof queries !== 'undefined') {
|
|
@@ -836,6 +1888,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
836
1888
|
payload
|
|
837
1889
|
);
|
|
838
1890
|
}
|
|
1891
|
+
|
|
839
1892
|
/**
|
|
840
1893
|
* Create a new payment method for the current user account.
|
|
841
1894
|
*
|
|
@@ -843,6 +1896,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
843
1896
|
* @returns {Promise<Models.PaymentMethod>}
|
|
844
1897
|
*/
|
|
845
1898
|
createPaymentMethod(): Promise<Models.PaymentMethod> {
|
|
1899
|
+
|
|
846
1900
|
const apiPath = '/account/payment-methods';
|
|
847
1901
|
const payload: Payload = {};
|
|
848
1902
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -858,17 +1912,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
858
1912
|
payload
|
|
859
1913
|
);
|
|
860
1914
|
}
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Get a specific payment method for the user.
|
|
1918
|
+
*
|
|
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>;
|
|
861
1924
|
/**
|
|
862
1925
|
* Get a specific payment method for the user.
|
|
863
1926
|
*
|
|
864
|
-
* @param {string} paymentMethodId
|
|
1927
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
865
1928
|
* @throws {AppwriteException}
|
|
866
1929
|
* @returns {Promise<Models.PaymentMethod>}
|
|
1930
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
867
1931
|
*/
|
|
868
|
-
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
|
+
|
|
869
1948
|
if (typeof paymentMethodId === 'undefined') {
|
|
870
1949
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
871
1950
|
}
|
|
1951
|
+
|
|
872
1952
|
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
873
1953
|
const payload: Payload = {};
|
|
874
1954
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -883,16 +1963,52 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
883
1963
|
payload
|
|
884
1964
|
);
|
|
885
1965
|
}
|
|
1966
|
+
|
|
886
1967
|
/**
|
|
887
1968
|
* Update a new payment method for the current user account.
|
|
888
1969
|
*
|
|
889
|
-
* @param {string} paymentMethodId
|
|
890
|
-
* @param {number} expiryMonth
|
|
891
|
-
* @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
|
|
892
1974
|
* @throws {AppwriteException}
|
|
893
1975
|
* @returns {Promise<Models.PaymentMethod>}
|
|
894
1976
|
*/
|
|
895
|
-
updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number): Promise<Models.PaymentMethod
|
|
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
|
|
1985
|
+
* @throws {AppwriteException}
|
|
1986
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
1987
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1988
|
+
*/
|
|
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
|
+
|
|
896
2012
|
if (typeof paymentMethodId === 'undefined') {
|
|
897
2013
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
898
2014
|
}
|
|
@@ -902,6 +2018,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
902
2018
|
if (typeof expiryYear === 'undefined') {
|
|
903
2019
|
throw new AppwriteException('Missing required parameter: "expiryYear"');
|
|
904
2020
|
}
|
|
2021
|
+
|
|
905
2022
|
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
906
2023
|
const payload: Payload = {};
|
|
907
2024
|
if (typeof expiryMonth !== 'undefined') {
|
|
@@ -910,6 +2027,9 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
910
2027
|
if (typeof expiryYear !== 'undefined') {
|
|
911
2028
|
payload['expiryYear'] = expiryYear;
|
|
912
2029
|
}
|
|
2030
|
+
if (typeof state !== 'undefined') {
|
|
2031
|
+
payload['state'] = state;
|
|
2032
|
+
}
|
|
913
2033
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
914
2034
|
|
|
915
2035
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -923,17 +2043,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
923
2043
|
payload
|
|
924
2044
|
);
|
|
925
2045
|
}
|
|
2046
|
+
|
|
926
2047
|
/**
|
|
927
|
-
* Delete a specific payment method from a user
|
|
2048
|
+
* Delete a specific payment method from a user's account.
|
|
928
2049
|
*
|
|
929
|
-
* @param {string} paymentMethodId
|
|
2050
|
+
* @param {string} params.paymentMethodId - Unique ID of payment method
|
|
930
2051
|
* @throws {AppwriteException}
|
|
931
2052
|
* @returns {Promise<{}>}
|
|
932
2053
|
*/
|
|
933
|
-
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
|
+
|
|
934
2079
|
if (typeof paymentMethodId === 'undefined') {
|
|
935
2080
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
936
2081
|
}
|
|
2082
|
+
|
|
937
2083
|
const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
|
|
938
2084
|
const payload: Payload = {};
|
|
939
2085
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -949,16 +2095,52 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
949
2095
|
payload
|
|
950
2096
|
);
|
|
951
2097
|
}
|
|
2098
|
+
|
|
2099
|
+
/**
|
|
2100
|
+
* Update payment method provider.
|
|
2101
|
+
*
|
|
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>;
|
|
952
2110
|
/**
|
|
953
2111
|
* Update payment method provider.
|
|
954
2112
|
*
|
|
955
|
-
* @param {string} paymentMethodId
|
|
956
|
-
* @param {string} providerMethodId
|
|
957
|
-
* @param {string} name
|
|
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
|
|
958
2117
|
* @throws {AppwriteException}
|
|
959
2118
|
* @returns {Promise<Models.PaymentMethod>}
|
|
2119
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
960
2120
|
*/
|
|
961
|
-
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
|
+
|
|
962
2144
|
if (typeof paymentMethodId === 'undefined') {
|
|
963
2145
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
964
2146
|
}
|
|
@@ -968,6 +2150,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
968
2150
|
if (typeof name === 'undefined') {
|
|
969
2151
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
970
2152
|
}
|
|
2153
|
+
|
|
971
2154
|
const apiPath = '/account/payment-methods/{paymentMethodId}/provider'.replace('{paymentMethodId}', paymentMethodId);
|
|
972
2155
|
const payload: Payload = {};
|
|
973
2156
|
if (typeof providerMethodId !== 'undefined') {
|
|
@@ -976,6 +2159,9 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
976
2159
|
if (typeof name !== 'undefined') {
|
|
977
2160
|
payload['name'] = name;
|
|
978
2161
|
}
|
|
2162
|
+
if (typeof state !== 'undefined') {
|
|
2163
|
+
payload['state'] = state;
|
|
2164
|
+
}
|
|
979
2165
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
980
2166
|
|
|
981
2167
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -989,17 +2175,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
989
2175
|
payload
|
|
990
2176
|
);
|
|
991
2177
|
}
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* Update payment method mandate options.
|
|
2181
|
+
*
|
|
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>;
|
|
992
2187
|
/**
|
|
993
2188
|
* Update payment method mandate options.
|
|
994
2189
|
*
|
|
995
|
-
* @param {string} paymentMethodId
|
|
2190
|
+
* @param {string} paymentMethodId - Unique ID of payment method
|
|
996
2191
|
* @throws {AppwriteException}
|
|
997
2192
|
* @returns {Promise<Models.PaymentMethod>}
|
|
2193
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
998
2194
|
*/
|
|
999
|
-
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
|
+
|
|
1000
2211
|
if (typeof paymentMethodId === 'undefined') {
|
|
1001
2212
|
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
1002
2213
|
}
|
|
2214
|
+
|
|
1003
2215
|
const apiPath = '/account/payment-methods/{paymentMethodId}/setup'.replace('{paymentMethodId}', paymentMethodId);
|
|
1004
2216
|
const payload: Payload = {};
|
|
1005
2217
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1015,21 +2227,51 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1015
2227
|
payload
|
|
1016
2228
|
);
|
|
1017
2229
|
}
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
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>>;
|
|
1018
2240
|
/**
|
|
1019
|
-
* Update the currently logged in user
|
|
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.
|
|
1020
2242
|
*
|
|
1021
|
-
* @param {string} phone
|
|
1022
|
-
* @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.
|
|
1023
2245
|
* @throws {AppwriteException}
|
|
1024
2246
|
* @returns {Promise<Models.User<Preferences>>}
|
|
2247
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1025
2248
|
*/
|
|
1026
|
-
updatePhone<Preferences extends Models.Preferences>(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
|
+
|
|
1027
2268
|
if (typeof phone === 'undefined') {
|
|
1028
2269
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1029
2270
|
}
|
|
1030
2271
|
if (typeof password === 'undefined') {
|
|
1031
2272
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
1032
2273
|
}
|
|
2274
|
+
|
|
1033
2275
|
const apiPath = '/account/phone';
|
|
1034
2276
|
const payload: Payload = {};
|
|
1035
2277
|
if (typeof phone !== 'undefined') {
|
|
@@ -1051,13 +2293,15 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1051
2293
|
payload
|
|
1052
2294
|
);
|
|
1053
2295
|
}
|
|
2296
|
+
|
|
1054
2297
|
/**
|
|
1055
2298
|
* Get the preferences as a key-value object for the currently logged in user.
|
|
1056
2299
|
*
|
|
1057
2300
|
* @throws {AppwriteException}
|
|
1058
2301
|
* @returns {Promise<Preferences>}
|
|
1059
2302
|
*/
|
|
1060
|
-
getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
|
|
2303
|
+
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> {
|
|
2304
|
+
|
|
1061
2305
|
const apiPath = '/account/prefs';
|
|
1062
2306
|
const payload: Payload = {};
|
|
1063
2307
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1072,17 +2316,43 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1072
2316
|
payload
|
|
1073
2317
|
);
|
|
1074
2318
|
}
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
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.
|
|
2322
|
+
*
|
|
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>>;
|
|
1075
2328
|
/**
|
|
1076
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.
|
|
1077
2330
|
*
|
|
1078
|
-
* @param {Partial<Preferences>} prefs
|
|
2331
|
+
* @param {Partial<Preferences>} prefs - Prefs key-value JSON object.
|
|
1079
2332
|
* @throws {AppwriteException}
|
|
1080
2333
|
* @returns {Promise<Models.User<Preferences>>}
|
|
2334
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1081
2335
|
*/
|
|
1082
|
-
updatePrefs<Preferences extends Models.Preferences>(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
|
+
|
|
1083
2352
|
if (typeof prefs === 'undefined') {
|
|
1084
2353
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
1085
2354
|
}
|
|
2355
|
+
|
|
1086
2356
|
const apiPath = '/account/prefs';
|
|
1087
2357
|
const payload: Payload = {};
|
|
1088
2358
|
if (typeof prefs !== 'undefined') {
|
|
@@ -1101,21 +2371,51 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1101
2371
|
payload
|
|
1102
2372
|
);
|
|
1103
2373
|
}
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
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>;
|
|
1104
2384
|
/**
|
|
1105
|
-
* 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
|
|
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.
|
|
1106
2386
|
*
|
|
1107
|
-
* @param {string} email
|
|
1108
|
-
* @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.
|
|
1109
2389
|
* @throws {AppwriteException}
|
|
1110
2390
|
* @returns {Promise<Models.Token>}
|
|
2391
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1111
2392
|
*/
|
|
1112
|
-
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
|
+
|
|
1113
2412
|
if (typeof email === 'undefined') {
|
|
1114
2413
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1115
2414
|
}
|
|
1116
2415
|
if (typeof url === 'undefined') {
|
|
1117
2416
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1118
2417
|
}
|
|
2418
|
+
|
|
1119
2419
|
const apiPath = '/account/recovery';
|
|
1120
2420
|
const payload: Payload = {};
|
|
1121
2421
|
if (typeof email !== 'undefined') {
|
|
@@ -1137,18 +2437,52 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1137
2437
|
payload
|
|
1138
2438
|
);
|
|
1139
2439
|
}
|
|
2440
|
+
|
|
1140
2441
|
/**
|
|
1141
2442
|
* 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.
|
|
1142
|
-
|
|
1143
|
-
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.
|
|
2443
|
+
*
|
|
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.
|
|
2445
|
+
*
|
|
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.
|
|
1144
2457
|
*
|
|
1145
|
-
* @param {string} userId
|
|
1146
|
-
* @param {string} secret
|
|
1147
|
-
* @param {string} password
|
|
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.
|
|
1148
2461
|
* @throws {AppwriteException}
|
|
1149
2462
|
* @returns {Promise<Models.Token>}
|
|
2463
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1150
2464
|
*/
|
|
1151
|
-
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
|
+
|
|
1152
2486
|
if (typeof userId === 'undefined') {
|
|
1153
2487
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1154
2488
|
}
|
|
@@ -1158,6 +2492,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1158
2492
|
if (typeof password === 'undefined') {
|
|
1159
2493
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
1160
2494
|
}
|
|
2495
|
+
|
|
1161
2496
|
const apiPath = '/account/recovery';
|
|
1162
2497
|
const payload: Payload = {};
|
|
1163
2498
|
if (typeof userId !== 'undefined') {
|
|
@@ -1182,6 +2517,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1182
2517
|
payload
|
|
1183
2518
|
);
|
|
1184
2519
|
}
|
|
2520
|
+
|
|
1185
2521
|
/**
|
|
1186
2522
|
* Get the list of active sessions across different devices for the currently logged in user.
|
|
1187
2523
|
*
|
|
@@ -1189,6 +2525,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1189
2525
|
* @returns {Promise<Models.SessionList>}
|
|
1190
2526
|
*/
|
|
1191
2527
|
listSessions(): Promise<Models.SessionList> {
|
|
2528
|
+
|
|
1192
2529
|
const apiPath = '/account/sessions';
|
|
1193
2530
|
const payload: Payload = {};
|
|
1194
2531
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1203,6 +2540,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1203
2540
|
payload
|
|
1204
2541
|
);
|
|
1205
2542
|
}
|
|
2543
|
+
|
|
1206
2544
|
/**
|
|
1207
2545
|
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
1208
2546
|
*
|
|
@@ -1210,6 +2548,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1210
2548
|
* @returns {Promise<{}>}
|
|
1211
2549
|
*/
|
|
1212
2550
|
deleteSessions(): Promise<{}> {
|
|
2551
|
+
|
|
1213
2552
|
const apiPath = '/account/sessions';
|
|
1214
2553
|
const payload: Payload = {};
|
|
1215
2554
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1225,6 +2564,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1225
2564
|
payload
|
|
1226
2565
|
);
|
|
1227
2566
|
}
|
|
2567
|
+
|
|
1228
2568
|
/**
|
|
1229
2569
|
* Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1230
2570
|
*
|
|
@@ -1232,6 +2572,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1232
2572
|
* @returns {Promise<Models.Session>}
|
|
1233
2573
|
*/
|
|
1234
2574
|
createAnonymousSession(): Promise<Models.Session> {
|
|
2575
|
+
|
|
1235
2576
|
const apiPath = '/account/sessions/anonymous';
|
|
1236
2577
|
const payload: Payload = {};
|
|
1237
2578
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1247,23 +2588,55 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1247
2588
|
payload
|
|
1248
2589
|
);
|
|
1249
2590
|
}
|
|
2591
|
+
|
|
1250
2592
|
/**
|
|
1251
2593
|
* 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.
|
|
1252
|
-
|
|
1253
|
-
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).
|
|
2594
|
+
*
|
|
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).
|
|
2596
|
+
*
|
|
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).
|
|
1254
2607
|
*
|
|
1255
|
-
* @param {string} email
|
|
1256
|
-
* @param {string} password
|
|
2608
|
+
* @param {string} email - User email.
|
|
2609
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
1257
2610
|
* @throws {AppwriteException}
|
|
1258
2611
|
* @returns {Promise<Models.Session>}
|
|
2612
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1259
2613
|
*/
|
|
1260
|
-
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
|
+
|
|
1261
2633
|
if (typeof email === 'undefined') {
|
|
1262
2634
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1263
2635
|
}
|
|
1264
2636
|
if (typeof password === 'undefined') {
|
|
1265
2637
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
1266
2638
|
}
|
|
2639
|
+
|
|
1267
2640
|
const apiPath = '/account/sessions/email';
|
|
1268
2641
|
const payload: Payload = {};
|
|
1269
2642
|
if (typeof email !== 'undefined') {
|
|
@@ -1285,21 +2658,52 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1285
2658
|
payload
|
|
1286
2659
|
);
|
|
1287
2660
|
}
|
|
2661
|
+
|
|
2662
|
+
/**
|
|
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.
|
|
2664
|
+
*
|
|
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.
|
|
2667
|
+
* @throws {AppwriteException}
|
|
2668
|
+
* @returns {Promise<Models.Session>}
|
|
2669
|
+
* @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
|
|
2670
|
+
*/
|
|
2671
|
+
updateMagicURLSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
1288
2672
|
/**
|
|
1289
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.
|
|
1290
2674
|
*
|
|
1291
|
-
* @param {string} userId
|
|
1292
|
-
* @param {string} secret
|
|
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.
|
|
1293
2677
|
* @throws {AppwriteException}
|
|
1294
2678
|
* @returns {Promise<Models.Session>}
|
|
2679
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1295
2680
|
*/
|
|
1296
|
-
updateMagicURLSession(userId: string, secret: string): Promise<Models.Session
|
|
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
|
+
|
|
1297
2700
|
if (typeof userId === 'undefined') {
|
|
1298
2701
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1299
2702
|
}
|
|
1300
2703
|
if (typeof secret === 'undefined') {
|
|
1301
2704
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1302
2705
|
}
|
|
2706
|
+
|
|
1303
2707
|
const apiPath = '/account/sessions/magic-url';
|
|
1304
2708
|
const payload: Payload = {};
|
|
1305
2709
|
if (typeof userId !== 'undefined') {
|
|
@@ -1321,25 +2725,66 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1321
2725
|
payload
|
|
1322
2726
|
);
|
|
1323
2727
|
}
|
|
1324
|
-
/**
|
|
1325
|
-
* 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.
|
|
1326
|
-
|
|
1327
|
-
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.
|
|
1328
|
-
|
|
1329
|
-
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).
|
|
1330
2728
|
|
|
2729
|
+
/**
|
|
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.
|
|
2747
|
+
*
|
|
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.
|
|
2749
|
+
*
|
|
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).
|
|
2751
|
+
*
|
|
1331
2752
|
*
|
|
1332
|
-
* @param {OAuthProvider} provider
|
|
1333
|
-
* @param {string} success
|
|
1334
|
-
* @param {string} failure
|
|
1335
|
-
* @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.
|
|
1336
2757
|
* @throws {AppwriteException}
|
|
1337
2758
|
* @returns {void | string}
|
|
2759
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1338
2760
|
*/
|
|
1339
|
-
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
|
+
|
|
1340
2784
|
if (typeof provider === 'undefined') {
|
|
1341
2785
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1342
2786
|
}
|
|
2787
|
+
|
|
1343
2788
|
const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
|
|
1344
2789
|
const payload: Payload = {};
|
|
1345
2790
|
if (typeof success !== 'undefined') {
|
|
@@ -1369,21 +2814,52 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1369
2814
|
return uri.toString();
|
|
1370
2815
|
}
|
|
1371
2816
|
}
|
|
2817
|
+
|
|
2818
|
+
/**
|
|
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.
|
|
2820
|
+
*
|
|
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>;
|
|
1372
2828
|
/**
|
|
1373
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.
|
|
1374
2830
|
*
|
|
1375
|
-
* @param {string} userId
|
|
1376
|
-
* @param {string} secret
|
|
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.
|
|
1377
2833
|
* @throws {AppwriteException}
|
|
1378
2834
|
* @returns {Promise<Models.Session>}
|
|
2835
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1379
2836
|
*/
|
|
1380
|
-
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
|
+
|
|
1381
2856
|
if (typeof userId === 'undefined') {
|
|
1382
2857
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1383
2858
|
}
|
|
1384
2859
|
if (typeof secret === 'undefined') {
|
|
1385
2860
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1386
2861
|
}
|
|
2862
|
+
|
|
1387
2863
|
const apiPath = '/account/sessions/phone';
|
|
1388
2864
|
const payload: Payload = {};
|
|
1389
2865
|
if (typeof userId !== 'undefined') {
|
|
@@ -1405,21 +2881,51 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1405
2881
|
payload
|
|
1406
2882
|
);
|
|
1407
2883
|
}
|
|
2884
|
+
|
|
2885
|
+
/**
|
|
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.
|
|
2887
|
+
*
|
|
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.
|
|
2890
|
+
* @throws {AppwriteException}
|
|
2891
|
+
* @returns {Promise<Models.Session>}
|
|
2892
|
+
*/
|
|
2893
|
+
createSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
1408
2894
|
/**
|
|
1409
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.
|
|
1410
2896
|
*
|
|
1411
|
-
* @param {string} userId
|
|
1412
|
-
* @param {string} secret
|
|
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.
|
|
1413
2899
|
* @throws {AppwriteException}
|
|
1414
2900
|
* @returns {Promise<Models.Session>}
|
|
2901
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1415
2902
|
*/
|
|
1416
|
-
createSession(userId: string, secret: string): Promise<Models.Session
|
|
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
|
+
|
|
1417
2922
|
if (typeof userId === 'undefined') {
|
|
1418
2923
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1419
2924
|
}
|
|
1420
2925
|
if (typeof secret === 'undefined') {
|
|
1421
2926
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1422
2927
|
}
|
|
2928
|
+
|
|
1423
2929
|
const apiPath = '/account/sessions/token';
|
|
1424
2930
|
const payload: Payload = {};
|
|
1425
2931
|
if (typeof userId !== 'undefined') {
|
|
@@ -1441,17 +2947,43 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1441
2947
|
payload
|
|
1442
2948
|
);
|
|
1443
2949
|
}
|
|
2950
|
+
|
|
1444
2951
|
/**
|
|
1445
|
-
* 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.
|
|
1446
2953
|
*
|
|
1447
|
-
* @param {string} sessionId
|
|
2954
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
1448
2955
|
* @throws {AppwriteException}
|
|
1449
2956
|
* @returns {Promise<Models.Session>}
|
|
1450
2957
|
*/
|
|
1451
|
-
getSession(sessionId: string): Promise<Models.Session
|
|
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.
|
|
2961
|
+
*
|
|
2962
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
2963
|
+
* @throws {AppwriteException}
|
|
2964
|
+
* @returns {Promise<Models.Session>}
|
|
2965
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2966
|
+
*/
|
|
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
|
+
|
|
1452
2983
|
if (typeof sessionId === 'undefined') {
|
|
1453
2984
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1454
2985
|
}
|
|
2986
|
+
|
|
1455
2987
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1456
2988
|
const payload: Payload = {};
|
|
1457
2989
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1466,17 +2998,43 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1466
2998
|
payload
|
|
1467
2999
|
);
|
|
1468
3000
|
}
|
|
3001
|
+
|
|
3002
|
+
/**
|
|
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>;
|
|
1469
3010
|
/**
|
|
1470
|
-
* Use this endpoint to extend a session
|
|
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.
|
|
1471
3012
|
*
|
|
1472
|
-
* @param {string} sessionId
|
|
3013
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
1473
3014
|
* @throws {AppwriteException}
|
|
1474
3015
|
* @returns {Promise<Models.Session>}
|
|
3016
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1475
3017
|
*/
|
|
1476
|
-
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
|
+
|
|
1477
3034
|
if (typeof sessionId === 'undefined') {
|
|
1478
3035
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1479
3036
|
}
|
|
3037
|
+
|
|
1480
3038
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1481
3039
|
const payload: Payload = {};
|
|
1482
3040
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1492,17 +3050,43 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1492
3050
|
payload
|
|
1493
3051
|
);
|
|
1494
3052
|
}
|
|
3053
|
+
|
|
1495
3054
|
/**
|
|
1496
|
-
* 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.
|
|
1497
3056
|
*
|
|
1498
|
-
* @param {string} sessionId
|
|
3057
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
1499
3058
|
* @throws {AppwriteException}
|
|
1500
3059
|
* @returns {Promise<{}>}
|
|
1501
3060
|
*/
|
|
1502
|
-
deleteSession(sessionId: string): Promise<{}
|
|
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.
|
|
3064
|
+
*
|
|
3065
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
3066
|
+
* @throws {AppwriteException}
|
|
3067
|
+
* @returns {Promise<{}>}
|
|
3068
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3069
|
+
*/
|
|
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
|
+
|
|
1503
3086
|
if (typeof sessionId === 'undefined') {
|
|
1504
3087
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1505
3088
|
}
|
|
3089
|
+
|
|
1506
3090
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1507
3091
|
const payload: Payload = {};
|
|
1508
3092
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1518,13 +3102,15 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1518
3102
|
payload
|
|
1519
3103
|
);
|
|
1520
3104
|
}
|
|
3105
|
+
|
|
1521
3106
|
/**
|
|
1522
3107
|
* Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
|
|
1523
3108
|
*
|
|
1524
3109
|
* @throws {AppwriteException}
|
|
1525
3110
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1526
3111
|
*/
|
|
1527
|
-
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
3112
|
+
updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
3113
|
+
|
|
1528
3114
|
const apiPath = '/account/status';
|
|
1529
3115
|
const payload: Payload = {};
|
|
1530
3116
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1540,22 +3126,55 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1540
3126
|
payload
|
|
1541
3127
|
);
|
|
1542
3128
|
}
|
|
3129
|
+
|
|
3130
|
+
/**
|
|
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.
|
|
3132
|
+
*
|
|
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>;
|
|
1543
3140
|
/**
|
|
1544
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.
|
|
1545
3142
|
*
|
|
1546
|
-
* @param {string} targetId
|
|
1547
|
-
* @param {string} identifier
|
|
1548
|
-
* @param {string} providerId
|
|
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.
|
|
1549
3146
|
* @throws {AppwriteException}
|
|
1550
3147
|
* @returns {Promise<Models.Target>}
|
|
3148
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1551
3149
|
*/
|
|
1552
|
-
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
|
+
|
|
1553
3171
|
if (typeof targetId === 'undefined') {
|
|
1554
3172
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1555
3173
|
}
|
|
1556
3174
|
if (typeof identifier === 'undefined') {
|
|
1557
3175
|
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1558
3176
|
}
|
|
3177
|
+
|
|
1559
3178
|
const apiPath = '/account/targets/push';
|
|
1560
3179
|
const payload: Payload = {};
|
|
1561
3180
|
if (typeof targetId !== 'undefined') {
|
|
@@ -1580,21 +3199,51 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1580
3199
|
payload
|
|
1581
3200
|
);
|
|
1582
3201
|
}
|
|
3202
|
+
|
|
3203
|
+
/**
|
|
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>;
|
|
1583
3212
|
/**
|
|
1584
|
-
* Update the currently logged in user
|
|
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.
|
|
1585
3214
|
*
|
|
1586
|
-
* @param {string} targetId
|
|
1587
|
-
* @param {string} identifier
|
|
3215
|
+
* @param {string} targetId - Target ID.
|
|
3216
|
+
* @param {string} identifier - The target identifier (token, email, phone etc.)
|
|
1588
3217
|
* @throws {AppwriteException}
|
|
1589
3218
|
* @returns {Promise<Models.Target>}
|
|
3219
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1590
3220
|
*/
|
|
1591
|
-
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
|
+
|
|
1592
3240
|
if (typeof targetId === 'undefined') {
|
|
1593
3241
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1594
3242
|
}
|
|
1595
3243
|
if (typeof identifier === 'undefined') {
|
|
1596
3244
|
throw new AppwriteException('Missing required parameter: "identifier"');
|
|
1597
3245
|
}
|
|
3246
|
+
|
|
1598
3247
|
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1599
3248
|
const payload: Payload = {};
|
|
1600
3249
|
if (typeof identifier !== 'undefined') {
|
|
@@ -1613,17 +3262,43 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1613
3262
|
payload
|
|
1614
3263
|
);
|
|
1615
3264
|
}
|
|
3265
|
+
|
|
3266
|
+
/**
|
|
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.
|
|
3268
|
+
*
|
|
3269
|
+
* @param {string} params.targetId - Target ID.
|
|
3270
|
+
* @throws {AppwriteException}
|
|
3271
|
+
* @returns {Promise<{}>}
|
|
3272
|
+
*/
|
|
3273
|
+
deletePushTarget(params: { targetId: string }): Promise<{}>;
|
|
1616
3274
|
/**
|
|
1617
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.
|
|
1618
3276
|
*
|
|
1619
|
-
* @param {string} targetId
|
|
3277
|
+
* @param {string} targetId - Target ID.
|
|
1620
3278
|
* @throws {AppwriteException}
|
|
1621
3279
|
* @returns {Promise<{}>}
|
|
3280
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1622
3281
|
*/
|
|
1623
|
-
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
|
+
|
|
1624
3298
|
if (typeof targetId === 'undefined') {
|
|
1625
3299
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1626
3300
|
}
|
|
3301
|
+
|
|
1627
3302
|
const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
1628
3303
|
const payload: Payload = {};
|
|
1629
3304
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1639,24 +3314,61 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1639
3314
|
payload
|
|
1640
3315
|
);
|
|
1641
3316
|
}
|
|
1642
|
-
/**
|
|
1643
|
-
* Sends the user an email 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 email is valid for 15 minutes.
|
|
1644
3317
|
|
|
1645
|
-
|
|
3318
|
+
/**
|
|
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.
|
|
3333
|
+
*
|
|
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
|
+
*
|
|
1646
3336
|
*
|
|
1647
|
-
* @param {string} userId
|
|
1648
|
-
* @param {string} email
|
|
1649
|
-
* @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.
|
|
1650
3340
|
* @throws {AppwriteException}
|
|
1651
3341
|
* @returns {Promise<Models.Token>}
|
|
3342
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1652
3343
|
*/
|
|
1653
|
-
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
|
+
|
|
1654
3365
|
if (typeof userId === 'undefined') {
|
|
1655
3366
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1656
3367
|
}
|
|
1657
3368
|
if (typeof email === 'undefined') {
|
|
1658
3369
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1659
3370
|
}
|
|
3371
|
+
|
|
1660
3372
|
const apiPath = '/account/tokens/email';
|
|
1661
3373
|
const payload: Payload = {};
|
|
1662
3374
|
if (typeof userId !== 'undefined') {
|
|
@@ -1681,26 +3393,65 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1681
3393
|
payload
|
|
1682
3394
|
);
|
|
1683
3395
|
}
|
|
1684
|
-
/**
|
|
1685
|
-
* 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.
|
|
1686
|
-
|
|
1687
|
-
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).
|
|
1688
3396
|
|
|
3397
|
+
/**
|
|
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.
|
|
3413
|
+
*
|
|
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).
|
|
3415
|
+
*
|
|
1689
3416
|
*
|
|
1690
|
-
* @param {string} userId
|
|
1691
|
-
* @param {string} email
|
|
1692
|
-
* @param {string} url
|
|
1693
|
-
* @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.
|
|
1694
3421
|
* @throws {AppwriteException}
|
|
1695
3422
|
* @returns {Promise<Models.Token>}
|
|
3423
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1696
3424
|
*/
|
|
1697
|
-
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
|
+
|
|
1698
3448
|
if (typeof userId === 'undefined') {
|
|
1699
3449
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1700
3450
|
}
|
|
1701
3451
|
if (typeof email === 'undefined') {
|
|
1702
3452
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1703
3453
|
}
|
|
3454
|
+
|
|
1704
3455
|
const apiPath = '/account/tokens/magic-url';
|
|
1705
3456
|
const payload: Payload = {};
|
|
1706
3457
|
if (typeof userId !== 'undefined') {
|
|
@@ -1728,24 +3479,64 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1728
3479
|
payload
|
|
1729
3480
|
);
|
|
1730
3481
|
}
|
|
1731
|
-
/**
|
|
1732
|
-
* 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.
|
|
1733
|
-
|
|
1734
|
-
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.
|
|
1735
3482
|
|
|
1736
|
-
|
|
3483
|
+
/**
|
|
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.
|
|
3500
|
+
*
|
|
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.
|
|
3502
|
+
*
|
|
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).
|
|
1737
3504
|
*
|
|
1738
|
-
* @param {OAuthProvider} provider
|
|
1739
|
-
* @param {string} success
|
|
1740
|
-
* @param {string} failure
|
|
1741
|
-
* @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.
|
|
1742
3509
|
* @throws {AppwriteException}
|
|
1743
3510
|
* @returns {void | string}
|
|
3511
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1744
3512
|
*/
|
|
1745
|
-
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
|
+
|
|
1746
3536
|
if (typeof provider === 'undefined') {
|
|
1747
3537
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1748
3538
|
}
|
|
3539
|
+
|
|
1749
3540
|
const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
|
|
1750
3541
|
const payload: Payload = {};
|
|
1751
3542
|
if (typeof success !== 'undefined') {
|
|
@@ -1775,23 +3566,55 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1775
3566
|
return uri.toString();
|
|
1776
3567
|
}
|
|
1777
3568
|
}
|
|
1778
|
-
/**
|
|
1779
|
-
* 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.
|
|
1780
3569
|
|
|
1781
|
-
|
|
3570
|
+
/**
|
|
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.
|
|
3583
|
+
*
|
|
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).
|
|
1782
3585
|
*
|
|
1783
|
-
* @param {string} userId
|
|
1784
|
-
* @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.
|
|
1785
3588
|
* @throws {AppwriteException}
|
|
1786
3589
|
* @returns {Promise<Models.Token>}
|
|
3590
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1787
3591
|
*/
|
|
1788
|
-
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
|
+
|
|
1789
3611
|
if (typeof userId === 'undefined') {
|
|
1790
3612
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1791
3613
|
}
|
|
1792
3614
|
if (typeof phone === 'undefined') {
|
|
1793
3615
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1794
3616
|
}
|
|
3617
|
+
|
|
1795
3618
|
const apiPath = '/account/tokens/phone';
|
|
1796
3619
|
const payload: Payload = {};
|
|
1797
3620
|
if (typeof userId !== 'undefined') {
|
|
@@ -1813,21 +3636,112 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1813
3636
|
payload
|
|
1814
3637
|
);
|
|
1815
3638
|
}
|
|
3639
|
+
|
|
3640
|
+
/**
|
|
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>;
|
|
1816
3651
|
/**
|
|
1817
|
-
* 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
|
|
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
|
+
}
|
|
1818
3692
|
|
|
1819
|
-
|
|
3693
|
+
return this.client.call(
|
|
3694
|
+
'post',
|
|
3695
|
+
uri,
|
|
3696
|
+
apiHeaders,
|
|
3697
|
+
payload
|
|
3698
|
+
);
|
|
3699
|
+
}
|
|
1820
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.
|
|
3715
|
+
*
|
|
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.
|
|
3717
|
+
*
|
|
1821
3718
|
*
|
|
1822
|
-
* @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.
|
|
1823
3720
|
* @throws {AppwriteException}
|
|
1824
3721
|
* @returns {Promise<Models.Token>}
|
|
3722
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1825
3723
|
*/
|
|
1826
|
-
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
|
+
|
|
1827
3740
|
if (typeof url === 'undefined') {
|
|
1828
3741
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1829
3742
|
}
|
|
1830
|
-
|
|
3743
|
+
|
|
3744
|
+
const apiPath = '/account/verifications/email';
|
|
1831
3745
|
const payload: Payload = {};
|
|
1832
3746
|
if (typeof url !== 'undefined') {
|
|
1833
3747
|
payload['url'] = url;
|
|
@@ -1845,22 +3759,119 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1845
3759
|
payload
|
|
1846
3760
|
);
|
|
1847
3761
|
}
|
|
3762
|
+
|
|
3763
|
+
/**
|
|
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.
|
|
3765
|
+
*
|
|
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.
|
|
3834
|
+
* @throws {AppwriteException}
|
|
3835
|
+
* @returns {Promise<Models.Token>}
|
|
3836
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.
|
|
3837
|
+
*/
|
|
3838
|
+
updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
1848
3839
|
/**
|
|
1849
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.
|
|
1850
3841
|
*
|
|
1851
|
-
* @param {string} userId
|
|
1852
|
-
* @param {string} secret
|
|
3842
|
+
* @param {string} userId - User ID.
|
|
3843
|
+
* @param {string} secret - Valid verification token.
|
|
1853
3844
|
* @throws {AppwriteException}
|
|
1854
3845
|
* @returns {Promise<Models.Token>}
|
|
3846
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1855
3847
|
*/
|
|
1856
|
-
updateVerification(userId: string, secret: string): Promise<Models.Token
|
|
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
|
+
|
|
1857
3867
|
if (typeof userId === 'undefined') {
|
|
1858
3868
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1859
3869
|
}
|
|
1860
3870
|
if (typeof secret === 'undefined') {
|
|
1861
3871
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1862
3872
|
}
|
|
1863
|
-
|
|
3873
|
+
|
|
3874
|
+
const apiPath = '/account/verifications/email';
|
|
1864
3875
|
const payload: Payload = {};
|
|
1865
3876
|
if (typeof userId !== 'undefined') {
|
|
1866
3877
|
payload['userId'] = userId;
|
|
@@ -1881,14 +3892,16 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1881
3892
|
payload
|
|
1882
3893
|
);
|
|
1883
3894
|
}
|
|
3895
|
+
|
|
1884
3896
|
/**
|
|
1885
|
-
* 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.
|
|
1886
3898
|
*
|
|
1887
3899
|
* @throws {AppwriteException}
|
|
1888
3900
|
* @returns {Promise<Models.Token>}
|
|
1889
3901
|
*/
|
|
1890
3902
|
createPhoneVerification(): Promise<Models.Token> {
|
|
1891
|
-
|
|
3903
|
+
|
|
3904
|
+
const apiPath = '/account/verifications/phone';
|
|
1892
3905
|
const payload: Payload = {};
|
|
1893
3906
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1894
3907
|
|
|
@@ -1903,22 +3916,52 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1903
3916
|
payload
|
|
1904
3917
|
);
|
|
1905
3918
|
}
|
|
3919
|
+
|
|
3920
|
+
/**
|
|
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>;
|
|
1906
3929
|
/**
|
|
1907
|
-
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user
|
|
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.
|
|
1908
3931
|
*
|
|
1909
|
-
* @param {string} userId
|
|
1910
|
-
* @param {string} secret
|
|
3932
|
+
* @param {string} userId - User ID.
|
|
3933
|
+
* @param {string} secret - Valid verification token.
|
|
1911
3934
|
* @throws {AppwriteException}
|
|
1912
3935
|
* @returns {Promise<Models.Token>}
|
|
3936
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1913
3937
|
*/
|
|
1914
|
-
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
|
+
|
|
1915
3957
|
if (typeof userId === 'undefined') {
|
|
1916
3958
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1917
3959
|
}
|
|
1918
3960
|
if (typeof secret === 'undefined') {
|
|
1919
3961
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1920
3962
|
}
|
|
1921
|
-
|
|
3963
|
+
|
|
3964
|
+
const apiPath = '/account/verifications/phone';
|
|
1922
3965
|
const payload: Payload = {};
|
|
1923
3966
|
if (typeof userId !== 'undefined') {
|
|
1924
3967
|
payload['userId'] = userId;
|